[Top][All Lists]
[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: |
Mon, 02 Nov 2009 12:45:52 -0400 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090822) |
Werner LEMBERG wrote:
you are obviously talking about an FT_GlyphSlotRec structure:
Ya, sorry if I wasn't clear about that.
Many thanks for the info - very helpful! If you can put up with me
a bit more, I'd like to clarify just a couple more points though,
mostly about what the fields represent, since you've largely
covered scaling, 26.6, etc...
Just to recap: My font driver is generally working correctly, in
both our custom rendering code, and when the font is rendered via
Cairo. There's just a couple of rendering cases that aren't working
correctly, and my suspicion is that in those cases, Cairo is using
some fields of my FT_GlyphSlotRec that aren't populated correctly.
For clarity, lets imagine a simple glyph/example, and work with real
numbers:
- The font has no hinting, so the geometry is always just it's points
(Besides, I always call load_glyph() with the NO_HINTING flag).
- It's cover is [(-800, -1000), (800, 1000)], as an example.
- Imagine NO_SCALE is passed in, so all(?) values are in font units.
Obviously, the code needs to be updated accordingly for this flag.
// These are obvious
slot->metrics.width = 1600;
slot->metrics.height = 2000;
slot->metrics.horiBearingX = -800;
slot->metrics.horiBearingY = 1000;
Since my origin is in the centre of the glyph, these are basically
half the width/height, right?
// Advance #1 (Hinted)
slot->metrics.horiAdvance = ;
slot->metrics.vertAdvance = 0;
The horizontal advance is the amount you have to move the cursor to
the right (or down for vertical layouts);
This is where I start to scratch my head ...
- Should this be the width of my glyph?
- Or maybe half the width (From the Origin to the right edge)?
- Or should it be zero? Zero seems to work in _some_ cases...
This also seems to be one of the key fields that is giving me grief.
In some cases, zero seems right, but in other cases, 'width' seems
right. I suspect something else may be wrong elsewhere, but I'd
like to ensure I've got these numbers/fields right first ...
// Advance #2 (Unhinted)
slot->linearHoriAdvance = slot->metrics.horiAdvance;
slot->linearVertAdvance = slot->metrics.vertAdvance;
>
These are *unhinted* values, as needed for device-independent layout.
Since I have no hinting, these just the same as the
slot->metrics values, right?
// Advance #3
slot->advance.x = slot->metrics.horiAdvance;
slot->advance.y = 0;
This is a shorthand: Depending on FT_LOAD_VERTICAL_LAYOUT, this value
contains either metrics.horiAdvance or metrics.vertAdvance;
FYI...
I also seem to be getting a FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH flag?
Do I need to alter anything due to this, or is it something the caller
is responsible for? The comments in src/truetype/ttgload.c almost
suggest I shouldn't be seeing this flag ...
Hopefully, I've got everything right :-)
Any info you can provide will hopefully make my stuff "more right"
than it currently is! I must confess that getting this stuff to work
correctly through all 3 codebases (Me, FT, Cairo) is pretty
confusing ...
[ And actually, it's *4*, since we use ICU for layout/kerning/etc ]
Again, many thanks!
Ian