bstalcup Posted October 24, 2008 Share Posted October 24, 2008 Is there support in Fusion Pro Desktop/Server for <nobr>-type tagging to prevent a line break at a particular point in some variable text? Quote Link to comment Share on other sites More sharing options...
Alex Marshall Posted October 24, 2008 Share Posted October 24, 2008 It depends on what you're trying to do. If you simply want to break the line, a <br> tag will do the trick. On the other hand, the <p> tag can have attributes specifying any of the properties shown in the Paragraph Formatting dialog. You might also consider using a Formatted Text Resource; if you leave the first line blank, it will force a paragraph break. Quote Link to comment Share on other sites More sharing options...
bstalcup Posted October 24, 2008 Author Share Posted October 24, 2008 i'm trying to do the opposite. <br> works fine, i need to force Fusion Pro to not break the line at certain points. functionality similar to http://reference.sitepoint.com/html/nobr are there attributes for the <p> tag that can prevent wrapping? Quote Link to comment Share on other sites More sharing options...
bstalcup Posted October 24, 2008 Author Share Posted October 24, 2008 btw, if i check "Do not break on copyfit" for the paragraph in question, it does not add a break, but it doesn't do any copyfit either. Quote Link to comment Share on other sites More sharing options...
Alex Marshall Posted October 24, 2008 Share Posted October 24, 2008 I'm not sure I agree with the statement that "the copyfitting features of FusionPro do not work with the <br> tags included." It seems that you're trying to do per-line copyfitting, which is a different kind of copyfitting than the full-flow Copyfit that's activated in the Overflow Options dialog and implemented in the OnCopyfit rule. For per-line copyfitting, you need to use the CopyfitLine function. You can find documentation about it in the Copyfitting Guide, which can be found in the Knowledge Base at this link: http://portal.knowledgebase.net/article.asp?article=178555&p=8481 Depending on what results you're trying to achieve, you may also want to use the "Do not break on copyfit" option in the Paragraph Formatting dialog, which will make sure that a paragraph does not break even when the flow is being copyfitted. Of course, this is a paragraph setting, so it only affects the paragraph as a whole, which means that it only looks at <p> tags, not <br> tags. Quote Link to comment Share on other sites More sharing options...
bstalcup Posted October 24, 2008 Author Share Posted October 24, 2008 Alex, i'm not saying the <br> tag doesn't work. it does work. i haven't said that at all. my point is this: the copyfit for an entire field (Adjust text to fit/Allow text to expand to fill) stops working (not that <br> doesn't work) if i select one paragraph in the field and check "Do not break on copyfit". Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 24, 2008 Share Posted October 24, 2008 The short answer to your question is Yes, FusionPro does support several ways to prevent text from breaking. There's no "horizontal keep" tag, but you can use the entity (non-breaking space) to prevent a set of words from breaking at line endings. The simplest way to do this is to create a function like so in JavaScript: function NoBreak(s) { return NormalizeEntities(s).replace(/ /g, " "); } Then you can simply call this function for whatever phrase you don't want to break. return NoBreak("My Product Name"); If you want to apply this "no break" logic to every instance of a field value from your input data, you can use the old "make a rule with the same name as the field to override it" trick. For instance, if you have a field named "Company Name", and you always want to keep it from breaking, you can make a rule with the same name as the field ("Company Name" in this example), and do this: return NoBreak(Field("Company Name")); A more robust solution would allow you to define a list of phrases which you don't want to break at all within a given bit of text. Here's an example of how to do that: function NoBreak(s) { return NormalizeEntities(s).replace(/ /g, " "); } var NoBreakPhrases = [ "My Company Name", "NonBreaking Product Name", // add as many as you like ]; function SetNoBreakPhrases(str) { for (var p in NoBreakPhrases) { var re = new RegExp("(" + NoBreakPhrases[p] + ")", "gi") str = str.replace(re, function(w){return NoBreak(w);}); } return str; } var s = "My Company Name would like to make you an offer for NonBreaking Product Name!"; return SetNoBreakPhrases(s); You can put the functions and the NoBreakPhrases array in your JavaScript Globals if you need to use them in multiple rules. Note that you'll need to turn off hyphenation for any paragraph into which you're setting this text as well. You can either do this with the Paragraph Formatting dialog, or you can have the function do it for you: function NoBreak(s) { return "<p br=false hyphenate=false noparabreakoncopyfit=true>" + NormalizeEntities(s).replace(/ /g, " "); } I should also mention that there is also a "Non-Breakable Phrases" option available from the Hyphenation Exceptions dialog (under FusionPro Desktop's Advanced menu), but that only affects jobs composed on that machine; in other words the list of phrases isn't kept with the job, so if your job is going to be composed remotely (such as with FP Direct or FP Web), that won't work for you. Quote Link to comment Share on other sites More sharing options...
bstalcup Posted October 25, 2008 Author Share Posted October 25, 2008 dan, that was exactly what i needed, this resolved the issue in all scenarios except one. we are merging some variable text with dollar amounts, like: 'Now $19.99' at the customers request, we are automatically finding and superscripting all '$' characters. previously, we were getting wordwrap like: 'Now $19.99' now, with the non-breaking spaces, we are getting wordwrap like: 'Now $ 19.99' if we turn off the superscript on the '$' character, it stays all on one line. why would superscripting part of a "word" (i'm guessing FusionPro views '$19.99' as one word) allow the "word" to be broken apart for wordwrapping? Quote Link to comment Share on other sites More sharing options...
pmhapp Posted July 29, 2009 Share Posted July 29, 2009 I like where Dan is going, but I don't understand what the alternative is to breaking. For instance, I have a CompanyName of "Caratted Oak View Inc." I have CopyFit turned on. FP reports it cannot CopyFit that record. So, "Inc." breaks to the next line. If it cannot CopyFit, and I tell it to not Break, where would the "Inc." go? Quote Link to comment Share on other sites More sharing options...
pmhapp Posted August 5, 2009 Share Posted August 5, 2009 To further my example... How would you use Dan's example in combination with my example? I have a CompanyName of "Caratted Oak View Inc." (on a line by itself, no text before or after it) I have CopyFit turned on, but it is too long to CopyFit. Soo, it breaks, but "Inc." goes on the next line by itself. Is there a way to say, "If you can't CopyFit, then break near the middle of the data, or force at least two words to the next line? Quote Link to comment Share on other sites More sharing options...
Magenta Posted September 3, 2009 Share Posted September 3, 2009 ...you can use the entity... The simplest way to do this is to create a function like so in JavaScript: function NoBreak(s) { return NormalizeEntities(s).replace(/ /g, " "); } Then you can simply call this function for whatever phrase you don't want to break. We're trying this now and it's returning the literal characters instead of translating it to a non-breaking space. What could be causing that? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 3, 2009 Share Posted September 3, 2009 Check the box "Treat returned strings as tagged text" in the Rule Editor dialog. Quote Link to comment Share on other sites More sharing options...
dfalkowitz Posted July 10, 2012 Share Posted July 10, 2012 When using this rule below combined with the font Frutiger 45 Light my text shows "MyProductName" - no spaces. When I switch to a different font like Arial or Tahoma then it's correct "My Product Name" - with spaces. Do you know why this works with most fonts but not all? function NoBreak(s) { return NormalizeEntities(s).replace(/ /g, " "); } return NoBreak("My Product Name"); Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 10, 2012 Share Posted July 10, 2012 When using this rule below combined with the font Frutiger 45 Light my text shows "MyProductName" - no spaces. When I switch to a different font like Arial or Tahoma then it's correct "My Product Name" - with spaces. Do you know why this works with most fonts but not all? function NoBreak(s) { return NormalizeEntities(s).replace(/ /g, " "); } return NoBreak("My Product Name"); It's impossible to say without the font. Please do not post the font here, though. You can contact Support and they can work out a way for us to get the font to test. Quote Link to comment Share on other sites More sharing options...
MeeshKB Posted December 6, 2012 Share Posted December 6, 2012 Just wanted to stop in and say thank you, Dan. I've been puzzling over this issue for a while now and this solution solved it perfectly. Thanks so much! Quote Link to comment Share on other sites More sharing options...
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.