Jump to content

Copyfit with Multi Styled Fonts


DSweet

Recommended Posts

Hello,

 

I have a project in which the customer wants to have two variables copy fit into one box. I thougt "O.K. I'll just concatenate the two together and use a copyFitLine function on the result." Then I got a monkey wrench thrown in the works. The customer wants the two variables to have different fonts and different styles for each of the variables. Variable1 is to start at 11 point Avenir Light, and Variable2 is to start at 13 point Avenir Heavy Italic. The whole thing is to fit in a frame that is 160 points in width.

 

The font set that I have can do the "Avenir Light" (Avenir 45 on my machine) as a separate font, but the Avenir Heavy font is actually a bolded version of "Avenir Roman" (Avenir 55 with a <b> tag added in front on my machine).

 

I might be able to convince the customer to go with the Avenir Roman font instead of the Avenir Light, but I'm certain that he will want the second variable to be bolded. How can I add the two variables together and use the bold feature on just one of the variables within a copyFit function?

.

Link to comment
Share on other sites

Unless i am misunderstanding, wouldn't you just capture the length of variable 1 and add the new font attribute after the last character of variable 1 or before the start of variable 2? I am assuming you could do an add assignment operator to both variables?
Link to comment
Share on other sites

I understand how to connect two variables together and how to assign different font and point size attrubites to each. My problem is that when you have two different styles of fonts (Heavy and Roman) you can't just add the two variables together at ask FusionPro copyFit function to size it within a given space. FusionPro doesn't quite work like that -- as far as I know. Try typing the name "Christian Johnson" in Avenir Roman, then type the same name in Avenir Heavy or Black and you'll easily notice that the "Black" version is much wider than the "Roman" version. So the function might return a different value if it were to try and fit the Heavy or Black version in the same text box width as the Roman or Light version would.

 

Unless you have the actual font recognized by FusionPro you cannot assign a "<b>" bolded tag within the copyFit function -- again as far as I understand FusionPro. I need to assign a Heavy AND a Roman font style to the variables and assign that to a copyFit function.

.

Link to comment
Share on other sites

The font set that I have can do the "Avenir Light" (Avenir 45 on my machine) as a separate font, but the Avenir Heavy font is actually a bolded version of "Avenir Roman" (Avenir 55 with a <b> tag added in front on my machine).

 

I might be able to convince the customer to go with the Avenir Roman font instead of the Avenir Light, but I'm certain that he will want the second variable to be bolded. How can I add the two variables together and use the bold feature on just one of the variables within a copyFit function?

I think you need to look into getting the right fonts instead of using the bold tag on an incorrect font. In my experience, the copyfit in FP works fine, even with multiple fonts, as long as you are using the actual fonts instead of tags to modify them. It sounds like you need to acquire Avenir 85 (Avenir Heavy).

Link to comment
Share on other sites

I have Avenir 85 Heavy loaded on my machine. I've coded it through InDesign and Quark and chose the font Avenir 85 Heavy. However it appears that FusionPro only recognizes it as Avenir 55 Roman with the bold tag added.

 

You mentioned that you have been able to use the copyFit function with more than one font coded. In the function code...

 

CopyfitLine("",Field("TeamName") + ": " + Field("Rink"), "Avenir 55 Roman", 12, 130, 8, t);

 

...where would you assign the value of Avenir Heavy font to only the Field("Rink") variable and leave the TeamName as Avenir Roman? Also, how would you code the two variables with different font size values?

.

Link to comment
Share on other sites

You mentioned that you have been able to use the copyFit function with more than one font coded.

Man, did I just tell a -faced lie with the bold tag added (get it? bold-faced? yeah, I know, bad joke)? I guess I wasn't specific enough in my response. I meant to say I am able to use multiple fonts in copyfitting when using the OnCopyFit callback rule. Sorry for the confusion DSweet. If I have some time this afternoon, I'll try to recreate your example and see how it works for me using our Avenir fonts. :)

Link to comment
Share on other sites

Dan,

 

Thanks for the showing a post with a different possibility for a CopyFitLine function. But even in that function I don't see where you can add style attributes or multiple fonts to it. In your function you only passed one variable and one "unstylized" font. Even with only using unstylized fonts (no bold. italics, etc...), how would you be able to copyfit a specific line of text that contains two vastly different sized fonts? For example ArialNarrow and Impact.

.

Link to comment
Share on other sites

Thanks for the showing a post with a different possibility for a CopyFitLine function. But even in that function I don't see where you can add style attributes or multiple fonts to it. In your function you only passed one variable and one "unstylized" font. Even with only using unstylized fonts (no bold. italics, etc...), how would you be able to copyfit a specific line of text that contains two vastly different sized fonts? For example ArialNarrow and Impact.

.

