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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 16th, 2015, 01:40 PM
wrenchmaster wrenchmaster is offline
Junior Community Member
 
Join Date: Dec 2013
Posts: 44
Default How to use Oldstyle figures in FP

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?
Reply With Quote
  #2  
Old January 16th, 2015, 02:35 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,369
Default Re: How to use Oldstyle figures in FP

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
__________________
__________________
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
  #3  
Old January 16th, 2015, 02:45 PM
wrenchmaster wrenchmaster is offline
Junior Community Member
 
Join Date: Dec 2013
Posts: 44
Default Re: How to use Oldstyle figures in FP

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.

Last edited by wrenchmaster; January 16th, 2015 at 02:49 PM..
Reply With Quote
  #4  
Old January 16th, 2015, 02:50 PM
David Miller David Miller is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Wallingford, CT
Posts: 263
Default Re: How to use Oldstyle figures in FP

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.
__________________
David Miller
FusionPro VDP Creator 10.0.26
Adobe Acrobat Pro 2019.008.20074
Suitcase Fusion 20.0.0 (7653)
macOS High Sierra 10.13.6

Last edited by David Miller; January 19th, 2015 at 10:15 AM..
Reply With Quote
  #5  
Old January 16th, 2015, 03:05 PM
wrenchmaster wrenchmaster is offline
Junior Community Member
 
Join Date: Dec 2013
Posts: 44
Default Re: How to use Oldstyle figures in FP

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.
Reply With Quote
  #6  
Old January 16th, 2015, 03:20 PM
David Miller David Miller is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Wallingford, CT
Posts: 263
Default Re: How to use Oldstyle figures in FP

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.
__________________
David Miller
FusionPro VDP Creator 10.0.26
Adobe Acrobat Pro 2019.008.20074
Suitcase Fusion 20.0.0 (7653)
macOS High Sierra 10.13.6
Reply With Quote
  #7  
Old January 19th, 2015, 11:26 AM
wrenchmaster wrenchmaster is offline
Junior Community Member
 
Join Date: Dec 2013
Posts: 44
Default Re: How to use Oldstyle figures in FP

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.

Quote:
Originally Posted by David Miller View Post
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.
Reply With Quote
  #8  
Old January 19th, 2015, 12:25 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 211
Default Re: How to use Oldstyle figures in FP

Give this rule a shot:

Code:
return Field("Address").replace(/([0-9])/g, "&#6328$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.
Reply With Quote
  #9  
Old January 19th, 2015, 12:25 PM
wrenchmaster wrenchmaster is offline
Junior Community Member
 
Join Date: Dec 2013
Posts: 44
Default Re: How to use Oldstyle figures in FP

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);
}




Quote:
Originally Posted by David Miller View Post
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.
Reply With Quote
  #10  
Old January 19th, 2015, 12:29 PM
wrenchmaster wrenchmaster is offline
Junior Community Member
 
Join Date: Dec 2013
Posts: 44
Default Re: How to use Oldstyle figures in FP

I appreciate the help... where do I insert this rule when completed?
Is the in the place of the field variable?

Quote:
Originally Posted by ThomasLewis View Post
Give this rule a shot:

Code:
return Field("Address").replace(/([0-9])/g, "ᢸ$1;").replace(/\s/g, "&nbsp;");
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.
Reply With Quote
Reply

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:02 PM.


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