NPN Posted October 7, 2010 Posted October 7, 2010 This is for a business card VDP that will be published using Digital Store Front. I have a large international client that has decided if their employees email addresses is too long for the designated line on a business card, a linebreak should be inserted after the '@'. Example, short address: john.doe@idiots.com Example, long address: John.seymor.masterson.doe@ idiots.com This is what they want. Is there a way to implement this using Javascript, say if the characters exceed a value of 30? I'm using Fusion Pro Desktop (I have several versions). Publishing on Digital Store Front
Dan Korn Posted October 7, 2010 Posted October 7, 2010 This looks like another job for Text Measurement: function WrapEmailAtAtSymbol(text, font, pointSize, width) // width and pointSize in hundredths of points { var TM = new FusionProTextMeasure; TM.useTags = false; TM.maxWidth = width; TM.font = font; TM.pointSize = pointSize; TM.CalculateTextExtent(text); if (TM.textLines <= 1) return TaggedTextFromRaw(text); return TaggedTextFromRaw(text).replace(/(.*)(\@)(.+)$/, "$1@<br>$3"); } return WrapEmailAtAtSymbol(Field("email"), "Arial", 1800, FindTextFrame("title").GetSettableTextWidth());Make sure to check "Treat returned strings as tagged text." If you're not using FusionPro 6.0 or newer, you'll have to hard-code the frame width in the last paramater instead of calling FindTextFrame and GetSettableTextWidth.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.