Jump to content

Change Super/Sub ratios


tobarstep

Recommended Posts

Is it possible to change the values for superscript and subscript on the fly? I have text in a single text frame that needs to be superscripted but to match what the customer wants I need to use two different ratios.

 

Basically I have a price: "3 for 12.00". The "12" will be a large font, the "3 for" will be smaller and needs to print aligned to the middle (vertically) on the "12". The decimal is removed and the "00" is smaller and aligned with the top of the "12".

 

I'm attaching a sample of what I'm talking about. The sample was made using separate text frames for the "2 for" and the "12.00", but I'd like to move away from that solution if possible. As you can see in the sample, it's difficult to get things positioned correctly that way.

3for12.png.57beed6eb71655dc7dba183f19776565.png

Link to comment
Share on other sites

Perhaps I don't fully understand the problem, but based on the PNG file, wouldn't you just enter your text in a single frame at respective point sizes, and set the frame to align in the middle (center icon in bottom, right corner of text frame dialog box)? You'd still apply the superscript tag for the "00" as you did before.
Link to comment
Share on other sites

Perhaps I don't fully understand the problem, but based on the PNG file, wouldn't you just enter your text in a single frame at respective point sizes, and set the frame to align in the middle (center icon in bottom, right corner of text frame dialog box)? You'd still apply the superscript tag for the "00" as you did before.

 

One would think, but that doesn't work as expected.

Link to comment
Share on other sites

tobarstep,

 

You can change the value of the superscript (subscript) ratio as well as the height that it reaches from the baseline. Using the Text Editor you would enter the paragraph definition window (the paragraph button on the right side of the editor toolbar) and there you enter the Global Settings menu for the template (button in lower left side of paragraph window). This is where you can set the ratios for superscript, subscript as well as the amount of spacing between words. This is however a "global effect" and everything in the template will change to that setting.

 

Although it didn't seem to work for me they way that I desired it to, I was informed that you can also change the ratios on a line by line basis using tagged text. The paragraph tag command <p superratio="%%" superoffset="%%"> (where you fill in the percentage amounts that you desire) is supposed to temporarily change the size and height offset of the superscript variable on a case by case basis. Other listings for paragraph controls are available in your Tagging Reference Guide.

 

When I tried using more than one of those command on a signle line (the dollar sign and the cents amount were supposed to be two different superscript and offset values) only the first setting worked the second command was disregarded.

 

Hope this helps you on your way.

 

Good Luck

Link to comment
Share on other sites

tobarstep,

Although it didn't seem to work for me they way that I desired it to, I was informed that you can also change the ratios on a line by line basis using tagged text. The paragraph tag command <p superratio="%%" superoffset="%%"> (where you fill in the percentage amounts that you desire) is supposed to temporarily change the size and height offset of the superscript variable on a case by case basis. Other listings for paragraph controls are available in your Tagging Reference Guide.

 

When I tried using more than one of those command on a signle line (the dollar sign and the cents amount were supposed to be two different superscript and offset values) only the first setting worked the second command was disregarded.

 

Hope this helps you on your way.

 

Good Luck

 

Thanks for reminding me of those David. I had tried those attributes back a while ago myself and had gotten similar results. To be honest, I had forgotten about them so maybe I'll play around with them some more. I was hoping maybe there was something new to use with the FusionProTextFrame object. Maybe next release ;)

Link to comment
Share on other sites

tobarstep,

 

I'm still in the Dark Ages here with version 4.2. - trying to get them to upgrade though - so I have not had any time to experiment with the new TextFrame options and other like things in version 6. One thing that was added, though after I had tried the tagged commands, was the ability to not have a <p> command break into a new paragraph. When I first tried this the <p superratio="%%" superoffset="%%"> command would automatically force a new paragraph so I couldn't put two separate statements in the same line. They have since allowed the <p break="false"> command to activate the paragraph settings but NOT force a new paragraph break. I haven't gone back and tried putting two commands in the statement since the project was altered to be able to handle the previous limitation.

 

I'd be curious to know if the two statements could now work.

 

Thanks,

Link to comment
Share on other sites

So, I think I did actually get this to work. I had to use a combination of attributes in the <p> tags.

 

This being an example of what is working for me, this particular price is "10 for 10.00". There is some added mess here because I have to adjust tracking on "1"s as my font spaces them too far from other characters:

 <p br="false" superratio="30" superoffset="70">
