[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FT2 design question

From: David Turner
Subject: Re: FT2 design question
Date: Mon, 28 Feb 2000 11:02:15 +0100

Hi Stefan,

> > There are great chances to see _very_ different results because the 
> > auto-hinting
> > will be so different..
> Couldn't you try to set up a little doc or even put it into a FAQ to 
> illustrate
> how to get text transformation right ? I'm by no means an expert in glyph and 
> font
> processing (not to speak about text processing). However, I design the berlin 
> architecture
> and there we don't usually deal with device coordinates. Each node in the 
> scene graph
> basically knows about it's local coordinate system (like in openGL). Sure, 
> you *can*
> access the transformation to the device space given a particular DrawingKit 
> (the device,
> renderer pair). However, I'd prefer to formulate things in a coordinate 
> independant manner.
> For this to work, I'd like to be able to simply feed in a character (or 
> string) and a
> transformation matrix into the rasterizer and get a pixmap which is ready to 
> be mapped
> to the video memory.
It really depends by what you mean by "get text transformation right ?".
Here's is a naive approach, for a rotation/slanting matrix:

  I-   layout the text (performing justification/substitution/positioning)
       on a "virtual" horizontal (or vertical for CJK) baseline. This operation
       only relies on glyph metrics. Record the vectorial position of each text
       glyph origin after your layout is done.

  II-  now, transform each glyph origin with your matrix.

  III- now, on each computed glyph origin, draw a transformed glyph image.
       You would usually load/hint the glyph outline, transform it with the
       matrix, then draw the resulting glyph image.

Note that phase I doesn't need the glyph images, only the untransformed metrics
that can be fetched from a cache. For phase III, you would either use a cache
containing vectorial glyph outlines, or re-load the glyph image.

Note however than if your matrix contains a scaling factor, you would certainly
need to do things a little differently :

  A-  Decompose your matrix into a scaling transform and a rotation/slanting.
      I won't detail this here, but it basically involves computing the length
      of the transformations of vectors [1 0] and [0 1] :-)

  B-  Use the scaling transform to compute the "new" physical text size, and
      perform phase I with the metrics from this new size.

  C-  Use the rotation/slanting component of your transformation matrix to do
      phase II and phase III

If you don't separate your transformation matrix, the outlines will be loaded
and hinted for the original character pixel size, then scaled. This will most
certainly give you unpleasant effects..

Hope this helps,

- David

reply via email to

[Prev in Thread] Current Thread [Next in Thread]