Jump to content

Recommended Posts

Posted

Good morning,

 

I'm working on a business card template and I've run into an issue where the OnCopyFit rule is not working at all. This is causing problems with the Email variable because most users' email addresses will certainly break. In the Variable Text Editor, under the Paragraph menu, "Do not break on copyfit" is selected, yet it keeps breaking. Hyphenation does work, depending on whether or not the option is checked (I need it unchecked, of course).

 

Within the same frame is a rule that returns my "Address" variable as tagged text. I noticed when I removed this rule and just inserted the "Address" variable as is, all text within the frame correctly reduced in size. But without going into detail, it's imperative that the address returns as tagged text.

 

Is there any way to get the OnCopyFit rule and a tagged text rule(s) to coexist in the same variable text frame?

Posted
I'm working on a business card template and I've run into an issue where the OnCopyFit rule is not working at all.

What do you mean by "not working at all?" The size of the text doesn't change? Are there any messages about copyfitting in the composition log (.msg) file? You may need to tweak the values in the MagnifyAttributes object. It's really hard to answer a question like this without having the job to look at.

This is causing problems with the Email variable because most users' email addresses will certainly break. In the Variable Text Editor, under the Paragraph menu, "Do not break on copyfit" is selected, yet it keeps breaking.

Are you sure that the "Do not break" box is checked for the paragraph in question? Those Paragraph Formatting settings don't automatically apply to the entire text flow unless you Select All before clicking the Paragraph button. Also, those paragraph settings can be overridden by <p> tag attributes in tagged markup.

Hyphenation does work, depending on whether or not the option is checked (I need it unchecked, of course).

Okay.

Within the same frame is a rule that returns my "Address" variable as tagged text. I noticed when I removed this rule and just inserted the "Address" variable as is, all text within the frame correctly reduced in size. But without going into detail, it's imperative that the address returns as tagged text.

What tagged text exactly? Are you simply returning the field value? If so, you could just select "Treat field values as tagged text" on the Flat File step of the Data Source Wizard instead. Or are there other tags involved? If so, those could be relevant, but I would need to know what those are.

Is there any way to get the OnCopyFit rule and a tagged text rule(s) to coexist in the same variable text frame?

There's nothing special about tagged text rules that make them not work with copyfitting. (The text in the flow that is being copyfitted is tagged by definition, even if you only type static text into the editor. You can see the tags for the flow in the DIF file. The point is that copyfitting is always working on tagged text.)

 

However, while most tagged text rules should work fine, it can depend on exactly what tags the rule is using. The copyfitting functionality uses <magnify> tags, and if your rule also uses those, or something like a <span> tag which fixes the point size, then the interaction with the <magnify> tags that copyfitting uses can be complex. And <p> tag attributes can override the Paragraph Formatting settings. Also, the minimum and maximum sizes and factors in the MagnifyAttributes may need to be changed for your particular text flow.

 

Again, it's very difficult to answer a question like this in the abstract without seeing the job files. There are way too many possible scenarios to guess at.

Posted
Also, those paragraph settings can be overridden by <p> tag attributes in tagged markup.

 

I think this might solve the problem but I'm not sure where to place the <p> tags within the rule. Here's my rule:

 

return Field("Address");

 

To answer your other questions in case they're still pertinent...

 

What do you mean by "not working at all?" The size of the text doesn't change? Are there any messages about copyfitting in the composition log (.msg) file? You may need to tweak the values in the MagnifyAttributes object. It's really hard to answer a question like this without having the job to look at.

 

None of the text within the text frame is reducing in size. The log does have an error that simply states "OnCopyfit, line 3: warning: Could not copyfit text in flow TextFrame". And yes, I tried tweaking the values, even setting the minimum point size of type to 1. No luck.

 

Are you sure that the "Do not break" box is checked for the paragraph in question? Those Paragraph Formatting settings don't automatically apply to the entire text flow unless you Select All before clicking the Paragraph button.

 

Yes, positive. I have varying leading values so I pretty much have to make line-by-line adjustments anyway.

 

What tagged text exactly? Are you simply returning the field value? If so, you could just select "Treat field values as tagged text" on the Flat File step of the Data Source Wizard instead. Or are there other tags involved? If so, those could be relevant, but I would need to know what those are.

 

I only have one tagged text variable, the Address. Using UI rules in MarcomCentral, the address automatically changes depending on which 1 of 23 properties the user selects. Rather than having to create individual UI rules for the street, city, state and zip, I have one "Address" variable with a <br> tag to split the street and city/state/zip onto separate lines.

 

The rule I created (at top) simply returns that variable but treated as tagged text, so the <br> tag is recognized.

 

- - -

 

