[cairo] Re: Drawing text with Windows bitmap fonts

Jan Slupski jslupski at gmail.com
Mon Jan 22 19:08:37 PST 2007


Jan Slupski wrote:
> Stuart Parmenter wrote:
>  > Has anyone gotten win32 bitmap fonts to render using cairo?  I'm using
>  > cairo_show_glyphs() with glyph indexes I've gotten from Uniscribe.
>  > Things fall apart in _cairo_win32_scaled_font_init_glyph_metrics in
>  > cairo-win32-font.c when it tries to do GetGlyphOutlineW().  According
>  > to the MSDN docs, using GGO_GLYPH_INDEX means that it is a true type
>  > index, which I'm not sure if bitmap fonts really respect.
>  > GetGlyphOutlineW ends up failing...  I could be going down the wrong
>  > path here.. was wondering if anyone else had done more digging or had
>  > any suggestions.
> 
> Indeed, it seems that support for bitmap fonts is somewhat broken.
> I am trying to open Windows font called "Small Fonts" (smalle.fon).
> 
> As stated above, cairo is using _scaled_* functions to operate
> on that font that seems to be wrong by definition.
> This ends up on querying the font with GetGlyphOutlineW that
> by MSDN definition "The GetGlyphOutline function retrieves the outline 
> or bitmap for a character in the *TrueType* font".
> 
> I think cairo should either properly support windows bitmap fonts 
> (ignoring font size & rotation?), or fail in more meaningful way. It 
> could be either return of an error by cairo's API call, or fallback to a 
> default font in the same way as when unknown font name is passed.

Hi again,

I have opened a bug report for that issue at:
https://bugs.freedesktop.org/show_bug.cgi?id=9740

Also I have proposed a (temporary?) workaround that forces Windows to 
choose closes matching font from among TrueType fonts only.

CreateFontIndirect parameter OUT_TT_ONLY_PRECIS: Instructs the font 
mapper to choose from only TrueType fonts. If there are no TrueType 
fonts installed in the system, the font mapper returns to default behavior.

All the best,
Jan


More information about the cairo mailing list