Jump to content

Widows


ijanovick

Recommended Posts

I have a variable text box that is attached to a csv file. Every record of text is a different length and I am having a problem with widows on the last line of text. Does anyone know how to get rid of this? If I go into my text editor there is a "widow" feature in paragraph formatting, but no matter what number I plug in, it doesn't change anything. I have talked to support about this and they said that the "widow" feature does not apply if my text is coming from a csv file. Why have a feature that doesn't work for variable data? Isn't that the point of the software? Or maybe I am just doing it completely wrong? Any help would be greatfull, thank you.

 

Isabella Janovick

Link to comment
Share on other sites

Hello Isabella,

 

The Widows feature in FusionPro is for controlling the number of lines of text that are to be kept together in a given frame. This feature applies to when you are using text overflow.

 

Here's an example. Suppose you have 2 frames that are connected (so text can overflow from frame 1 to frame 2). In the first frame, you specify a multi-line flow of text. You set Widows to 3.

 

Now you preview this job and you see that frame 1 has 4 lines of text from your text flow (until there is no more room in frame 1) and then the rest of your text overflows to frame 2.

 

Next, you go back into your frame 1 with Edit Text and set the Widows to 5.

 

When you preview the job now, you see that NO text appears in frame 1 and it all has been overflown to frame 2. FusionPro basically said "I was asked to keep 5 lines of text together at a minimum for this flow and there was not enough room to do that in frame 1. Therefore, I overflowed all the text to frame 2".

 

This all being said on how widows function in FusionPro, I'm not sure this is the capability you are looking for.

 

When you say that are "...having a problem with widows on the last line of text.", are you referring to:

 

1) That last line of text overflowing to another frame when you don't want it to?

 

2) Your last line of text in the paragraph has too few words in it for your liking (maybe you want to make sure there are no fewer than 3 words on the last line)?

 

Or perhaps it's something else?

 

Thanks, Isabella

Link to comment
Share on other sites

Thank you for the explanation, that helps. And yes, #2, the last line of text in the paragraph has too few words for my liking, which is one (a widow) . I just want it to have a minimum of two words. Is that possible? Thanks again for your help.

 

Isabella

Link to comment
Share on other sites

Isabella,

 

We do not have a feature for this capability but there is likely something that can be done with a rule.

 

When you reach this condition, where the last line in your flow of text is only 1 word, what would you like to do? Perhaps shrink the text (decrease pointsize) of the text in that flow until the last line of text in the paragraph has more than 1 word in it? (meaning the single word on last line would become the last word of the line above).

 

Or was there something else you would like to see happen to the text when this condition occurs?

 

Fair warning that this type of logic might be some moderately complex custom copyfit logic in JavaScript...

Link to comment
Share on other sites

  • 6 months later...

Hi Mark,

 

I found this post and there wasn't an answer, and one of my questions matches the question in the post. I acually have 2 questions, if #1 can be answered, then #2 doesn't won't matter. I'll attach a pdf for clarity.

 

1) When I enter a hard return to bring a word down onto another line I get a < p > instead of a return. I an using hard returns elsewhere in my template and they work fine. I'm assuming it has to do with having the "treat returned strings as tagged text on" for the rule. If there's a way around this, I'm interested.

 

Here's my rule

 

[font=Arial]var text =  Field("QuoteCopy2")[/font]
[font=Arial]var text2 = Field("Quotedby2")[/font]

[font=Arial]return '<p findent=0 lindent=1930 rindent=1550 tabstops="0;1550,Left;"><f name="Berkeley Book"><z newsize=45><subscript>&ldquor;</subscript><f name=BerkeOldStyItcTMed><z newsize="11.5"><leading newsize="160"><tracking newsize="-1">' + [/font]
[font=Arial]       NormalizeEntities(text) +[/font]
[font=Arial]       '<p quad=R rindent=0 leading=1><f name="Berkeley Book"><z newsize=45></tracking><subscript>&rdquor;</subscript>' + [/font]
[font=Arial]       '<p quad=R rindent=1550 leading=160><f name="Frutiger 55 Roman"><z newsize=10>' + NormalizeEntities(text2);[/font]

 

2) I do not want a widow on the last line of the quote. There needs to be 2 words minimum. I do not want to copyfit the line (by bringing the widow up to make 1 line). I would want the last word from the previous line brought down.

 

Any help would be appreciated

linebreak.pdf

Link to comment
Share on other sites

  • 10 months later...
Thank you for the explanation, that helps. And yes, #2, the last line of text in the paragraph has too few words for my liking, which is one (a widow) . I just want it to have a minimum of two words. Is that possible? Thanks again for your help.

This isn't what FusionPro means by a "widow." FusionPro's definition of a "widow" is a line or two of text flowed from a previous column or frame, not a word or two that happens to be the last line of a paragraph in a single frame.

 

