wrenchmaster Posted January 16, 2015 Share Posted January 16, 2015 We have an Indesign project with address fields and numeric fields that need to use Oldstyle numbers. Our client used Minion Pro and set the attribute in Indesign to Oldstyle tabular. How can I get the same effect with FP? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 16, 2015 Share Posted January 16, 2015 A search of this forum for "oldstyle" turns up several threads, including the one containing this post: http://forums.pti.com/showpost.php?p=13049&postcount=10 __________________ Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 16, 2015 Author Share Posted January 16, 2015 (edited) I did see this earlier... it is over my head actually. Can this be explained any other way? We have the font for the Alpha characters working but not the numbers. In the address data, the street number and street name are combined in the record field, so we can't attribute the number separate from the name. Edited January 16, 2015 by wrenchmaster Quote Link to comment Share on other sites More sharing options...
David Miller Posted January 16, 2015 Share Posted January 16, 2015 (edited) Take a look at this post about Tabular Lining Characters here. When needed, I've had success creating a new font with the Tabular Lining Characters put in the Regular Characters positions. For example, copy the character one.tab and paste it in the character one position of a new font file. (Or whatever your oldstyle characters are named.) You'll need a font editor like TypeTool to accomplish this. I also suggest checking the font's end user license agreement before doing this. Edited January 19, 2015 by David Miller Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 16, 2015 Author Share Posted January 16, 2015 Bare with me, this is new territory for me. So your saying to create the old style subset from the original font? I may have an issue where our address field contains the number and street name combines. I can't separate the number from the name, so the entire variable would have the font assigned to it. Quote Link to comment Share on other sites More sharing options...
David Miller Posted January 16, 2015 Share Posted January 16, 2015 You could include the letters and numbers in the new font file. Or use a JavaScript Rule to return the letters in a different font than the numbers. An example can be found here. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 We don't have tools to allow us to modify fonts. Is there any place that ould explain how to accomplish this? We need the numbers in the address field to be OldStyle. The address field has the number and name in one field. Take a look at this post about Tabular Lining Characters here. When needed, I've had success creating a new font with the Tabular Lining Characters put in the Regular Characters positions. For example, copy the character one.tab and paste it in the character one position of a new font file. (Or whatever your oldstyle characters are named.) You'll need a font editor like TypeTool to accomplish this. I also suggest checking the font's end user license agreement before doing this. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 19, 2015 Share Posted January 19, 2015 Give this rule a shot: return Field("Address").replace(/([0-9])/g, "ᢸ$1;").replace(/\s/g, " "); You will need to turn on "Treat returned strings as tagged text" in the rule and also in the compose window, under the Advanced tab, turn off "Limit processing to Latin-1 text". Note: the second replace is only needed if you have have digits separated by spaces, ie "564 897 S. Street". For whatever reason Fusion pushes the digits together too closely and using non breaking spaces fixes that. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 Can you explain how to use this? I tried putting the field name and both font names above the line. I then attached it as a javascript rule to the variable field. The text does not change. Copy and paste everything below this line: // Edit the Field which to apply this function // Change the name of the Font that you want to use for numbers and letters. // If you use this Rule Inline, please be sure you style it Unique to the other fields, // the last font tag to be written is for letters and may not be correct for the next word. // You can get around this by styling the RuleName something totally unique and not used anywhere else. // var formatField = Field("address"); var fontNumber = "Courier New"; var fontLetter = "Helvetica"; ////////////////////////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE /////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// // //initialize the variable //var formatThis = "201a Highway 101 #150"; //Call the Main function and pass it the Field to use. // return FormatAlphaNumeric(formatField); //create function for formatting function FormatAlphaNumeric(){ //check if Field is empty if (formatField){ //if Field is not empty do this //check if String contains a number if (HasNumber(formatField)){ //if a number in the string, replace the numbers with the following font tags //but also put the numbers back into place formatField = formatField.replace(/(\d+)/g,"<f name=\""+fontNumber+"\">$1<f name=\""+fontLetter+"\">"); return formatField; } else { //if no number in the string say this //return "The Variable formatThis has no number"; return formatField; } } else { //if Field is empty say this //return "The Variable formatThis is empty"; return formatField; } } //create function for checking a string for number, anywhere function HasNumber(testString){ var patternNumber = /\d/; return patternNumber.test(testString); } //create function for checking a string for letter, anywhere function HasLetter(testString){ var patternNumber = /\D/; return patternNumber.test(testString); } You could include the letters and numbers in the new font file. Or use a JavaScript Rule to return the letters in a different font than the numbers. An example can be found here. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 I appreciate the help... where do I insert this rule when completed? Is the in the place of the field variable? Give this rule a shot: return Field("Address").replace(/([0-9])/g, "ᢸ$1;").replace(/\s/g, " "); You will need to turn on "Treat returned strings as tagged text" in the rule and also in the compose window, under the Advanced tab, turn off "Limit processing to Latin-1 text". Note: the second replace is only needed if you have have digits separated by spaces, ie "564 897 S. Street". For whatever reason Fusion pushes the digits together too closely and using non breaking spaces fixes that. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 19, 2015 Share Posted January 19, 2015 I appreciate the help... where do I insert this rule when completed? Is the in the place of the field variable? Yes, in the Variable Text Editor. Treat it like any other rule. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 OK, now before I try it let me make sure I have all my ducks lined up... Just to make sure you a clear on what I am trying to accomplish, I have rambled on in the post and it may be confusing. I have a data field called [Delivery Address] which contains the street number and name. The customer is using minion pro and the fonts are old style Tabular Oldstyle. How will I set the font? Do I set it in the text editor at the variable name? Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 19, 2015 Share Posted January 19, 2015 OK, now before I try it let me make sure I have all my ducks lined up... Just to make sure you a clear on what I am trying to accomplish, I have rambled on in the post and it may be confusing. I have a data field called [Delivery Address] which contains the street number and name. The customer is using minion pro and the fonts are old style Tabular Oldstyle. How will I set the font? Do I set it in the text editor at the variable name? Create a new rule called "rule_DeliveryAddress". Paste the code in as indicated but change the Field to Field("Delivery Address"). Check the box that says "Treat returned strings as tagged text". Open text frame where you want the changed text and insert the «rule_DeliveryAddress» variable. Highlight it and change the font to Minion Pro. Go to the compose dialog and the Advanced tab. Turn off the box that says "Limit processing to Latin-1 text". Let me know how it works. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 Doesn't seem to work, this is what I get. Can you see the screen shot Create a new rule called "rule_DeliveryAddress". Paste the code in as indicated but change the Field to Field("Delivery Address"). Check the box that says "Treat returned strings as tagged text". Open text frame where you want the changed text and insert the «rule_DeliveryAddress» variable. Highlight it and change the font to Minion Pro. Go to the compose dialog and the Advanced tab. Turn off the box that says "Limit processing to Latin-1 text". Let me know how it works. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 In this capture the first line is how I want the delivery address to appear. It is combine in a single field for both the street number and name. The second line is how I want a variable called ask amount to appear. This is just a number in the fields. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 19, 2015 Share Posted January 19, 2015 (edited) Go back and look at my post with the script in it. It needs to be exactly as indicated. Notice how your post where you quoted me has the code messed up. If you copied and pasted from that, then it won't work. Edited January 19, 2015 by ThomasLewis Added screenshot. Where n represents a Field value. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 That worked!!!!! I didn't notice the corruption. Can I apply this to another rule for the ask amount variables? Go back and look at my post with the script in it. It needs to be exactly as indicated. Notice how your post where you quoted me has the code messed up. If you copied and pasted from that, then it won't work. Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 19, 2015 Share Posted January 19, 2015 Can I apply this to another rule for the ask amount variables? Sure. The only thing I would caution you on is this is specific to Minion Pro. It will probably work for other Adobe Pro fonts assuming they put the numerals in the same spot. For future readers of this thread: As Dan mentioned in the thread he pointed to earlier, there is no standard so it is impossible to predict where the numerical characters are. If you were to use this for other fonts you would need to find the unicode area where they are located using a program like Character Map and then get the ascii values. In this particular case it's a fortunate coincidence (or well planned) that the last character of the ascii value is the same as the numerical value, resulting in very a straight forward regex replacement. Quote Link to comment Share on other sites More sharing options...
wrenchmaster Posted January 19, 2015 Author Share Posted January 19, 2015 Thomas, That worked great! Now, when you have time can you explain what parts of the rule made it happen and how? Thanks Again Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 20, 2015 Share Posted January 20, 2015 (edited) Now, when you have time can you explain what parts of the rule made it happen and how? There's a lot of good information in the links in Dan's signature. You might take a look at some of those and also learn about regular expressions. They can get quite complex depending on what you want to do. Basically in this case we are just finding any digit 0-9 and replacing it with the ascii code for the oldstyle number. Example for this specific case with Minion Pro: (These should have an & in front of the # but the forums seem to hate this) 0 = #63280; 1 = #63281; 2 = #63282; etc. The $1 is a placeholder for what the replacement found, ie if it found a 3 then $1 is a 3. As I mentioned earlier, this may not always be the case depending on where the font creator decides to put those figures. Edited January 20, 2015 by ThomasLewis Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 20, 2015 Share Posted January 20, 2015 Here's an updated version that should work with any ascii positions. Simply find the ascii number where the 0 is. For many Adobe Pro fonts the tabular oldstyle 0 is at 63043 and proportional oldstyle 0 is at 63280. //numerical ascii position without the var ascii = 63043; var n = "1234 S. Street, Suite 567"; return n.replace(/([0-9])/g, function(str, n) {return "" + (parseInt(n) + ascii) + ";";}).replace(/\s/g, " "); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.