Jump to content

Horizontal Alignment Formatting Rule


Ryan_B

Recommended Posts

I'm getting some strange behavior from a rule I have written, and I'm wondering if anybody can tell me why.

I have a business card that allows the user to upload a headshot. It is not required, so if the user decides not to upload one, I want to horizontally center align a textframe.

This is the rule I have written to do so:

if(Field("HeadShot") == "")
{
  return '<p quad=C>' + Rule("RuleNameToUpper");
}
else
{
  return Rule("RuleNameToUpper");
}

The rule RuleNameToUpper simply puts the Name field in all caps. I then inserted that rule into the textframe that I want to center align.

 

I've tested it and it works as expected, except for one part. If the user does not upload a headshot, the textframe center aligns, but the font size is decreased. I've tried conditionally setting the font size with:

<z newsize="32">
//this is as big as I can go before getting the "red bar of death" at the bottom of the textframe.

But I can't get it the same size as the font if the user does upload a headshot. Here's the strange part: The font size set for that text frame is 12, and fills the entire height of the text frame.

 

This is how it looks when the user does not upload a headshot.

woHeadShot.PNG.a41f5d2d5bafaae45c056b7f678b22ac.PNG

This is how it looks when the user does upload a headshot.

wHeadShot.PNG.389a481d25f674562b9cbbc00cd45d33.PNG

 

I'm not sure how or why when the user does not upload a headshot, the font size decreases. Any ideas for a fix would be greatly appreciated.

Link to comment
Share on other sites

The paragraph tag by default starts a new paragraph. In other words, adds a break. Making this small modification should resolve your issue:

if(Field("HeadShot") == "")
{
  return '<p [color="Red"]br=false[/color] quad=C>' + Rule("RuleNameToUpper");
}
else
{
  return Rule("RuleNameToUpper");
}

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