<superscript><tracking newsize="-10">1</tracking>0 FOR</superscript>
<p override="true" br="false"><tracking newsize="-10">1</tracking>0
<p override="true" br="false" superratio="50" superoffset="70"><superscript>00</superscript>

 

The br="false" part is crucial to keeping things on one line, but it was the override="true" attribute that finally made it all work for me. That attribute isn't in the documentation. I just picked it up from somewhere on these forums.

 

The end result of that code looks like the attachment. It needs some more tweaking to font sizes and spacing, but the overall format is right and that is what I was lacking before. Thanks again for reminding me of the "superratio" and "superoffset" attributes.

 

Edit: On a side note, I noticed the tracking tag does not work inside of a superscript tag.

10for10.png.2472fd385a841bc03efa3a2601fef53e.png

Link to comment
Share on other sites

Thanks for posting your solution as I am still learning how to use tagging to my advantage. While I understand how your code addresses the specific example, I do not understand how the code can be customized based on the variables in each record (assuming your tagged text is not static between records). Would you mind explaining how you plan to incorporate your solution across multiple records?
Link to comment
Share on other sites

Thanks for posting your solution as I am still learning how to use tagging to my advantage. While I understand how your code addresses the specific example, I do not understand how the code can be customized based on the variables in each record (assuming your tagged text is not static between records). Would you mind explaining how you plan to incorporate your solution across multiple records?

 

Yes, that was just the output of my rule to show how the tagging worked. The actual rule is still a work in progress, and I'm constantly making changes and tweaking things, so don't laugh at the sloppiness and haphazard nature of it :eek:

 

This is what I'm currently working off of:

var salePrice = Field("saleprice1");
var dollarAmount = Field("dollars_price1");
var centAmount = Field("cents_price1");
var signFormat = Field("sign_format1");
var saleQty = Field("qty_for1");
var limitText = Field("limit1");
var addText = Field("additional1");
var lbText = Field("lb1");
var limitSize = 8;
// Adjust tracking on amounts that contain a "1"
var regOneMatch = /1/g;
dollarAmount = dollarAmount.replace(regOneMatch, "<tracking newsize=\"-10\">1</tracking>");
centAmount = centAmount.replace(regOneMatch, "<tracking newsize=\"-10\">1</tracking>");
//************************************* Handle "Limit" and "Additional" Fields ***************************************
if (addText){
   limitText += " " + addText;
}
if (signFormat){
   // Indicates something other than a standard sale price
   if (signFormat.match(/^COUPON/)){
       var offText = Field("coupondealdescription1").match(/off/i)[0].toUpperCase();
       if (!lbText){lbText = offText}
   }
}
//***************************************  Price with a multiple ********************************************************
if (saleQty){
   // Indicates a price with multiple (eg. 2 For 5)
   // Format the multiple and prepend to the price later
   // If the first digit in the price is a 2,4,6 then add a thin space after the word "for" - spacing issues
   var forString = (dollarAmount.match(/^[246]/)) ? " FOR " : " FOR";
   // Tracking adjust inside of superscript tags does not seem to work at the moment
   //saleQty = saleQty.replace(regOneMatch, "<tracking newsize=\"-10\">1</tracking>");
   if (lbText){forString = lbText + forString}
   saleQty = "<p br=\"false\" superratio=\"40\" superoffset=\"65\"><superscript>" + saleQty + "</superscript>" + 
   "<p override=\"true\" br=\"false\" superratio=\"25\" superoffset=\"105\"><superscript>" + forString + "</superscript>";
}
//***************************************  Standard Sale Price   ********************************************************
// No other special considerations - a standard sale price
var returnPrice = saleQty + 
"<p override=\"true\" br=\"false\">" + dollarAmount + 
"<p override=\"true\" br=\"false\" superratio=\"50\" superoffset=\"70\"><superscript>" + centAmount + "</superscript>";
if (limitText){
   //limitSize = (limitText.length > 25) ? 8 : 10;
   returnPrice += "<p override=\"true\"><z newsize=\"" + limitSize + "\">" + limitText;
}
return returnPrice;

 

Your field names will obviously be different than mine. Essentially, I assign fields to variables, manipulate the variables, then stick them into tagged text strings and return the whole thing. I have about 5 more scenarios with different price formats to add to that as well.

 

My current effort is to get the word "OFF" or "LB" to print directly under the superscripted cents amount, bottom-aligned with the larger dollar text. That's proving to be much more difficult than the original issue.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...