[cairo] NO_HINTING problems with custom FT_Face
Ian Britten
britten at caris.com
Wed Oct 14 07:57:20 PDT 2009
Hi all,
[ Cairo v1.8.8, FreeType v2.3.9 ]
I was hoping that someone could help me get to the root of a problem
I'm having when using my custom FreeType font driver via Cairo. I
realize it's not truly a Cairo problem per-se, but I know that there
are some people here knowledgeable about this stuff, and I'm almost at
wits end ... :(
Problem:
- When I create+draw my text upright and use load_flags=0, the text
draws as expected. However, when I use load_flags=FT_LOAD_NO_HINTING,
my text no longer draws.
Background:
- I have a custom FT fontdriver, for accessing our custom font format
seamlessly as a FT_Face.
- I have a non-Cairo rendering system, in which the driver works as
needed (Admittedly, in very limited/controlled workflows).
- I'm trying to render this text through Cairo, which is putting
untested expectations on my driver, and which I'm trying to fix.
- Although I obviously can't reproduce this in a sample (due to the
custom font driver), the Cairo code is pretty generic. I simply
get my FT font, set it in the context, set the colour/size/etc, and
do a show_glyphs(). The same code works with TT fonts though.
I'm reasonably certain the problem is with my font driver, specifically
the FT_Slot_LoadFunc callback(*) not handling the given load_flags
parameter correctly. However, I'm not sure what Cairo is expecting
of my driver, since Cairo sets some of those flags when loading
glyphs, and the FT documentation of those flags is a bit sparse.
(*) Called by FT_Load_Glyph(), called by _cairo_ft_scaled_glyph_init()
In the case that works (I set load_flags=0), my driver received a
load_flags=2571:
FT_LOAD_NO_SCALE FT_LOAD_NO_HINTING FT_LOAD_NO_BITMAP
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH FT_LOAD_IGNORE_TRANSFORM
In the case that doesn't work (load_flags=FT_LOAD_NO_HINTING), my
driver received a load_flags=514
FT_LOAD_NO_HINTING FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
I suspect that the problem is that my driver doesn't do anything when
FT_LOAD_IGNORE_TRANSFORM is absent, and Cairo is expecting it to have
done _something_ to various fields... I'm just not sure what, and in
what units/format (eg: double? 26.6? 16.16?). I've been flailing
around some, but with no success yet.
So, is anyone familiar with this realm? (And, is anyone still reading
this? :P ) Can anyone offer any description or suggestion of what I
need to do?
Or, if I'm completely off-base, does anyone have any other ideas why
my text doesn't draw when I turn off hinting?
Many thanks for any help!
Ian
More information about the cairo
mailing list