Jump to content

Different Font Size & Tracking for Numbers & Letters


Recommended Posts

I found the following code in the forums and it has been a big help! Makes numbers and letters different font sizes.

 

return Field("Location").replace(/\d+/g,"<z newsize=\"6.1\">$&<z newsize=\"7.0\">");

 

Now we need to add font tracking to the mix. For example: numbers set to 6.1 pt and tracking at 2%, letters set to 7.0 pt and tracking 4%.

 

Is there a way to do this or an I doomed to tagging a lot of addresses?

 

Thanks!

Dave Miller

Link to comment
Share on other sites

I'm not great with regular expressions such as the one being used here, but I believe you can just add the tracking tags in the strings before and after the regular expression match (dollar-ampersand) like this:

 

 
return Field("Location").replace(/\d+/g,"<z newsize=\"6.1\"><tracking newsize=\"2\">$&<z newsize=\"7.0\"><tracking newsize=\"4\">");

Link to comment
Share on other sites

That seemed to work great. YOU saved me a LOT of time. Seriously!

 

Starting to get it... here is what if wound up using...

 

if (Field("Location")=="No Location")

LocationAddress=''

else if (Field("Location")=="Chicago Office")

LocationAddress='227 West Monroe Street Chicago, Illinois 606066-5096'

//blah blah blah more -else if- statements for Location variables

else LocationAddress="";

 

return LocationAddress.replace(/\d+/g,"<z newsize=\"6.1\"><tracking newsize=\"2\">$&<z newsize=\"7.0\"><tracking newsize=\"4\">");

 

Thanks,

Dave Miller

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...