View Issue Details

IDProjectCategoryView StatusLast Update
0015058LazarusWidgetsetpublic2011-12-01 11:22
ReporterPaul van HeldenAssigned ToFelipe Monteiro de Carvalho 
PrioritynormalSeveritytrivialReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.28Product Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0015058: No default fonts are initialized on WinCE (Windows Mobile 6.1)
DescriptionWindows.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 InformationFix 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;
TagsNo tags attached.
Fixed in Revision22531
LazTarget-
WidgetsetWinCE
Attached Files

Relationships

parent of 0015062 closedYuriy Sydorov FPC Please remove DEFAULT_GUI_FONT from Windows CE RTL 

Activities

Felipe Monteiro de Carvalho

2009-11-11 17:35

developer   ~0032054

Thanks, well spotted. I applied a fix equivalent to your proposed changes. Please test and close if working correct now.

Issue History

Date Modified Username Field Change
2009-11-11 10:14 Paul van Helden New Issue
2009-11-11 10:14 Paul van Helden Widgetset => WinCE
2009-11-11 12:01 Felipe Monteiro de Carvalho Status new => assigned
2009-11-11 12:01 Felipe Monteiro de Carvalho Assigned To => Felipe Monteiro de Carvalho
2009-11-11 17:22 Felipe Monteiro de Carvalho Relationship added parent of 0015062
2009-11-11 17:35 Felipe Monteiro de Carvalho Fixed in Revision => 22531
2009-11-11 17:35 Felipe Monteiro de Carvalho LazTarget => -
2009-11-11 17:35 Felipe Monteiro de Carvalho Status assigned => resolved
2009-11-11 17:35 Felipe Monteiro de Carvalho Fixed in Version => 0.9.29 (SVN)
2009-11-11 17:35 Felipe Monteiro de Carvalho Resolution open => fixed
2009-11-11 17:35 Felipe Monteiro de Carvalho Note Added: 0032054
2011-12-01 11:22 Marc Weustink Status resolved => closed