Jump to content

CopyfitLine with multiple variables and fonts


jwhittaker

Recommended Posts

I have a BC where the name and title is on one line and the customer wants the name to stay the same size and the title to copyfit using the rest of the line. The text box is 3.25" wide. The name is a different font with 4 spaces at the end before the title starts. For example,

Jon Smith + '< >'+'< >'+'< >'+'< >' + Vice President of Operations (I added '< >' to represent a space since the 4 spaces were disappearing)

I've tried several different things but the title comes out very small or doesn't copyfit at all and wraps to the next line.

Edited by jwhittaker
showed too many examples of what I tried doing
Link to comment
Share on other sites

This is an awful lot to sort through. Also, a large portion of your post seems to just be repeated. It's all very hard to follow. Frankly, I don't think I'll have time to figure it all out. Someone else is welcome to try, though. If you can post a sample job, that would be easier to analyze.

 

That said, a few comments:

The problem with this is the length of the copyfit size(highlighted in red above)

I'm not seeing anything highlighted in red in your post. Maybe you could edit the post to remove the duplicate stuff and fix up the formatting.

since the name can change sizes which would leave different constraints of the size,

The size you specify in the call to CopyfitLine or CopyfitLineWithMagnifyTag is not the size of the text, it's the width of the text frame. Obviously the size of the text varies, it's a VDP job. The whole point is that you need to size that text to fit a particular frame. The function needs to know how big of a frame you're trying to size the text into.

 

Anyway, depending on how the job is set up, it might easier to just put that line of text into its own text frame and turn on Copyfitting by opening the Overflow dialog and checking "Adjust text to fit."

Link to comment
Share on other sites

Sorry Dan

I was trying to show everything I had already tried. I fixed my original post.

Does anyone have any ideas?

Some examples below

 

Name is 8pt, bold, and black title is 8pt, italic, and red

only the title can copyfit they want the name to stay 8pt.

The text box is 3.25" wide and can only have 1 line of text

The underscores represent spaces in the same 8pt bold font as the name

 

John Smith____Vice President

Margaret Blackenhacken____Senior Vice President of Operations

Link to comment
Share on other sites

Sorry Dan

I was trying to show everything I had already tried. I fixed my original post.

Does anyone have any ideas?

Some examples below

 

Name is 8pt, bold, and black title is 8pt, italic, and red

only the title can copyfit they want the name to stay 8pt.

The text box is 3.25" wide and can only have 1 line of text

The underscores represent spaces in the same 8pt bold font as the name

 

John Smith____Vice President

Margaret Blackenhacken____Senior Vice President of Operations

It would be a lot easier to offer a specific suggestion if you could post a sample job. But the CopyfitLine function will work for this. It has separate parameters for "static" text whose size won't change and "dynamic" text which will get resized. So something like this should work:

var frameWidthInInches = 3.25;
var frameWidthInPoints = frameWidthInInches * 72.0;
return CopyfitLine('<b>' + Field("Name") + "    ", '<i><color name="Red">' + Field("Title"), "Arial", 8, frameWidthInPoints, 4);

Although you would have to have a really, really long name and title for everything to not fit on a line 3.25 inches long at a point size of 8.

 

Also, your usage of the   attribute is incorrect. You don't want to put it in angle brackets; it's not a tag.

Link to comment
Share on other sites

Well, you're not calling out the red color by the right name. But this works great for me:

var frameWidthInInches = 3.24;
var frameWidthInPoints = frameWidthInInches * 72.0;
return CopyfitLine('<b><color name="Black">' + Field("Name") + "    ", 
                   '<color name="c0m75y100k0"></b><i>' + Field("Title"), "Myriad Pro", 8, frameWidthInPoints, 3);

http://forums.pti.com/attachment.php?attachmentid=869&stc=1&d=1370646348http://

copyfitline.thumb.jpg.7e3da11d9d686567d09f73d2dc97eafe.jpg

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