Go Back   MarcomCentral (PTI) and FusionPro User Communities > Support > Fonts


Thread Tools Search this Thread Display Modes
Old November 3rd, 2016, 07:54 AM
jmerrick0657 jmerrick0657 is offline
Junior Community Member
Join Date: Nov 2013
Posts: 36
Default Trouble with copyfitting a particular font

I'm having trouble copyfitting a certain font. I'm using this code:

var StaticPart = ""; //This text will not copyfit.
var DynamicPart = '<tracking newsize="4.5"><b>' + Rule("DetermineFrontEmail") + '</b>'; //This text will copyfit.
var TextFont = "Akzidenz-Grotesk BQ Condensed A";
var FontSize = 8;
var TextFrameName = "ContactBoxFront"; //For width calculation
var MinFontSize = 4;
var AdjustWidthOnly = false;

if (Field("Email") == "" || Left(Field("Email"), 1) == "@")

return "";

else return CopyfitLine(StaticPart,DynamicPart,TextFont,FontSi ze, FindTextFrame(TextFrameName).GetSettableTextWidth( )/100, MinFontSize, AdjustWidthOnly);

Which generates a font size smaller than 8, but not small enough to fit on one line:

<f name="Akzidenz-Grotesk BQ Condensed A"><z newsize=8><z newsize=7.0000000000000036><tracking newsize="4.5"><b>jmerricklongname@access-genetics.com</b>

The funny thing is, if I change the font it works fine; it seems to be just with this one font. The font is a bold font; I tried it without the <b> tags and got an error that normal style was not loaded, using bold style instead.
Reply With Quote
Old November 3rd, 2016, 03:38 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,483
Default Re: Trouble with copyfitting a particular font

Well, it's hard to say without the job, especially the font, the data, and the other "DetermineFrontEmail" rule that is being called. But I can make a few guesses.

It could be that the email address has a "special" character in it. You probably want a call to TaggedTextFromRaw in there, like so:
var DynamicPart = '<tracking newsize="4.5"><b>' + TaggedTextFromRaw(Rule("DetermineFrontEmail")) + '</b>'; //This text will copyfit.
It could also be that the tracking is confusing the copyfitting somehow.

But the most likely issue is that the granularity of the CopyfitLine function is limited, especially at smaller starting point sizes. I think it would be better to use a variation of the CopyfitLineWithMagnifyTag function, which is here:

Specifically, replace the last line of your rule with this:
var line = "<f name=\"" + TextFont + "\"><z newsize=" + FontSize + ">" + DynamicPart;
return CopyfitLineWithMagnifyTag(line, FindTextFrame(TextFrameName).GetSettableTextWidth( )/100, false);

  function CopyfitLineWithMagnifyTag(line, widthInPoints, AllowToExpand)
    var tm = new FusionProTextMeasure;
    if (tm.messages)
      if (FusionPro.inValidation)
        ThrowError("CopyfitMagnifyLine", tm.messages);
        Print("CopyfitMagnifyLine: " + tm.messages);
    if (tm.textWidth < widthInPoints*100 && !AllowToExpand)
      return line;
    var factor = Round(widthInPoints / tm.textWidth * 10000, 0) - 1;
    return "<magnify type=pointsize factor=" + factor + ">" +
            line + "</magnify>";
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Old November 4th, 2016, 07:24 AM
jmerrick0657 jmerrick0657 is offline
Junior Community Member
Join Date: Nov 2013
Posts: 36
Default Re: Trouble with copyfitting a particular font

Thanks for the response. I got it to work, but I'm not really sure why. I took my original rule and duplicated it to try your suggestions. Before I actually changed it I put the rule in a text box along with the original, and one of them worked while the other one didn't (even though they were exactly the same rule, producing exactly the same output). I then deleted the rule that wasn't working, and that caused the other rule to stop working as well. I then duplicated the rule that wasn't working, which caused one of them to start working. I'm not sure what is going on.
So I checked the box "Re-evaluate this rule for every text flow" and that fixed it. I'm not sure why that would have fixed it, but it did.

Jake Merrick
Reply With Quote

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 07:42 AM.

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