[cairo] win32 font faces

Adrian Johnson ajohnson at redneon.com
Fri Nov 6 06:33:03 PST 2009


Bug 24849 reports that Inkscape on win32 is creating PDFs with the same 
font embedded multiple times. This is because the win32 font backend is 
not using a hash table of font faces to return an existing face when the 
same font is used.

Attached is a patch that to fix this. The patch doesn't completely solve 
the problem of ensuring each win32 font used is embedded only once. The 
function

cairo_win32_font_face_create_for_logfontw_hfont ((LOGFONTW *logfont,
                                                          HFONT font);)

which can specify a HFONT object to use. My patch uses both LOGFONT and 
HFONT as the hash table key so creating fonts with the same LOGFONT but 
different HFONT objects will return different font faces. For Inkscape 
the patch fixes the problem as Inkscape only uses 
cairo_win32_font_face_create_for_logfontw ().

Would it be better to filter out duplicate LOGFONTS in 
cairo-scaled-font-subsets.c instead to guarantee fonts will only be 
embedded once?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-win32-Use-a-font_face-hash-table-provide-unique-font.patch
Url: http://lists.cairographics.org/archives/cairo/attachments/20091107/f8a7c4fb/attachment.txt 


More information about the cairo mailing list