freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] FT_Slot_LoadFunc load_flags info?


From: Ian Britten
Subject: Re: [ft-devel] FT_Slot_LoadFunc load_flags info?
Date: Thu, 29 Oct 2009 11:54:54 -0300
User-agent: Thunderbird 2.0.0.23 (X11/20090822)

Werner LEMBERG wrote:
- Is a font driver responsible for checking for the presence/absence
  of the FT_LOAD_IGNORE_TRANSFORM bit when loading a glyph?

No.  Transforming happens after the font driver has done its job; this
flag is used in files from the `src/base' directory only[1].

Many thanks for the clarification!  While grubbing through the TT
driver, I had basically come to the same conclusion.

Further digging now has me focused on the various 'advance' fields
the driver may return.  Altering their values improves some results,
but I still can't get things fully correct...
Maybe I can bug you a bit more?  :)

First, I'm trying to reconcile the font definitions from
http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-3.html#section-1
with my fonts, and finally with the plethora of different 'advance'
fields in the FT_GlyphSlotRec that I think I'm expected to populate.
[ As well, doubles vs 26.6 vs 16.16 ... ]

My glyphs are very simple/dumb, consisting solely of their geometry,
and no bearings, advances, etc.  The only quirk is that (0,0) is
typically their centre, not the lower-left corner, and I'm not sure
if that needs to be reflected in some of these settings or not.

Solely based on experimentation of what works so far, here's my latest
take on what to set:

        // These are obvious
        slot->metrics.width = myWidth;
        slot->metrics.height = myHeight;

        // Bearings
        slot->metrics.horiBearingX = myMinX; // NEGATIVE ?
        slot->metrics.horiBearingY = myMaxY;

        // Advance #1
        slot->metrics.horiAdvance = 0;
        ft_synthesize_vertical_metrics(&slot->metrics,
                                       slot->metrics.vertAdvance);

        // Advance #2 (What's the diff?)
        slot->linearHoriAdvance = 0;
        slot->linearVertAdvance = 0;

        // Advance #3 (Unused?)
        slot->advance.x = 0;
        slot->advance.y = 0;

        // Presumably none of the other fields are relevant to
        // this discussion ...

With this, my glyphs still draw in our existing (non-Cairo) rendering
code, and also for rendering to an *upright* Cairo surface.  However,
once I set a rotation on Cairo, it seems to render text via a
different path, which presumably uses some fields I [still] don't have
set correctly.  Similarly, rendering the filled glyphs vs just their
outlines (via cairo_glyph_path()) is another case that I'm
struggling with.
Note that I'm doing all my rendering with FT_LOAD_NO_HINTING.

So basically, I'm hoping that if I can get these fields correctly set,
then all cases will automagically work, and I won't have to try to
debug the the FreeType/me/Cairo combination ... :P

As such, any information/suggestions would be greatly appreciated!
Or, if any more information would be helpful, please ask.
Many thanks in advance!
Ian




reply via email to

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