However, you can use this code to prevent the last word from being on a line by itself:

  return TaggedTextFromRaw(Field("YOUR FIELD NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3");

And you need to check the "Treat returned strings as tagged text" box.

Edited by Dan Korn
Link to comment
Share on other sites

  • 5 years later...
This isn't what FusionPro means by a "widow." FusionPro's definition of a "widow" is a line or two of text flowed from a previous column or frame, not a word or two that happens to be the last line of a paragraph in a single frame.

 

However, you can use this code to prevent the last word from being on a line by itself:

  return TaggedTextFromRaw(Field("YOUR FIELD NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3");

And you need to check the "Treat returned strings as tagged text" box.

 

Is there anyway to use this code, but still have carriage returns work in multi-line inputs?

Link to comment
Share on other sites

Is there anyway to use this code, but still have carriage returns work in multi-line inputs?

I don't understand the question. To exactly what "multi-line input" are you referring? Some kind of web form entry, in MarcomCentral or another web app?

 

Do you have an example of something that's not working the way you expect?

Link to comment
Share on other sites

Sorry, I should have been more specific. I am using the "widow rule" in the post above to prevent single words on the last line of a multi-line input in a Web DataCollect template.

 

However, when a carriage return is entered in the field on the template the carriage returns show as "<br>".

 

I hope that makes sense, I apologize, I'm rather new to coding as well as Fusion Pro.

 

Thanks.

Link to comment
Share on other sites

Sorry, I should have been more specific. I am using the "widow rule" in the post above to prevent single words on the last line of a multi-line input in a Web DataCollect template.

...in a Web DataCollect template where the web form is being filled out by an end user in...what web application exactly? EFI Digital StoreFront (DSF)? A custom app? Something else?

However, when a carriage return is entered in the field on the template the carriage returns show as "<br>".

The rule assumes that the data field does NOT already contain markup tags. If you want it to handle both flat-file data without tags (such as what's typically in a tab-delimited or CSV file used at design time in FP Creator) and with tagged markup data (such as what's being returned from your WebCollect form, presumably from DSF or some other web application which you have still not specified, for an FP Server composition), then you can use the TaggedDataField function, like so:

return TaggedDataField("YOUR FIELD NAME").replace(/(.*)(\s)(.+)$/, "$1 $3");

This may not be foolproof, however, as the rule will replace the last space in the the entire tagged markup data field value. That last space is probably an actual space in the text, but it could be a space that's part of a markup tag, such as the space before an attribute.

Link to comment
Share on other sites

  • 11 months later...

Is there a way to expand upon this code so that if it recognizes a widow and the preceding "word" prior to the last word in the paragraph is an ampersand symbol that it will break the line starting with the word before the ampersand?

 

For example, when using the code below,

"Test Event Name Title & Location" currently breaks as:

 

"Test Event Name Title

& Location"

 

Would like to to break as:

"Test Event Name

Title & Location"

 

 return TaggedTextFromRaw(Field("YOUR FIELD NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3");

Link to comment
Share on other sites

Is there a way to expand upon this code so that if it recognizes a widow and the preceding "word" prior to the last word in the paragraph is an ampersand symbol that it will break the line starting with the word before the ampersand?

 

For example, when using the code below,

"Test Event Name Title & Location" currently breaks as:

 

"Test Event Name Title

& Location"

 

Would like to to break as:

"Test Event Name

Title & Location"

 

Sure. The problem is that TaggedTextFromRaw converts both the ampersand and the space following it, to & and &#32; respectively, so your original field value becomes:

Test Event Name Title &&#32;Location

(If TaggedTextFromRaw didn't convert the space after the & to an entity, then that space would be dropped by the tagged markup parser and you would get "&Location", without a space after the ampersand, in the output.)

 

Then when you do the replace to change the last actual space character to   you get this:

Test Event Name Title &&#32;Location

And the non-breaking space is in the wrong place, between the word Title and the ampersand.

 

So the solution is to look for that &#32; entity before the last word, and replace it with a non-breaking space entity as well:

return TaggedDataField("YOUR FIELD NAME").replace(/(.*)(&[size="2"]#[/size]32;)(\S+)$/, "$1 $3").replace(/(.*)(\s)(.+)$/, "$1 $3");

The result of this is:

Test Event Name Title & Location

So now the word Title, the ampersand, and the word Location will all be kept together with non-breaking spaces.

Edited by Dan Korn
added result
Link to comment
Share on other sites

  • 2 years later...

Goodness, haven't looked at this one in years but it's come back to haunt me...

 

When using the rule in it's original form:

 

<code>return TaggedTextFromRaw(Field("YOUR FIELD NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3");</code>

 

I'm now getting an additional space between the two words that break to the next line.

 

What would read without the rule as:

Book Title, Author First Name

Author Last Name

 

Is now displaying with the rule as:

Book Title,

Author First Name Author Last Name

 

There is an additional space between the first and last names.

 

I realize this thread/rule is old so perhaps something has changed with the newer FP versions and oS?

Link to comment
Share on other sites

  • 3 months later...
This isn't what FusionPro means by a "widow." FusionPro's definition of a "widow" is a line or two of text flowed from a previous column or frame, not a word or two that happens to be the last line of a paragraph in a single frame.

 

However, you can use this code to prevent the last word from being on a line by itself:

  return TaggedTextFromRaw(Field("YOUR FIELD NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3");

And you need to check the "Treat returned strings as tagged text" box.

 

 

This seems to work well but the spacing between the last word and the second to the last word is very small. After composition, the output pdf shows no space between the words.

 

 

Does anyone have a fix for this?

 

 

Thank you,

John

Link to comment
Share on other sites

I'm now getting an additional space between the two words that break to the next line.

In the same job? Or in a different job?

I realize this thread/rule is old so perhaps something has changed with the newer FP versions and oS?

In the last three years? A lot has changed. It's hard to narrow down what might be going on here. I'm wondering whether your job has as well.

This seems to work well but the spacing between the last word and the second to the last word is very small. After composition, the output pdf shows no space between the words.

 

Does anyone have a fix for this?

So, these questions are very hard to answer without seeing the job files.

 

But I would say that you could try one of the suggestions in this thread:

http://forums.pti.com/showthread.php?t=5327

 

Specifically, the two things to try are:

  1. Uncheck the "Limit to Latin-1" or "Limit to Mac Roman" box.
  2. If you're using FusionPro 10.1, use <hkeep> and </hkeep> tags instead of   entities for horizontal (word level) keeps.

Link to comment
Share on other sites

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...