I think your suggestion for placing <p> tags will work. I tried it and the type within the frame did correctly reduce. However, the Address didn't display, only the Address variable name displayed. I think that's just because I'm not sure where to place the <p> tags. If that doesn't fix it though, I'll gladly upload the template.

Posted
Here's my rule:

return Field("Address");

That's pretty simple. What happens if, instead of using that rule, you check the "Treat field values as tagged text" box on the Flat File step of the Data Source Wizard and just use the field value directly?

None of the text within the text frame is reducing in size. The log does have an error that simply states "OnCopyfit, line 3: warning: Could not copyfit text in flow TextFrame". And yes, I tried tweaking the values, even setting the minimum point size of type to 1. No luck.

There's a minimum magnification factor as well. That's the second parameter.

 

The default OnCopyfit rule should probably be like so, to clarify those parameters:

var MA = new MagnifyAttributes;
MA.type = "text";
MA.factormin = 25; // percent
MA.factormax = 400; // percent
MA.min = 6; // points
MA.max = 72; // points

if (!Copyfit(MA))
   ReportWarning("Could not copyfit text in flow " + 
                 FusionPro.Composition.CurrentFlow.name);

I only have one tagged text variable, the Address. Using UI rules in MarcomCentral, the address automatically changes depending on which 1 of 23 properties the user selects. Rather than having to create individual UI rules for the street, city, state and zip, I have one "Address" variable with a <br> tag to split the street and city/state/zip onto separate lines.

 

The rule I created (at top) simply returns that variable but treated as tagged text, so the <br> tag is recognized.

Okay, wait a minute. You didn't mention MarcomCentral before. So is the rule working in Acrobat but not when uploaded to Marcom, or vice versa, or neither?

 

One thing about MarcomCentral is that it generates tagged markup data, whereas jobs are usually set up with flat file data in Acrobat (in FP Desktop/Creator). So you need to account for that difference. You seem to sort of be doing that by using a rule which returns tagged markup. But in MarcomCentral, the field value is already tagged markup, so your rule is simply escaping those markup tags with more markup. And presumably, the data you're testing with locally is not tagged. Or at least I'm guessing it's not; you're not giving me many specifics to go on here.

 

What you need is a rule that handles both flat file and tagged markup data properly. The best way to do this is with the TaggedDataField function. What happens if you change the rule like so?

return TaggedDataField("Address");

Although, again, I'm kind of guessing here based on the bits of information I'm working with.

I think your suggestion for placing <p> tags will work. I tried it and the type within the frame did correctly reduce. However, the Address didn't display, only the Address variable name displayed. I think that's just because I'm not sure where to place the <p> tags.

I don't think I actually suggested using <p> tags. At least I didn't intend to. I was simply pointing out some tags that might affect copyfitting.

If that doesn't fix it though, I'll gladly upload the template.

That would be worth a few thousand words.

Posted
That's pretty simple. What happens if, instead of using that rule, you check the "Treat field values as tagged text" box on the Flat File step of the Data Source Wizard and just use the field value directly?

 

Just gave this a try but the same problem occurred.

 

Okay, wait a minute. You didn't mention MarcomCentral before. So is the rule working in Acrobat but not when uploaded to Marcom, or vice versa, or neither?

 

The outcome is the same both in Acrobat and in Marcom. I also uploaded the template to Marcom after trying the above suggestion, but same thing occurred.

 

One thing about MarcomCentral is that it generates tagged markup data, whereas jobs are usually set up with flat file data in Acrobat (in FP Desktop/Creator). So you need to account for that difference. You seem to sort of be doing that by using a rule which returns tagged markup. But in MarcomCentral, the field value is already tagged markup, so your rule is simply escaping those markup tags with more markup. And presumably, the data you're testing with locally is not tagged. Or at least I'm guessing it's not; you're not giving me many specifics to go on here.

 

What you need is a rule that handles both flat file and tagged markup data properly. The best way to do this is with the TaggedDataField function. What happens if you change the rule like so?

return TaggedDataField("Address");

Although, again, I'm kind of guessing here based on the bits of information I'm working with.

 

Tried it, same problem.

 

I'm sure there's something I'm missing somewhere, so I'm attaching the template.

Ross_SiteBC_FPTemplate.zip

Posted (edited)
I'm sure there's something I'm missing somewhere, so I'm attaching the template.

Thanks, but I'm not seeing the problem. When I open up your template, it says I'm missing various Minion fonts. When I compose or preview, the text all fits in the frame for all three records. I get some copyfit warnings, but the text seems to fit in the frame. I also get errors about missing variables "RULE_Phone_Format" and "RULE_Name_AllCaps". So perhaps the template you uploaded is not complete? It seems that I'm certainly missing something; whether you are as well is hard to tell from this template. :confused:

 

