jl_arnold Posted May 30, 2017 Posted May 30, 2017 I feel like I have come across a solution for this recently, but I can never reproduce it easily. I have a newsletter template, where there is a title and an informational line below the title can only be one line and the font size is set to 11 points. The catch is that the textbox is aligned vertically in the middle. So if text wraps, the text shifts up a bit. I was able to get the following code to work for the most part, however the issue I still have is that the text size can be reduced to fit the the width, but I'm trying to keep the font size at 11 points. CopyfitLine(Field("Misc Newsletter Info"), "", "Proxima Nova A Medium", 11, 10000, 11, false) I was trying with copy fit because I saw it work recently in another template of mine, but I can't reproduce it to ensure the text stays on only one line and does not wrap. I feel like I'm missing something easy like the "Do not break on Copyfit" checkbox, but that did not seem to do the trick with the one line of text. Thanks! Jason Quote
Dan Korn Posted May 30, 2017 Posted May 30, 2017 (edited) It's not clear to me what you're trying to accomplish. Perhaps a picture of the current output and an explanation of exactly how you want it to be different would be helpful. I was able to get the following code to work for the most part, however the issue I still have is that the text size can be reduced to fit the the width, but I'm trying to keep the font size at 11 points. That sentence is confusing. You first say that the test size can be reduced, but then you say that you want to keep the size fixed at 11 points. Which is it? CopyfitLine(Field("Misc Newsletter Info"), "", "Proxima Nova A Medium", 11, 10000, 11, false) Well, you are only setting the "static" text in the first parameter, and passing an empty string for the "dynamic" text in the second parameter, so that rule as written won't copyfit anything. You also probably want a return statement before all that so that the rule actually returns the result of the call to the CopyfitLine function. (You are actually calling out that rule in your text frame, right?) I was trying with copy fit because I saw it work recently in another template of mine, but I can't reproduce it to ensure the text stays on only one line and does not wrap. I feel like I'm missing something easy like the "Do not break on Copyfit" checkbox, but that did not seem to do the trick with the one line of text. You could turn on copyfitting for the frame and check that box for the paragraph in question. You need to make sure that the paragraph you want is selected when you open the Paragraph Formatting dialog. Edited May 30, 2017 by Dan Korn Quote
jl_arnold Posted May 31, 2017 Author Posted May 31, 2017 Ok, Sorry Dan. I knew a sample would help, but my file is all over the place at the moment because I'm going through to build the definition file with all my variables and rules first, as the template is much more involved than I explained. Attached is both screenshots and the PDF. The screenshot has three text areas numbered 1-3. These represent a line of text that can appear on one of three pages, chosen by the user. As you may see, the width of these text boxes if different. Our Client wants to ensure that the text in all 3 boxes remain at 11 point font with 15 point leading. This text is to stay on one line, in in the middle of the textbox vertically. The textboxes numbered 1 and 3 wrap text. How can I truncated any text that would wrap for multiple text frames that use the same variable/rule (both variable and rule are named the same)? Also, since I copied the text Frame, they are also named the same so I have the copyfit measures set in OnCopyFit. I also tried an OnRecordStart to set the textWrap == false, but I think that's more for wrapping around other frames and graphics. For some reason I thought there was a CopyFitLine or something that did this too. Thanks! Jason219809_POD_NewsletterTemplate_BluePurple TEST FILE.pdf Quote
Dan Korn Posted May 31, 2017 Posted May 31, 2017 Attached is both screenshots and the PDF. Thanks. Although having the collected template, or at least the sample data file, would make it easier to reproduce what you're seeing. Our Client wants to ensure that the text in all 3 boxes remain at 11 point font with 15 point leading. This text is to stay on one line, in in the middle of the textbox vertically. The textboxes numbered 1 and 3 wrap text. So, you don't want text to wrap in any of the frames? How can I truncated any text that would wrap for multiple text frames that use the same variable/rule (both variable and rule are named the same)? Wait, are you saying that you want the text to be truncated? That's not copyfitting; it's the opposite of copyfitting. Just turn off the copyfitting and the text in those frames will be truncated. Also, since I copied the text Frame, they are also named the same so I have the copyfit measures set in OnCopyFit. Well, you're not supposed to have multiple frames with the same name. But you can have the same copyfitting applied to multiple frames with similar names if you want. For instance, you could do something like this in OnRecordStart: if (FusionPro.Composition.CurrentFlow.name.toLowerCase().indexOf("MiscNewsletterInfo".toLowerCase()) >= 0) { // custom copyfitting for "MiscNewsletterInfo" frames } Although, again, if you really want the text in a frame to be truncated, you don't need to do anything in OnCopyfit for it. I also tried an OnRecordStart to set the textWrap == false, but I think that's more for wrapping around other frames and graphics. That's about whether text in other frames will wrap around the frame with that property set. (There's also a control right in the middle of the Frame Properties palette which controls Text Wrap.) For some reason I thought there was a CopyFitLine or something that did this too. No. Like I said, if you want the text to be truncated, that's the opposite of copyfitting. Just turn off the copyfitting for the frame and the text will be truncated. Is that not what you want? Quote
jl_arnold Posted May 31, 2017 Author Posted May 31, 2017 I would like to specify which text frames do not wrap text. I would like all other frames to wrap other than the ones I have named MiscNewsletterInfo, MiscNewsletterInfo2, etc. I have each other text frame's copyfit rules defined in the OnCopyFit rule, as I am defining Font Size and Leading mins and max for each text frame individually. Since I am already setting copyfit setting for each individual frame, I believed I could add some code to ensure that text for the MiscNewsletterInfo frame will always 11 point font, 15 point leading and will not wrap, causing the texts to be shifted from the Vertical Align Center position. The issue I have, even when copyfit is turned off, is that the text frame that is being converted is 32point in height and the text is only 11 points. I am trying to keep to the clients design as closely as possible without manually re-positioning text frames. I would prefer to code this particular text frame to only appear as one line of text at 11 point font. My other option is to determine the exact height and position of the text frame to prevent any tiny shift in the text position that occurs because a new line of text is introduced and tries to shift to align to the top, since the all text is not able to align center vertically. In my screenshot, when the width of the text at 11point exceeds the width of the textbox, you can see the text in frame 1 and 3 become aligned top instead of centered vertically. Does this make more sense? Sorry I have difficulty explaining this.219809_POD_NewsletterTemplate_BluePurple TEST FILE.zip Quote
step Posted May 31, 2017 Posted May 31, 2017 The issue I have, even when copyfit is turned off, is that the text frame that is being converted is 32point in height and the text is only 11 points. I am trying to keep to the clients design as closely as possible without manually re-positioning text frames. I would prefer to code this particular text frame to only appear as one line of text at 11 point font. I don't understand why you wouldn't just adjust the text frames so that they won't wrap. If you always want the text to start at a specific Y-coordinate, what's the point of vertically centering something? You could just vertically align your text frames to the top, reduce the height of the text frame and voila – your text is truncated to one line. My other option is to determine the exact height and position of the text frame to prevent any tiny shift in the text position that occurs because a new line of text is introduced and tries to shift to align to the top, since the all text is not able to align center vertically. Again, I think you're really over-thinking this one. Why stress over coding a solution that could be fixed by making a few tweaks to the text frame. Quote
Dan Korn Posted June 1, 2017 Posted June 1, 2017 In my screenshot, when the width of the text at 11point exceeds the width of the textbox, you can see the text in frame 1 and 3 become aligned top instead of centered vertically. Oh, okay, I think I understand now. You're trying to keep the single line of whatever text fits vertically aligned. The problem is that, if all the text doesn't fit in the frame (flow), then FusionPro puts out whatever text does fit, but top-aligned. This is because, for center and bottom alignment, FusionPro first composes all of the text in the frame, so that it knows how much space is left over. Then it moves the text down by half of that amount for vertical center alignment, or by all of that leftover amount for bottom alignment. But if the text doesn't fit in the first place, then there's no "leftover" space it can use to adjust the vertical alignment. Basically, text not fitting is considered an error, and your requirement that it should be truncated in a particular way is very unusual, and is not something that FusionPro was designed to do. Anyway, I think Step is right: You can just leave the text top-aligned and move the frames to put the text where you want in the output. If you need a border or fill to be in a different place, then just use a separate, empty frame for that. The other thing you could do is just extend out the text frame to be something like 100 inches wide. Any text that's left over will still technically be typeset, but it will be off of the page, so it won't show up in the output. Although the text may appear to "break" in the middle of a word, or even in the middle of a letter. And of course, this will only work for left-aligned text, not center-aligned. And you may need to "mask" some of the frame with a white box or something if you don't want it to go all the way to the edge of the page. Quote
jl_arnold Posted June 1, 2017 Author Posted June 1, 2017 Thanks Guys! This helps clear things up. I feel like I have to say this... But I'm am 100% with you both on this! But it's not always that simple to explain this to clients!!! This particular client has actually take a rule to Proofs we have provided in the past to make sure the output matches the design exactly. They have had me change templates by literal millimeters. The other client related problem is that they would allow users to have many options when creating these templates, but they want to be sure the designs are limited in differences for consistency. This is just one of the sections they have expressed multiple opinions about so I was try to keep all the text frames the sizes they had designed but implementing the design features they have requested. Tough job... Anyway, I'm was going to try Dan's "A better CopyfitLine", http://forums.pti.com/showthread.php?t=84, setting the widthInPoints to 7200, but I'll just go with adjusting the frame size and hope I can convince our client they don't want any changes. Thanks! Jason Quote
Dan Korn Posted June 1, 2017 Posted June 1, 2017 Thanks Guys! This helps clear things up. No problem. The question was confusing, because, again, you're not really trying to do what is normally meant by "copyfitting." I feel like I have to say this... But I'm am 100% with you both on this! But it's not always that simple to explain this to clients!!! This particular client has actually take a rule to Proofs we have provided in the past to make sure the output matches the design exactly. They have had me change templates by literal millimeters. Meeting requirements like that is tricky. But it's better to have overly-specific requirements than vague or incomplete ones. The other client related problem is that they would allow users to have many options when creating these templates, but they want to be sure the designs are limited in differences for consistency. Yes, this is the challenge with variable data. A graphic designer will set things up "just so" and not want you to change anything. But it's variable! So something has to give. Often, the customer has not fully considered the implications. This is just one of the sections they have expressed multiple opinions about so I was try to keep all the text frames the sizes they had designed but implementing the design features they have requested. Tough job... Yep. Anyway, I'm was going to try Dan's "A better CopyfitLine", http://forums.pti.com/showthread.php?t=84, setting the widthInPoints to 7200, I don't think that will help. I know I sound like a broken record, but you're not actually trying to do the kind of copyfitting that that function does. but I'll just go with adjusting the frame size and hope I can convince our client they don't want any changes. Okay. But if they're really that picky, then you're going to have to manually adjust these things anyway, regardless of whether you actually copyfit and vertically align the text or not. Quote
Recommended Posts
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.