Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old September 12th, 2012, 03:19 PM
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 869
Default Re: Tracking a Dollar Sign

A picture is worth a thousand words, right?

The first pic shows what the numeral "1" looks like by default in the font Rockwell Extra Bold:

Note the vertical rules to left and right of the number. They represent the built-in spacing that is used every time the "1" is typeset. That space is added to the adjacent space of the adjacent character. With Fontographer, I can edit that spacing to make my custom "1" look like:

See how the same vertical lines are much closer to the character shape? That equates to any adjacent character being that much closer to the number "1". Likewise, I could edit the spacing on other characters as needed.

Once you are comfortable with simple character edits, you can get more complicated and create "custom dingbats". I edited the shapes of unused characters (and saved font with a custom name) to create new "graphics" that I can incorporate into my variable text. For instance, if I want to generate text that says "3 for $5" or "3 for $1.99", I can now prefix the price value with a the right square bracket "]" using my custom font to return the following dingbat:

I also removed the spacing on the left side and customized the spacing on the right based on my specific use case. I could create a new font and replace a keystoke's default character with a custom image, signature, altered character, company logo, etc. Pretty cool!
Reply With Quote
  #12  
Old September 12th, 2012, 04:34 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,671
Default Re: Tracking a Dollar Sign

Quote:
Originally Posted by Meir View Post
It is not formatting the second instance of the number '1'.

I could fix this by adjusting it to
Code:
return NormalizeEntities(Price).replace(/(\$11)/g, "<tracking newsize=-20>$1</tracking>");
but because price will be a variable I want it correcting other instances as well.

I would only like to format '1' in all instances and '$' in instances where it comes before a '1'. So the above code works great for all instances I would format the '$' but leaves out all other '1' fixes (though I did not specify well enough and your answer put me much closer to the answer).

When I try
Code:
return NormalizeEntities(Price).replace(/(\$11)(1)/g, "<tracking newsize=-20>$1</tracking>");
OR
Code:
return NormalizeEntities(Price).replace(/(\$11)(\1)/g, "<tracking newsize=-20>$1</tracking>");
it returns with no formatting.

Is there away to account for this in that line of code, or would it be best to create a function that figures out if the first number is a one. If it is a one, then it returns a variable equal to '$1' run through Thomas's replace tracking tag followed by everything to the right of the initial 1 being sent through my original tracking tag which adjusts all instances of the number 1.
I think what you want is this:
Code:
return NormalizeEntities(Price).replace(/([\$1]+)/g, "<tracking newsize=-20>$1</tracking>");
Where, in regular expression syntax, "[\$1]+" means, "one or more of a set of '$' or '1' characters."
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Reply

Tags
kerning, newsize, tracking

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:06 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.