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
  #1  
Old January 28th, 2020, 01:43 PM
AFitz AFitz is offline
Forum n00b
 
Join Date: Jan 2020
Location: Rock Island, IL
Posts: 3
Default OnCopyFit Rule Exceptions

I've found some threads about handling different situations with OnCopyFit rules (controlling font size, keeping on one line, etc.); however, I'm looking to incorporate a couple of these exceptions into my rule.

I have a resizable ad with several variable frames. While my Headline frame can expand to fill up to 36 point size, I don't want the AgentInfo frame (aka Contact Information) to exceed 12 pt. But, I need the actual AgentInfo frame to be large enough to accommodate multiple fields, while some users may only use a few fields. I also want to keep the text that is intended to be on one line, to be on just one line. For example, the company name is the first line (actually typed into the text frame, not pulling from a rule or field), and I want the whole company name to be on one line and not wrap. What do I need to add to the OnCopyFit rule to do this? Below is my current rule:

if (!Copyfit(new MagnifyAttributes("text", 25, 200, 8, 36)))
ReportWarning("Could not copyfit text in flow " +
FusionPro.Composition.CurrentFlow.name);

Please and thank you!!!
Reply With Quote
  #2  
Old January 29th, 2020, 11:50 AM
AFitz AFitz is offline
Forum n00b
 
Join Date: Jan 2020
Location: Rock Island, IL
Posts: 3
Default Re: OnCopyFit Rule Exceptions

I actually fixed this by making the base font size of the AgentInfo 12pt (the largest point size I'd except) int the text editor window, and deselected the "Expand to fill" checkbox in the Overflow option. And, for the company name to fit on one line, I created a new CopyfitLine Text rule, from one I found somewhere on this forum. Then inserted this rule in the text frame's text editor with the other fields and rules for that text frame.

var lineText = "CompanyName";
var initialFont = "Myriad Pro Cond";
var initialPointSize = 12;

if (FusionPro.inValidation)
return lineText;

var content = '<f name="' + initialFont + '"><z newsize="' + initialPointSize + '">' + lineText;
var frameWidth = FusionPro.Composition.CurrentFlow.GetFrame().GetSe ttableTextWidth();
return CopyfitLineWithMagnifyTag(content, frameWidth);

function CopyfitLineWithMagnifyTag(line, width, AllowToExpand)
{
var tm = new FusionProTextMeasure;
tm.CalculateTextExtent(line);
if (tm.messages)
ReportError("CopyfitMagnifyLine: " + tm.messages);

if (tm.textWidth < width && !AllowToExpand)
return line;

var factor = Round(width / tm.textWidth * 100, 0) - 1;
return "<magnify type=text factor=" + factor + ">" + line + "</magnify>";
}

If you would have done anything different, please let me know. I could definitely see me needing to manipulate some Copyfit rules in some of my upcoming products.
Reply With Quote
  #3  
Old January 29th, 2020, 07:19 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,442
Default Re: OnCopyFit Rule Exceptions

It's hard to offer specific suggestions for what sounds like a somewhat complex scenario without seeing the job. That said, a couple general suggestions: First, there is a "Do not break on copyfit" setting in the Paragraph Formatting dialog, which should acconplish "I want the whole company name to be on one line and not wrap." Also, you may be able to break up the content into separate frames, or possibly use a repeatable component, to control how different parts of it are sized. Again, though, it's hard to say without seeing the job.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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
  #4  
Old January 30th, 2020, 01:06 PM
AFitz AFitz is offline
Forum n00b
 
Join Date: Jan 2020
Location: Rock Island, IL
Posts: 3
Default Re: OnCopyFit Rule Exceptions

Thank you for the response! Yes, it is a complex product and hard to explain without showing, but your explanation made sense to me. I thought I had tried the "Do not break on copyfit" in one of my attempts and it didn't work, but now I took out the rule and applied the checkbox to just that text and it worked. Oh well...

I was reading it as "Do not break OnCopyFit" like the rule, but I see now it says "Do not break on (space) copyfit" - totally different meaning!

I'll come back to this post if I find the scenario where I felt that option wasn't working. Thank you for your time!!
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 04:28 AM.


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