Anyway, going back to your original post, when you say that, "the OnCopyFit rule is not working at all," are you sure that the text isn't just all fitting in the frame without having to be copyfitted? That's a perfectly valid way for copyfit to work. In other words, if the text already fits, then copyfit doesn't do anything.

 

At any rate, I don't see anything in FusionPro not working correctly from the template you uploaded. But without the fonts (though please don't post them here), and with rules apparently missing, it's hard to tell if I'm seeing the same thing you are.

 

Can you reproduce the problem in a simpler job, which uses standard fonts and doesn't have missing rule errors?

Edited by Dan Korn
I do see copyfit warnings.
Posted

..............Okay? Not sure why "RULE_Phone_Format" and "RULE_Name_AllCaps" would be missing since both are being used and display correctly, at least on my end. I've removed 2 of the records and included just the one that has the issue with the email address clipping. I've also changed the fonts to Helvetica, so hopefully there's no font issues.

 

I've also included 2 screenshots so you can see what I'm seeing. In ScreenShot_1, I'm using the tagged text rule (RULE_Address_TaggedText) in place of the address variable. As a result, you can see where the email address -- cstackhouse@mm4solutions.com -- is broken into two lines, while the address also breaks, which it is supposed to do. However, the OnCopyFit rule doesn't successfully reduce the text inside the frame, where ideally it would so the email address doesn't break.

 

In ScreenShot_2 I've removed the tagged text rule and instead just inserted the Address variable. In this instance, you can see where the address does not break (as evidenced by the visible <br> tag) but the OnCopyFit rule does reduce all the text within the frame. The reduction is of course exaggerated due to the address not breaking.

 

It's probably worth noting too that the "RULE_Phone_Format" and "RULE_Name_AllCaps" rules are working in the screenshots, as the name is returned in all caps, and the phone number is formatted with spaces, in lieu of periods, dashes or parentheses.

TEST_Template.zip

ScreenShot_1.jpg.fb06a30e3607be98c7cf69151cd8657b.jpg

ScreenShot_2.jpg.3bd2d28376b8a7711feb7a674c95b9b4.jpg

Posted

Sorry, there was a problem in the development build of FusionPro I'm running that made some of the XML Template rules not show up for me. (Such is the peril of doing development, i.e. modifying the source code of FusionPro, and working on templates at the same time.) Thanks for the updated template; with that, and with fixing the problem on my end, I now see what you're seeing.

 

And yes, I see what you're saying now. It's not that the copyfitting isn't making the entire text fit in the frame. It's that you're trying to stop the email address from breaking to two lines, and the lines in the address as well.

 

This isn't really a problem with tagged text per se. It's an issue of the difference between the <br> tag and the <p> tag. The <br> tag is a "soft return," which breaks the line, but doesn't actually start a new paragraph like the "hard return" <p> tag does.

 

The thing to remember here is that the settings in the Paragraph Formatting dialog apply to the entire paragraph. So if you have, say, space before or after the paragraph set, and you use a <br> tag, or if you type Shift+Return (Shift+Enter) in the Text Editor, that breaks the line, but not the paragraph, so inter-paragraph spacing isn't applied.

 

It's the same for the "Do not break on copyfit" setting. This literally means, try to keep the entire paragraph on one line.

 

So you can see what's going wrong. The entire paragraph can't be kept on a single line because it has a line break in it. This causes the copyfitting operation to fail.

 

The fact that <p> tags work with "Do not break on copyfit" but <br> tags don't is a subtlety, to be sure, and arguably FusionPro should at least emit a more specific error message in this case, if not allow the copyfitting to continue regardless of failing to meet the fitting requirements for one paragraph. However, this is also very much an edge case, that is, an interaction between several features in a huge matrix of features and interactions (in the typesetter alone). And, considering that I didn't know about it until now, it seems to be an edge case that not too many folks have stumbled upon before.

 

Anyway, the solution is pretty simple:

return ReplaceSubstring(Field("Address"), "<br>", "<p>");

Or, using Regular Expressions:

return Field("Address").replace(/<br>/g, "<p>");

The <p> tag by itself inherits the running style of the previous paragraph, so it automatically has the "Do not break on copyfit" setting applied. Although you could modify any paragraph settings with attributes of the <p> tag if you wanted to (including the "noparabreakoncopyfit" attribute). So I guess I really was telling you to use <p> tags after all! :p

 

Or, you could use the CopyfitLine and CopyfitEmail functions to adjust individual lines instead of copyfitting the entire text flow, although I realize that won't keep all the text the same size.

 

Sorry again for the confusion in my previous post.

Posted
Anyway, the solution is pretty simple:

return ReplaceSubstring(Field("Address"), "<br>", "<p>");

Or, using Regular Expressions:

return Field("Address").replace(/<br>/g, "<p>");

 

Problem solved! I tried both codes and both worked. Thanks a lot for your assistance!

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...