TroyM68 Posted April 20, 2017 Share Posted April 20, 2017 I am having an issue where a last name field is being broken at the hyphen between the two parts of their last name. I have a rule in a business card that basically states: if the typed characters, in a text frame, fit on one line, then use the specified font (Open Sans) and size (9) specified. if the text exceed the spacing available on that line, then use a condensed font (Open Sans Condensed) size (9) and adjust the magnification of the text so that it will fit on one line. if the adjusted text still exceeds the space allowed, show an error message. Here is my problem: When a person has a long first and last name with a hyphen, it puts the first name field on the top line (full sized) and drops the hyphenated last name to a second line (full sized) This doesn't happen if I put the optional Middle Initial into the data file...OR...when I put a credential in the data file. This odd break only happens when the last name has a hyphen...AND...both the Middle Initial and Credential fields are left blank. If anyone has any ideas how I could address this, I would be most appreciative! Thanks in advance! Troy Here is the rule: //Field names var Creds = Field('Credentials') var FirstMILast = Field('First Name') + ' ' + Rule('Rule - Middle Initial') + Field('Last Name'); // FirstMILast = First MI. Last var v_field = [ FirstMILast, Creds ].filter(String); // Creates the Variable "v_field" = FirstName MI. LastName, Creds //Font var font_name = "Open Sans"; //change this to the correct font //Font Size var v_size = "9"; //change this to the correct font size //Frame Width in inches var v_frame = "1.548"; //change this to the width of the actual text frame var var1_n = '<f name="' + font_name + '">'; var var1_s = '<z newsize="' + v_size + '">'; var var2 = v_field.join(', '); //combine fields var var3 = v_frame*72; //get frame width in points var var4 = var1_n + var1_s + var2; var tm = new FusionProTextMeasure; tm.CalculateTextExtent(var4); var tmwidth = tm.textWidth; if (tmwidth < var3*100){return var4;}//if no scaling needed return without magnify if (tmwidth > var3*100){return Rule('Condensed Font Rule');} //if it can't fit on 1 line without scaling use condensed font rule Quote Link to comment Share on other sites More sharing options...
TroyM68 Posted April 20, 2017 Author Share Posted April 20, 2017 Just an FYI... I went into the Text Frame 'Paragraph Settings' and turned "Do not break on copyfit", and poof...all my problems went away! Hopefully this helps anyone that may be having a similar issue.... Got to remember, don't look over the easy stuff!!! 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.