Jump to content

Combine Font size according to character length and vertical text rules


PermclipPrePress

Recommended Posts

I am trying to combine 2 rules the first is font size according to character length the second rule is the vertical text rule. I have tried all different combinations with no luck. I have tried the font rule according to character length and using the Vertical Text checkbox in the advanced text effects and it is not cooperating with me. Any help is greatly appreciated.

 

my coding that works separately is below:

 

if (Len(Trim(Field("TEXT"))) < 28) {

return '<z newsize="14.3"/>' + Trim(Field("TEXT"));

} else {

return '<z newsize="12"/>' + Trim(Field("TEXT"));

}

 

retstr = "";

 

for (i = 0; i <= Field("TEXT").length; i++)

{

if (Mid(Field("TEXT"),i,1) == " ")

retstr = retstr + "<p>"

else

retstr = retstr + Mid(Field("TEXT"),i,1) + "<p>"

}

return retstr;

Link to comment
Share on other sites

I am trying to combine 2 rules the first is font size according to character length the second rule is the vertical text rule. I have tried all different combinations with no luck. I have tried the font rule according to character length and using the Vertical Text checkbox in the advanced text effects and it is not cooperating with me. Any help is greatly appreciated.

The Vertical Text button doesn't do anything yet, as you have discovered. This will be activated in an upcoming release of FusionPro. Although it's intended mainly for Japanese text; English won't really be vertical unless full-width Unicode characters are used.

my coding that works separately is below:

 

if (Len(Trim(Field("TEXT"))) < 28) {

return '<z newsize="14.3"/>' + Trim(Field("TEXT"));

} else {

return '<z newsize="12"/>' + Trim(Field("TEXT"));

}

That code is all well and good, but you're returning in both cases, so nothing after that will ever get executed, nor have any effect on the output.

 

At any rate, I don't really see the purpose of that code. For what you're trying to do there, I wouldn't write any code at all; I would just use copyfitting to fit the text (click Overflow on the Text Frame Properties dialog, then select "Adjust Text To Fit"). You can always use the "Do not break on copyfit" setting in the Paragraph Formatting dialog if you want to copyfit just a single line.

 

Also, you should consider using the "Go Advanced" button and then the # (Code Block) button when you're posting code to the forum.

retstr = "";

 

for (i = 0; i <= Field("TEXT").length; i++)

{

if (Mid(Field("TEXT"),i,1) == " ")

retstr = retstr + "<p>"

else

retstr = retstr + Mid(Field("TEXT"),i,1) + "<p>"

}

return retstr;

That's basically the same as this:

return Trim(Field("TEXT")).split("").join("<p>");

(Note my use of a Code block here on the forum.)

 

I would just use that one-liner rule and turn on copyfitting.

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