Yes, the example in that thread only shows one <f> and <z> tag, but you can use more. For example:

return CopyfitLineWithMagnifyTag(
       '<f name="ArialNarrow">' + Field("Field1") +
       '<f name="Impact">' + Field("Field2"), 360);

You can use any tagging that you would use anywhere else, including multiple font and pointsize changes. The function simply uses <magnify> tags which apply to the entire range of the text.

Link to comment
Share on other sites

Is there a way of putting a <b> or <i> tags in this function?

\

return CopyfitLineWithMagnifyTag(
       '<f name="ArialNarrow"><b>' + Field("Field1") +
       '<f name="Impact">' + Field("Field2"), 360);

 

????

\

Link to comment
Share on other sites

Is there a way of putting a <b> or <i> tags in this function?

\

return CopyfitLineWithMagnifyTag(
       '<f name="ArialNarrow"><b>' + Field("Field1") +
       '<f name="Impact">' + Field("Field2"), 360);

????

\

Yes. Just like what you have there. Although you may need to add an ending </b> tag to turn off bold if you only want it on that one field.

 

Again, you can use any tagging that you would use anywhere else, including multiple font and point size changes, bold, italics, ANYTHING*. Try it and see!

 

* Okay, maybe not anything; you can't bring in a reusable component, or another rule which is already doing magnification, or anything like that. But any kind of basic character formatting will work fine.

Link to comment
Share on other sites

  • 3 weeks later...

Dan,

 

Thanks for your insight on this. I've tried this function and it works to a limited degree. If I don't include a point size in the format it doesn't shrink anything and just repeats the formatting that I give it. If I do include a "z" format instruction for a type size then the point size becomes static and the only reduction that it done is to narrow the width enough to make it fit. If the variable element that is to be formatted is large enough then the width reduction starts to make the lettering appear as sticks instead of letters -- somewhere around 40% or so.

 

Is there a way to program this function for the width reduction to stop at a specified percentage point (say 75-80%) and then reduce the "z" point size setting by .5 or 1 and start the width process fitting again at 100%?

 

I really think that this would be a much more effective, useable and a user-friendly copyfitting function than anything that is currently programmed or even speculated at in FusionPro.

 

Thanks

.

Link to comment
Share on other sites

Thanks for your insight on this. I've tried this function and it works to a limited degree. If I don't include a point size in the format it doesn't shrink anything and just repeats the formatting that I give it. If I do include a "z" format instruction for a type size then the point size becomes static and the only reduction that it done is to narrow the width enough to make it fit. If the variable element that is to be formatted is large enough then the width reduction starts to make the lettering appear as sticks instead of letters -- somewhere around 40% or so..

Sorry, I'm having trouble following this in the abstract. Can you post a sample job which shows what you're describing?

Is there a way to program this function for the width reduction to stop at a specified percentage point (say 75-80%) and then reduce the "z" point size setting by .5 or 1 and start the width process fitting again at 100%?

Well, the particular CopyfitLineWithMagnifyTag function that we've been talking about here doesn't really do that; in fact, unlike the CopyfitLine function, it doesn't do any sort of iteration at all, so there's no place to "stop" and do something else.

 

That said, it's certainly possible to write a variation of the CopyfitLine function to do whatever you want. Basically, it's just calling FusionProTextMeasure.CalculateTextExtent() in a loop and modifying the text until it fits into the specified space. You could roll your own version that does whatever kind of modification to the tags which control the size of the text that you want.

I really think that this would be a much more effective, useable and a user-friendly copyfitting function than anything that is currently programmed or even speculated at in FusionPro.

Well, I wouldn't say that it's never been speculated about. (As Han Solo said, "I don't know, I can imagine quite a bit.") In fact, many variations on copyfitting have been implemented by and for various customers to fit highly specific needs, based on the basic "iterate and measure" algorithm in CopyfitLine.

 

However, I'm not sure how one general function could possibly be written to take parameters to do any imaginable kind of copyfitting logic while still being "useable and user-friendly." Your requirements (tell "the width reduction to stop at a specified percentage point [say 75-80%] and then reduce the 'z' point size setting by .5 or 1 and start the width process fitting again at 100%") are very specific, but there are a lot of other subtle variations that other users may need for particular jobs. What if you wanted to, say, reduce the point size up to a certain minimum, then reduce the tracking, and then reduce the leading, or some other combination? I don't know how to have one function that would be able to to do all of that without the parameters being terribly complicated and confusing. Likewise, a GUI which tried to present all the possible options would be an even bigger mess.

 

I think in the long run it's better to provide lower-level tools which allow people to build higher-level algorithms which allow them to do whatever specific, complicated things they want to do. That's what the text measurement functionality is for. To some extent, that's what FusionPro is.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...