No default fonts are initialized on WinCE (Windows Mobile 6.1)
Original Reporter info from Mantis: PaulvH
-
Reporter name: Paul van Helden
Original Reporter info from Mantis: PaulvH
- Reporter name: Paul van Helden
Description:
Windows.GetStockObject(DEFAULT_GUI_FONT) returns zero on the device.
The only stock font is SYSTEM_FONT and on Windows Mobile it actually returns what you want: Tahoma as used by the device.
Related: on line 45 of lcl\interfaces\wince\winceobject.inc the function call is commented out:
//FMetricsFailed := not Windows.SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
because Wince doesn't have SPI_GETNONCLIENTMETRICS. This is a problem because line 534 in wincewinapi.inc assumes that the FMetrics.lfMessageFont structure is initialized. The result is that lfHeight in the TLogFont structure remains 0 and that creates a large and ugly font.
Also, because a font is created with an empty LOGFONT structure, WM chooses a user installed font if there is one. This can cause the default font to be map symbols from a GPS application!
Additional information:
Fix 1: change parameter on line 150 & 151 in lcl\interfaces\wince\winceobject.inc to SYSTEM_FONT
Fix 2: change TWinCEWidgetset.Create to:
if FMetricsFailed then
begin
FMetrics.iMenuHeight := GetSystemMetrics(SM_CYMENU);
Font:=GetStockObject(SYSTEM_FONT);
GetObject(Font, SizeOf(FMetrics.lfMessageFont), @FMetrics.lfMessageFont);
GetObject(Font, SizeOf(FMetrics.lfCaptionFont), @FMetrics.lfCaptionFont);
GetObject(Font, SizeOf(FMetrics.lfStatusFont), @FMetrics.lfStatusFont);
GetObject(Font, SizeOf(FMetrics.lfMenuFont), @FMetrics.lfMenuFont);
end;
Mantis conversion info:
- Mantis ID: 15058
- Version: 0.9.28
- Fixed in version: 0.9.29 (SVN)
- Fixed in revision: 22531 (#11030318)