strategies for non-horizontal text orientation

Kay C Lan lan.kc.macmail at gmail.com
Sat Jun 13 05:57:18 EDT 2009


On Sat, Jun 13, 2009 at 8:22 AM, Richard Gaskin
<ambassador at fourthworld.com>wrote:

Ideally these would be at a 45-degree angle, so each could be clearly
> associated with the column they relate to but still be reasonably readable.


> But I'd prefer 45 degrees, and that means doing each label in its own
> operation, not the speediest thing in the world since I may have up to a
> hundred or even two hundred labels to produce.
>
> But that's not the hard part.  The hardest part is printing.  Argh.
> Printing an image of text will be jaggies-hell compared to the smooth
> appearance of native vector-rendered text.
>
> Any of you doing angled or vertically-oriented text?  Any tips you can
> share?
>

Haven't done it before, but just had a quick play around and was quite
impressed with what I could achieve.

It doesn't look as though it would be impossible to do programmatically, but
it would certainly be easier with a mono-spaced font. A coupe of things I
note, for Monaco:

There is no difference between the formattedWidth of the field if the text
is horizontal or 45 degrees.
The relationship seems to be, textHeight needs to be set to half the
textSize
Creating the content of the label field, starrt with two blank lines then
simply loop through each char of 'my label here' placing each char on a new
line and increment the number of preceding spaces by 1.
get the formattedWidth and formattedHeight to determine how big the label
field needs to be.
Conveniently, with margins set to 0, and the field set to it's formatted
width and height, the last letter of the content is nicely placed in the
bottom right corner.
Tested for font size 10 to 36.

In the case where all the labels, Font Style and Size are all predefined, ie
not user modifiable, I'd create an array, saved in a custom property, the
key would be the label, the element a 3 item list, height, width, content
(the label with the leading blank lines and all the chars with their
preceding spaces on their own lines)

Extracting and setting the data would be very quick.

No problems printing.

HTH



More information about the use-livecode mailing list