Jump to content

Help with diagonal strikethru in text box


Recommended Posts

Good Morning

 

I produce in store price lists for a client (A4 & A6) derived from data supplied.

 

I currently use YTD in Quark to produce the pdf's but would really love to use FusionPro to achieve my objective.

 

I have managed to recreate the format in a Variable Text box (with overflow attributes as allow text to expand to fill), however, the client insists on a diagonal strikethru on the 'list' price.

 

I have created a number of strikethru eps files to cover the eventualities re the 'length' of the list price (between 3 and 6 characters) and use a rule to place the eps over the list price - but my problem is that when the text expands or contracts to fit the box then the eps strikethru doesn't expand or contract giving a result that is not aesthestically pleasing.

 

I just wondered whether anyone had any ideas if (or how) this could be resolved. I am willing to post samples - if I can work out how - but would need to remove client details.

 

Thanks

Link to comment
Share on other sites

Would a horizontal strikethrough be acceptable? You could return tagged text and enclose the list price with the <s>...</s> tags as explained in the Tags Reference Guide on page 48.

 

I'm not sure there is a feature that would allow you to "anchor" your strikethrough graphic(s) to text which is set to expand/contract. Is the "expand to fill" option critical to your application?

Link to comment
Share on other sites

Hi Eric

 

Thanks for the quick response.

 

Unfortunately a horizontal strikethrough isn't acceptable to the client, he insists on diagonal.

 

The reason that the expand to fill option was chosen is that some of the lines of stock carry up to 13 variations - some of the lines carry only 4 variations and the client wants the tickets to look 'as busy as possible' without falling off the ticket.

 

The expand to fill suits the client fine - it's just me that's up the creek!!!

Link to comment
Share on other sites

Perhaps uploading a "declassified" sample of your output would help to show how the different pages look based on expanding lines of copy.

 

I can't picture what the result needs to look like, but I'm wondering if it would be possible to either use a separate variable text block for the list prices, or perhaps set data up in a table. These scenarios might give you better control over position of list price.

Link to comment
Share on other sites

Hi Eric

 

I have attached a small pdf showing output with horizontal strikethroughs and demonstrating how the font size changes.

 

The client insists on having a diagonal strikethrough where the normal strikethrough is shown..

Thanks for your help and interest so far.

104290_L_GEN.pdf

Link to comment
Share on other sites

