Jump to content

Rule to All Cap numbers only throughout the document


Recommended Posts

I have a situation where all the fonts we use in our brand materials require the numbers in the font set(s) to be all caps. Is there a way to create a rule to apply this throughout the whole document? Example would be:


Morton Plant Hospital

Conference Center

Room 2

1234 Anyplace

May 2512:30pm


(866) 123-4567


The bold numbers indicate where I would need to cap the numbers.


In regards to the phone number, I am using the "Change Phone Format" rule to format the number as shown above. I also need a way to cap that as well, with in the current rule of format. So that I essentially get the format I want as well as the all caps.


In our standard text font, Minion, we don't need to cap the numbers, but for several others we need to have them capped. What is the best solution, other than using a different font (which we can't do), to make this work with FusionPro? Private message me as well please with any tips or ideas.


I am a noob when it comes to Java scripting, so I know have a HUGE learning curve here, any help will be greatly appreciated.



Link to comment
Share on other sites

What do you mean by numbers being in all caps? Numbers are not upper-case or lower-case like letters are. How would the number 2 look different in all caps than it does now?


Can you post an example of what your output looks like now, and a mockup of what you want it to look like instead? That would help to clarify what you mean.

Link to comment
Share on other sites

Yeah, sure. I attached a PDF of what we are doing. You can see in certain font locations (Date and Time as well as the phone number) that the numbers are different. We need to "force cap" these in every case, unless used in the Minion serif font. Now some numbers, like the 8 and 6 look fine, but the others don't and loo like the number 5. We need to cap these so that they all come out consistently.


Thanks for your help! Let me know if the PDF didn't upload correctly. First time using the thread.


Link to comment
Share on other sites

Oh, I see. Those aren't really "uppercase" and "lowercase" numbers. It's just that certain fonts have old-style numerals, where some numbers have descenders which go below the baseline, as opposed to most modern fonts, which use lining, or titling figures, where all numbers rest on the baseline and have the same height (like the Verdana font used here on the forum: "1234567890"). Here's more information about this:



Since whether the numbers are shown in old-style or lining style is a property of the font itself, there's no alternate font "style" (such as all caps) that you can apply to change this. As the Wikipedia article notes, some fonts may have different glyphs at certain Unicode code points which have alternate representations of digits (old-style versus lining), but the code points are not consistent.


So really, all you can do to make those numbers not descend below the baseline is use a different font which doesn't use "old-style" numbers.


It is certainly possible to write a rule which takes all of the numbers and shows them in a different font than the rest of the text. But the font you use for the numbers might not look right with the rest of the text in the original font.


So, the easiest way, by far, to do what you want is to select a completely different font, which doesn't use old-style numbers, for all of the text.

Link to comment
Share on other sites

Oh, so there isn't a way to "force cap" the numbers like you can do in InDesign to make them all the same height and on the same baseline huh? Only option is to change the font to something that doesn't use the old style figures? Hmph. That will limit us a little as a lot of our branding uses a font with old style figures.


Is there a way to create a custom Javascript rule to do what I need? Or is it simply impossible to do through FusionPro and JS?


Thanks again for your help!! :-D

Link to comment
Share on other sites

Oh, so there isn't a way to "force cap" the numbers like you can do in InDesign to make them all the same height and on the same baseline huh?

I'm not sure exactly what InDesign does there. Maybe it finds alternate numeric glyphs, or maybe it examines each glyph and adjusts its position on the baseline, or maybe something else. At any rate, No, FusionPro doesn't do that.

Only option is to change the font to something that doesn't use the old style figures? Hmph. That will limit us a little as a lot of our branding uses a font with old style figures.

The font is what the font is, as defined by the font designer. The fonts you're using were designed to use old-style numbers. I don't mean to be flippant, but if you don't want your branding to use old-style numbers, then don't use a font with old-style numbers. I mean, you could also say that you want just the letter "E" to look different in a font, but what you're really saying, in either case, is that you want a different font altogether, with your own modifications.

Is there a way to create a custom Javascript rule to do what I need? Or is it simply impossible to do through FusionPro and JS?

If you search this forum for the keywords "numbers different font," one of the results includes this:



You can use a variation on that logic, like so:

return Rule("Change Phone Format").replace(/(\d+)/g,'<f name="Arial">$1</f>');

Where you can replace "Arial" with whatever font you want the numbers to appear in. You'll have to experiment to find a font that's similar enough to the original font, though.


The other thing that might work, but it's going to require even more trial-and-error, is to set only certain numbers in superscript, like so:

return Rule("Change Phone Format").replace(/([34579]+)/g,'<superscript>$1</superscript>');

You'll have to adjust the superscript ratio and offset to get things to line up right. You can do this in tags like so:

return '<p br=false superratio=100 superoffset=30>' + Rule("Change Phone Format").replace(/([34579]+)/g,'<superscript>$1</superscript>');

Or you can set the ratio and offset in the Paragraph Globals dialog, and use the previous version of the rule (without the <p ...> tag). Obviously you want 100 percent ratio, so the numbers are all the same size, but you'll have to play around with the offset until things look right.

Link to comment
Share on other sites

To shed additional light on the question, I frequently use the exact font in your sample: Archer.


If you are using the OpenType version of Archer, it is like there are multiple versions available within a font style. InDesign allows you to select Archer Book, for example, and then choose options through the character palette. However, those additional font features are not available to you in FusionPro. So, for Archer Book, the default style, with shifted numbers, is what you get.


The work-around that I found was to use a postscript font set of Archer. Many of the alternate styles are available as separate named fonts. In my case, I needed Archer Book LF, Archer Bold LF, Archer Semibold LF, etc. instead of Archer Book, Archer Bold, and so on. So anywhere, I need numbers aligned to the baseline, I might pick Archer Book LF for the whole block of text.


In summary...

1) Try to get the postscript set of Archer. (I can't remember where we purchased, or I would provide a link.)


2) Find the font style within the set that fits your needs and use that instead.


3) The style may work for all of your body copy, but if you need to use an alternate style for specific segments of text, then Dan's suggestions for code to change the font will work.

Link to comment
Share on other sites

Purely out of curiosity, I decided to figure out how InDesign manages to change the "style" of the numbers. So I made a test InDesign file, exported it to both EPS and PDF, and examined the resulting files. It turns out that, at least for the fonts I was testing with, contrary to my own speculation in this thread, and in other threads, there are no alternate glyphs in the font for "lining" versus "old style" numbers.


What InDesign is doing is actually conjuring up new glyphs for those numeric characters and putting them into the font embedded in the EPS or PDF. The new glyphs are made up by stretching and adjusting the position of the original number character glyphs, but they're purely something that InDesign has invented, not part of the original font. In fact, when I open the EPS exported by InDesign in Illustrator, the modified "lining" numbers don't appear as text at all, but as sets of Bezier curves (which is what glyphs in a font really are, but usually text in a document is actual text, which uses the font to render the glyphs, instead of just having drawing commands for each letter).


So I would argue that InDesign isn't really honoring the original font, as created by the font designer. It's kind of playing tricks with the font to make it appear as if it contains glyphs that aren't really there. This is similar to how some programs, like MS Word, will conjure up a bold or italic style of a font that doesn't have one by changing the stroke width or applying a skew transformation. (FusionPro doesn't do that either.) In this case, though, as far as I know, InDesign is the only typesetting engine which has this particular feature to change the way that numbers in a font are typeset.


Whether modifying the glyphs like this is a "proper" way to deal with the font is a tough question. This is getting into the area where typesetting becomes more art than science. I can only reiterate that fonts are carefully crafted to show glyphs in a particular way, and InDesign is going out of its way to do something outside the bounds of what the font designer specified.


Regarding the question as to whether FusionPro could do something similar to what InDesign does here, the answer is Yes, it could. However, it's a somewhat complicated bit of trickery that InDesign is doing, and the amount of effort it would take to for FusionPro to emulate that is high. At the same time, the number of users who would actually take advantage of such a feature, as far as I know, is low. So the bottom line is that there are many other enhancements to the composition engine and the overall product which would seem to have a higher ROI. But, if anyone really needs this, please feel free to contact Sales about custom engineering work.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...