Re: Font, layout units et al.

From: Tomas Frydrych (tomas@frydrych.uklinux.net)
Date: Fri May 24 2002 - 12:46:13 EDT

  • Next message: Tomas Frydrych: "Re: Font, layout units et al."

    Hi guys,

    > > take in account that I want to extract the *linear*
    > > metrics of the font. Ie, before the hinter touch the
    > > glyph, and before it's scaled down.
    > >
    > > I have this field in my debug code in Xft, and I'm
    > > seeing the right float value (as if it was with layout
    > > precision) extracted from a font at 12 points
    > > (freetype gives us this field).

    This is not right and is not going to work. You need to extract the
    metrics _after_ the hinter processes the glyph because the final
    call to the drawing routines, whether the on screen graphics or the
    PS interpreter, is going to use the proper, i.e., hinted, metrics and
    hinted glyphs. If you do your calculations with unhinted metrics the
    real hinted character drawn on the screen could be noticeably
    wider than the slot you allocated for it, and if you advance by the
    unhinted width it will be covered by the next character (we get this
    very problem in the PS output).

    The real answer to our problem is _not_ to request fonts at
    incorrect physical sizes as we do at moment. Instead of scaling
    the physical font size from say 12 to 240 points (72 -> 1440 dpi)
    we have to request a font of 12 points but tell the rasterizer to apply
    a transform of 1 point to 20 device uints. With FreeType this is
    done by call to FT_Set_Transform(). I think if we do this then we
    will not need to advance by characters to fix this (which I am pretty
    certain would result in in a very poor drawing performance).

    Tomas



    This archive was generated by hypermail 2.1.4 : Fri May 24 2002 - 12:50:57 EDT