...

View Full Version : change font size of #s in address



thisanthrope
05-21-2009, 01:08 PM
I operate as a admin a online print site where clients can enter in contact info to create imprint on promotional items.

I create pdf templates with field placeholders |1.1|[address]

This template is uploaded to the print site which interprets the tags and makes them into variable fields for clients to enter in their info. The site can pull the font name, size, position, etc... from the pdf template.

For each info field that the site creates it also has an option to apply javascript to that field. So if the template predefines font size X, I just want to apply code that will affect only the numbers of that text and make the numbers a larger font size than the letters.

The code I'm use to writing is pretty simple stuff for example to format dots instead of dashes for phone numbers like:

if (hasValue(curInput.name))
{
if (! AutoFormat(curInput, '###.###.####', 'Please enter your number in a 555.555.5555 format'))curInput.focus();
}


I've got no clue where to begin to do what I'm asking so a little help would be much appreciated.

thanks,

Philip M
05-21-2009, 06:31 PM
So if the template predefines font size X, I just want to apply code that will affect only the numbers of that text and make the numbers a larger font size than the letters.


AFAIK that is not possible.

Old Pedant
05-22-2009, 12:56 AM
It would be easy to *replace* each digit found with the same digit in a different font.

Is that what you are after???

Example:


<style>
span.BIGRED { font-size: large; color: red; }
</style>
<script>
var demo = "My phone number is 800-111-1212 and I am 37 years old."

var reBig = /(\d+)/g
demo = demo.replace( reBig, "<span class=BIGRED>$1</span>");
document.write( demo );
</script>

thisanthrope
05-22-2009, 02:13 PM
It would be easy to *replace* each digit found with the same digit in a different font.

Is that what you are after???

Example:


<style>
span.BIGRED { font-size: large; color: red; }
</style>
<script>
var demo = "My phone number is 800-111-1212 and I am 37 years old."

var reBig = /(\d+)/g
demo = demo.replace( reBig, "<span class=BIGRED>$1</span>");
document.write( demo );
</script>



well, not sure but I'll play around with this.

the reason I was needing this was that a certain customer uses a specific font. That font's numbers are slightly larger than the letters so when manually typesetting their business collateral, the street address letters are 6pt and the numbers 4.75pt so that they all appear at the same size. PITA

I've actually already resolved this by just making a custom font by editing the original so all characters are the same size.

It would have been nice to just plug in some javascript to automate this but problem fixed. Thanks for the help though and I'm sure this bit of code will be useful in other areas!

thisanthrope
05-22-2009, 02:20 PM
<style>
span.BIGRED { font-size: large; color: red; }
</style>
<script>
var demo = "My phone number is 800-111-1212 and I am 37 years old."

var reBig = /(\d+)/g
demo = demo.replace( reBig, "<span class=BIGRED>$1</span>");
document.write( demo );
</script>

Hey, this actually does work! not sure yet if I can specify a font point size instead of large, small, etc.... but yeah, this works.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum