Bug 9740 - Win32 bitmap fonts (*.fon) does not show up nor return any error status
Summary: Win32 bitmap fonts (*.fon) does not show up nor return any error status
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: win32 backend (show other bugs)
Version: 1.2.6
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Owen Taylor
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-22 18:45 UTC by Jan Słupski
Modified: 2008-10-14 17:33 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
workaround: Force Windows to select from among TrueType fonts only (486 bytes, patch)
2007-01-22 19:01 UTC, Jan Słupski
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Słupski 2007-01-22 18:45:38 UTC
Windows bitmap fonts (like font named "Small Fonts" - smalle.fon) does not show
up when processed by win32 backend. More -- they does not give any status about
the failure, so the user does not know that something went wrong.

Internally "Small Fonts" is processed using win32 module  _scaled_* functions
so it seems to be wrong by definition.

Processing ends up on querying the font with GetGlyphOutlineW that returns
an error (that is not passed down to the caller).

By MSDN definition "The GetGlyphOutline function retrieves the outline 
or bitmap for a character in the *TrueType* font".
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_52at.asp
Comment 1 Jan Słupski 2007-01-22 19:01:58 UTC
Created attachment 8482 [details] [review]
workaround: Force Windows to select from among TrueType fonts only

Proposed solutions:
1. Add support for the windows bitmap fonts
- this can be difficult since lack of scaling, and rotation only at 0, 90, 180,
270 degrees

2. Return an error status indicating that this kind of font is available on the
system but unsupported

3. Treat the bitmap font like missing/unknown font (i.e. use default one)

3a. Force Windows to select from among scalable fonts only.
Attached patch adds OUT_TT_ONLY_PRECIS flag to CreateFontIndirect call.

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.

"only TrueType fonts" may be to limiting, but seems to be good workaround (at
the moment at least)... 
Alternative OUT_OUTLINE_PRECIS option didn't seem to work for me.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_4rw4.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_1wmq.asp
Comment 2 Adrian Johnson 2008-01-11 04:13:12 UTC
There has been some recent patches committed to fix Windows bitmap fonts. The latest git version should work for bitmap fonts that are not rotated.

The workaround you suggested can be done from your application. Just set the LOGFONT to filter out bitmaps then call cairo_win32_font_face_create_for_logfontw(). Also your patch excludes OpenType/PS and Type 1 fonts. I would suggest: 

logfont.lfOutPrecision = OUT_OUTLINE_PRECIS
Comment 3 Adrian Johnson 2008-10-14 17:33:45 UTC
Closing this as the original bug report "bitmap fonts do not show up" has been fixed. Since 1.8.0 bitmap fonts should be working fine.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.