Do you ever wish you could just put "real work" on hold and spend a day or two trying to figure out something more challenging and worthwhile (my opinion, likely not my boss')? :)

 

My gut tells me there might be a way to solve your problem, but I can't devote any time to it. I can see in your example PDF that all the list prices are tabbed to a set, right-justified position regardless of font size after copyfitting.

 

I would think you could use some modification of this script to determine the width of the list price text after copyfitting. Even on the largest fit, the list price does not appear to be more than 1 inch in width so you could put a 1 inch graphic variable above the text block which contains a common, diagonal stroke aligned to the right and horizontally scaled per the result from the modified code.

 

Tedious and complicated at best. Not possible at worst. My question is, "How are you doing it now?" Sorry not to be able to offer any solid help. :(

Link to comment
Share on other sites

Something like this:

var string = Field("Name");
var TMO = new FusionProTextMeasure;
TMO.pointSize = 1200;
TMO.font = "Arial";
TMO.useTags = false;
TMO.CalculateTextExtent(string);
return '<graphic height=1200 width=' + TMO.textWidth + ' file=slash.eps>' +
       '<p leading=1>' + string;

Link to comment
Share on other sites

var string = Field("Name");

var TMO = new FusionProTextMeasure;

TMO.pointSize = 1200;

TMO.font = "Arial";

TMO.useTags = false;

TMO.CalculateTextExtent(string);

return '<graphic height=1200 width=' + TMO.textWidth + ' file=slash.eps>' +

'<p leading=1>' + string;

 

Hi Eric/Dan

 

Thank you both for your interest.

 

Dan - I'm a complete newcomer to JavaScript but have tried to create a graphic rule based on the code that you kindly supplied and aligned to the information contained in my data.

 

Am I right in assuming that this is a graphic rule and has to be attached to a graphic frame?

 

I changed your code to:

 

var string = Field("DISPLIST1");

var TMO = new FusionProTextMeasure;

TMO.pointSize = 1200;

TMO.font = "Arial";

TMO.useTags = false;

TMO.CalculateTextExtent(string);

return '<graphic height=1200 width=' + TMO.textWidth + 'EPSSTRIKE.eps>' +

'<p leading=1>' + string;

 

and when I try to validate it the message 'This graphic rule must return a resource of type graphic' is displayed, even though I have created a resource called 'EPSSTRIKE.eps'

 

Also - sorry to be a pain - should I get it to work without your (or divine) intervention, do I create 13 graphic frames (because there is a max of 13 'list' prices) and create a new rule for each? If this is so, how do I know where to put the frames if there is an OnCopyFit rule - as the text expands or shrinks depending on how full/empty the text frame is?

 

I'm very confused, I'm going for a lie down! :confused:

 

Thanks for your help

Link to comment
Share on other sites

I think Dan's code is meant to be a text rule which returns text with an in-line graphic (note that in his last line of code, he is returning the graphic AND "string" (which is the content of Field("DISPLIST1")). What I can't figure out just be looking at the code on the screen is whether this will allow the graphic to overlap the list price in the single, variable text box.

 

Also, I think Dan is assuming a set font size of 12 points although your font size changes based on the expanding text. Given this information, your question regarding quantity/position of frames is very valid, not to mention unanswered. :(

Link to comment
Share on other sites

I think Dan's code is meant to be a text rule which returns text with an in-line graphic (note that in his last line of code, he is returning the graphic AND "string" (which is the content of Field("DISPLIST1")).

Yes, this is correct. The rule is a text rule, which returns an inline graphic.

What I can't figure out just be looking at the code on the screen is whether this will allow the graphic to overlap the list price in the single, variable text box. Also, I think Dan is assuming a set font size of 12 points although your font size changes based on the expanding text.

Yes, my sample allows you to place an inline graphic which exactly overlaps the content of the field, if the text is set in the specified font and point size.

Given this information, your question regarding quantity/position of frames is very valid, not to mention unanswered. :(

Well, without knowing more about exactly how the text in question is being copyfitted and ending up in the output, I don't know exactly how to integrate this logic. If the OP could post a small sample collected job, not just the output, then I might be able to provide a rule more specific to that job. Although I'm hoping that someone can put the CopyfitLineWithMagnifyTag logic which you linked to earlier together with the logic I already posted which outputs an inline graphic in a particular size.

Link to comment
Share on other sites

Good Morning Dan/Eric

 

Thanks again for your interest in my problem.

 

I 'collected' the relevant files (plus the eps that I was trying to get to lie over the list price) in a zip file and would like to have attached it (it was well within the filesize limit) but I'm being told that my submission could not be processed because a 'security token was missing'???.

 

I can 'sort of' get your rule to work Dan, but rather than it putting the strikethrough OVER the list price it puts it in front of the list price - which is what I'd expect an inLine Graphic rule to do - except I'm not trying to put the graphic in-line with but on top of the text.

 

I'm obviously doing something not right and again would welcome your assistance

Link to comment
Share on other sites

I 'collected' the relevant files (plus the eps that I was trying to get to lie over the list price) in a zip file and would like to have attached it (it was well within the filesize limit) but I'm being told that my submission could not be processed because a 'security token was missing'???.

I think this is because the attachment is too large. You might want to try just attaching the template PDF for starters. I don't need the exact EPS file in order to examine generally how your job is set up or to cobble something together with a different graphic.

I can 'sort of' get your rule to work Dan, but rather than it putting the strikethrough OVER the list price it puts it in front of the list price - which is what I'd expect an inLine Graphic rule to do - except I'm not trying to put the graphic in-line with but on top of the text.

Well, again, my basic example used the <p leading=1> tag to make the graphic overlap the text, but that might not work correctly under certain conditions, especially if you're already doing copyfitting. That's why I need to know exactly what you're doing, which I can only know for sure by looking at the job, or at least the PDF template.

Link to comment
Share on other sites

Good Morning Dan/Eric

 

I have attached the pdf and the data that I' work from.

 

I've also took the liberty of attaching a pdf of how i'd like the final output to look like (I achieved the strikethrough by copying and pasting in Pitstop) - not too bad on a file this size but there could be, potentially, 500+A4 tickets each with, potentially, 13 list prices - by the time I'd done that the furniture would be collectors items!!!

 

Thanks for your help

TYPE L_104290_graphic.pdf

104290_L_A4_CABINET_APR_103599.txt

TYPE_L_OUTPUT2_JM.pdf

Link to comment
Share on other sites

...my basic example used the <p leading=1> tag to make the graphic overlap the text, but that might not work correctly under certain conditions, especially if you're already doing copyfitting.

 

Dan, did you catch in the OP that Dave is checking the box that allows text to expand to fill? He is not using a set point size from page. :eek:

 

Dave, as a test, can you temporarily turn off the expand to fill option and set your copy to 12 pt. Arial to see how Dan's code works in that scenario?

Link to comment
Share on other sites

Hi Eric/Dan

 

I have set the font to Arial 12pt (for the description and other fields EXCEPT for the code and subhead fields and turned off expand to fit on the text frame and, as a safeguard, 'rem'ed out the OnCopyFit Rule and edited the slash rule as:

 

var string = Field("DISPLIST1");

var TMO = new FusionProTextMeasure;

TMO.pointSize = 1200;

TMO.font = "Arial";

TMO.useTags = false;

TMO.CalculateTextExtent(string);

return '<graphic height=1200 width=' + TMO.textWidth + ' file=epstrike1.eps>' +

'<p leading=1>' + string;

a

and I attach the resultant pdf output file.

 

I have made the font black as it's a PITA having to set a background all the time in the text editor.

 

As you can see a strikethrough is appearing where the list price should be but, unfortunately, the list price and the word 'SALE' have moved to the beginning of the line overwriting the code and part of the description - which poses another question - if this is a tabulation issue (as I suspect it is), why havent the tabbed fields moved to the NEXT line instead of overwriting fields on the same line??? :eek:

 

I really feel that this problem is almost solved (not by me, admittedly) and continue to welcome your input

TYPE_L_OUTPUT3.pdf

Link to comment
Share on other sites

Thanks for attaching the files. Now I know what we're dealing with.

 

First of all, I would design this whole job in an entirely different way, and rework it to use a table, or a repeatable component, or a rule with a loop, or something to generate the output programmatically instead of typing multiple iterations of this in the Text Editor:

 

«CODE1» «DESC1» «DISPLIST1» SALE «DISPSALE1»

«SUBHEAD1»

 

«CODE2» «DESC2» «DISPLIST2» SALE «DISPSALE2»

«SUBHEAD2»

 

etc...

 

There's a saying I'm fond of, which is that the whole reason you have a computer is to automate repetitive tasks.

 

In other words, if you rework the job to output this content from a rule in the first place, then it's going to be much easier to maintain it, and to tweak it to change the output, without having to make the same edits in multiple places.

 

You might want to try something like this:

var result = "";
var numCodes = 13;

for (var i = 1; i <= numCodes; i++)
{
 if (Field("CODE" + i))
 {
   result += '<p tabstops="MULTIYORK_L"><p><color name="White">' +
     '<f name="Frutiger LT 55 Roman"><z newsize="11.0">' +
     RawText(Field("CODE" + i)) + '<t>' +
     '<f Name="Frutiger LT 65 Bold"><z newsize="14.5">' +
     RawText(Field("DESC" + i)) + '<t>' +
     '<z newsize="25.0">' + RawText(Field("DISPLIST" + i)) + '<t>' +
     '<f Name="Frutiger 77BlackCn"><z newsize="31.0">SALE<t>' +
     RawText(Field("DISPSALE" + i)) + 
     '<p><f Name="Frutiger LT 65 Bold"><z newsize="10.0"><t>' +
     RawText(Field("SUBHEAD" + i)) + "\n\n";
 }
}

return result;

Just use the result of this rule in your text frame.

 

I got the tags by copy-and-pasting the contents of the text box into a Formatted Text Resource and then clicking "View Source." You'll need to adjust the tab positions in the named tab style (although this would all be accomplished better with a table, which would eliminate the possibility of landing on the wrong tab stop, but that's another thread).

 

It could also be done with a Template Page (repeatable component) if you want to keep it somewhat WYSIWYG; but we're going to need to do some low-level tagging anyway to get this slash thing to come out the way you want it.

 

Now, we can modify this rule like so:

function TextWithSlash(string, height, indent)
{
 var TMO = new FusionProTextMeasure;
 TMO.CalculateTextExtent(string);
 return '<graphic file=epstrike1.eps height=' + (height || 1200) +
           ' width=' + TMO.textWidth + '>' +
           '<p leading=0>' + (indent || "") +
           string;
}

var result = "";
var numCodes = 13;

for (var i = 1; i <= numCodes; i++)
{
 if (Field("CODE" + i))
 {
   result += '<p tabstops="MULTIYORK_L"><p><color name="White">' +
     '<f name="Frutiger LT 55 Roman"><z newsize="11.0">' +
     RawText(Field("CODE" + i)) + '<t>' +
     '<f Name="Frutiger LT 65 Bold"><z newsize="14.5">' +
     RawText(Field("DESC" + i)) + '<t>' +
     '<t><f Name="Frutiger 77BlackCn"><z newsize="31.0">SALE<t>' +
     RawText(Field("DISPSALE" + i)) +
     '<p leading=0><t><t>' +
     TextWithSlash('<f Name="Frutiger LT 65 Bold"><z newsize="25.0">' +
         RawText(Field("DISPLIST" + i)), 2500, '<t><t>') +
     '<p leading=auto><f Name="Frutiger LT 65 Bold"><z newsize="10.0"><t>' +
     RawText(Field("SUBHEAD" + i)) + "\n\n";
 }
}

return result;

You'll need to turn off "Use legacy line leading" in the Global Paragraph Settings dialog.

 

This should give you pretty much the results you're looking for. Although now that I think about this a bit more, since numbers are almost always fixed-width in a font, you can probably just test the length of the string in the DISPLIST field and match it to a known width for the point size, which will be faster at composition time than re-measuring the text every time.

Dan, did you catch in the OP that Dave is checking the box that allows text to expand to fill? He is not using a set point size from page.

Yes, although this probably won't work with Copyfitting, at least not without making it much more complex. The problem is that you can't determine in a rule what the actual final size of any text will be after copyfitting.

 

EDIT: It actually still works, mostly, even with Copyfitting turned on, although the size of the inline graphic (the slash) is fixed to what it would have been without Copyfitting in effect. Although you probably won't notice this at reasonable magnification levels.

Link to comment
Share on other sites

Hi Dan/Eric

 

Genius....sheer bl**dy genius!!

 

Your rule (after a little tweaking with tab stops etc) works like a dream!. I'll still have to use Pitstop to alter a couple of the striikethroughs when the font is particularly small - or maybe I'll persuade the client to hike their prices up!

 

Next time you're in England there's a pint of best Boddingtons waiting for you.

 

Thank you both so much for your help....now I'm going to try and tackle 'tables' so....watch this space!!! :D

 

Very best regards

Link to comment
Share on other sites

Flippin' heck!

 

Just when I thought it was safe to go out!!!!

 

I thought I'd learn from scratch so that i might get a feel of how the syntax for tables worked - I got as far as entering the code on P177 of the User Guide in a rule - tried to validate it and got the error Table, line 1:invalid xml attribute:mad:

 

Code was/is

 

<table columns = 3 title = "above" alignment = "left">

<column width =7200>

<column width = 10800>

<column width =10800>

<title gap =25><p>My First Table</title>

 

<row type = "header"><cell>Number<cell>Task<Cell>Due

<row><cell>1<cell>Read UG re tables<cell>Friday am

<row><cell>2<cell>Reread UG and have a dabble<cell>Friday noon

<row><cell>3<cell>Re reread UG and kick computer<cell>Friday pm

<row><cell>4<cell>Seriously consider a career change!!<cell>Friday evening

</table>

 

Treat returned strings as tagged text is checked and the error seems to be on alignment?

 

I've tried fiddling with the 1st line and I'll keep reading and trying - but meeting & greeting at the Big M is looking good right now

 

I'm going back to my crayons!!!!

Link to comment
Share on other sites

Flippin' heck!

 

Just when I thought it was safe to go out!!!!

 

I thought I'd learn from scratch so that i might get a feel of how the syntax for tables worked - I got as far as entering the code on P177 of the User Guide in a rule - tried to validate it and got the error Table, line 1:invalid xml attribute:mad:

 

Code was/is

 

<table columns = 3 title = "above" alignment = "left">

<column width =7200>

<column width = 10800>

<column width =10800>

<title gap =25><p>My First Table</title>

 

<row type = "header"><cell>Number<cell>Task<Cell>Due

<row><cell>1<cell>Read UG re tables<cell>Friday am

<row><cell>2<cell>Reread UG and have a dabble<cell>Friday noon

<row><cell>3<cell>Re reread UG and kick computer<cell>Friday pm

<row><cell>4<cell>Seriously consider a career change!!<cell>Friday evening

</table>

 

Treat returned strings as tagged text is checked and the error seems to be on alignment?

 

I've tried fiddling with the 1st line and I'll keep reading and trying - but meeting & greeting at the Big M is looking good right now

 

I'm going back to my crayons!!!!

You can't just enter tagged markup directly into the JavaScript Rule Editor dialog. You need to either create a tagged markup file and use it as a resource, or treat the data as quoted string literals in the Rule Editor. You might want to take a closer look at the Frodo Travel tutorial.

 

P.S. Please start a new thread for a new issue.

Link to comment
Share on other sites

Hi Dane

 

Thanks for the reply - it's all becoming a little clearer now..

 

The intention wasn't to start a new thread - just make a comment on your advice in the current thread, however, point taken, my bad!.

 

Thanks again

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...