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
  #21  
Old January 19th, 2015, 06:02 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

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.

Code:
//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, " ");
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 10:52 AM.


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