EricC Posted May 23, 2013 Share Posted May 23, 2013 I am using the Telephone Format Rule to return the word "Tel:" plus the phone number. I only want the tag line "Tel:" to have a horizontal scale of 80%. The actual phone number should not have any scaling applied (100%). When I use the rule below and preview in FusionPro, the entire line is scaled 80% - the word "Tel:" AS WELL AS the phone number. Can't figure out what I am doing wrong. Is this a bug? Using FusionPro 9.0.3, Acrobat X Pro 10.1.7 and Windows 8 Pro. // Rule-Tel1 // Formats Phone Number var formatStyle01 = "$1.$2"; //simple 7 digit phone var formatStyle02 = "$1.$2.$3"; //simple 10 digit phone var formatStyle03 = "$1.$2.$3.$4"; //10 digit phone starts with 1 var formatStyle04 = "$1.$2.$3 ext.$4"; //10 digit phone with extension var formatStyle05 = "$1.$2.$3.$4 ext.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1.$2 ext.$3"; //7 digit phone with extension var thisNumber = Field("Tel1"); if (thisNumber == "") return ""; else return '<magnify type=setwidth factor=80>Tel:</magnify><t>' + formatNumber(Trim(thisNumber)); ////////////////////////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE /////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// function formatNumber(number01) { var pattern01 = /^(\d{3})[^\d]*(\d{4})$/; // 2201727 or 220-1727 or 220- 1727 var pattern02 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; // 8002201727 or 800-220-1727 or (800)220-1727 or (800) 220-1727 var pattern03 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; // 18002201727 or 1-800-220-1727 or +1 (800) 220-1727 var pattern04 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[Xx\.\-\+\*#Nn]\D*(\d+)$/; // 800-220-1727 ext 12345 or (800) 220-1727 ext 12345 var pattern05 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[Xx\.\-\+\*#Nn]\D*(\d+)$/; // 1-800-220-1727 ext 12345 or +1 (800) 220-1727 ext 12345 var pattern06 = /^(\d{3})[\D]*(\d{4})\D*[Xx\.\-\+\*#Nn]\D*(\d+)$/; // 2201727 ext 1234 or 220-1727 ext 1234 or 220- 1727 ext 1234 var patternEndExt = /(.)[Xx\.\-\+\*#Nn](.)/; var patternStart1 = /^[\D]*[1]/; if(number01.match(pattern01)){ number01 = number01.replace(pattern01, formatStyle01); return number01; } else if(number01.match(pattern02)){ number01 = number01.replace(pattern02, formatStyle02); return number01; } else if(number01.match(pattern03)){ if (number01.match(patternStart1)){ number01 = number01.replace(pattern03, formatStyle03); return number01; } else { return number01; } } else if(number01.match(pattern04)){ number01 = number01.replace(pattern04, formatStyle04); return number01; } else if(number01.match(pattern05)){ number01 = number01.replace(pattern05, formatStyle05); return number01; } else if(number01.match(pattern06)){ number01 = number01.replace(pattern06, formatStyle06); return number01; } else { //return "no match any pattern"; return number01; } } Quote Link to comment Share on other sites More sharing options...
esmith Posted May 23, 2013 Share Posted May 23, 2013 I've never used the magnify tag before, but in the guide it mentions this tag is used "to perform copy-fitting on text that is already formatted with tagged-markup that changes character appearances". Not sure if that is part of your problem, but perhaps you could use the setwidth tag instead? Keep in mind that it has no closing tag so you would need to add a second tag to "reset" the width for the number. Quote Link to comment Share on other sites More sharing options...
EricC Posted May 24, 2013 Author Share Posted May 24, 2013 Hi Eric, I tried setwidth and got the same exact result. And even though (as you mentioned) it's not needed, I wrapped the actual phone number around a SECOND <magnify> tag, setting it back to 100%. But that didn't work. I'll try to play around with it some more but I keep looking at my code and it looks correct. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 6, 2013 Share Posted June 6, 2013 This isn't completely clear in the Tags Reference Guide, but the ending </magnify> tag does not revert the magnification settings until the start of the next paragraph. The behavior could be changed, but that's how it's always worked. If you want to temporarily change an attribute of the text, and be able to change it back again before the end of the paragraph, you can use a <span> tag and then an ending </span> tag. Unfortunately, the <span> tag does not give you the ability to modify the setwidth of the text directly like the <magnify> tag does. However, the </span> tag will restore all the attributes of the text back to what was in effect when the initial <span> tag was issued. So, you can use the <magnify> and <span> tags together to achieve the effect you want, like so: return '<span><magnify type=setwidth factor=80>Tel:</magnify></span><t>' + formatNumber(Trim(thisNumber)); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.