View Issue Details

IDProjectCategoryView StatusLast Update
0022526LazarusPatchpublic2012-08-01 08:46
ReporterG. Zakrzewski Assigned ToMaxim Ganetsky  
Status closedResolutionfixed 
Product Version1.1 (SVN) 
Fixed in Version1.1 (SVN) 
Summary0022526: Times New Roman font ignored under Gtk2
DescriptionI have installed this font in may Ubuntu system and can use it in other Gtk2 applications but not Lazarus.
Steps To ReproduceJust set Font.Name property of a label control to 'Times New Roman' and see its caption is actually rendered using the default (if different than Times New Roman) font.
Additional InformationThe patch attached solves the problem.
TagsNo tags attached.
Fixed in Revision38090
WidgetsetGTK 2
Attached Files


related to 0021775 resolvedJuha Manninen Font with number in name gets wrong size 


2012-07-29 15:21


TimesNewRoman.patch (527 bytes)   
Index: lcl/interfaces/gtk2/
--- lcl/interfaces/gtk2/	(wersja 38061)
+++ lcl/interfaces/gtk2/	(kopia robocza)
@@ -1454,7 +1454,7 @@
         FullString := '';
-      FullString := AFamily + ' ' + aStyle + ' ' + FullString;
+      FullString := AFamily + ', ' + aStyle + ' ' + FullString;
       PangoDesc := pango_font_description_from_string(PChar(FullString));
       if lfWeight <> FW_DONTCARE then
TimesNewRoman.patch (527 bytes)   

Maxim Ganetsky

2012-07-29 17:37

developer   ~0061280

Applied, thanks.

Please test and close if ok.

G. Zakrzewski

2012-07-31 14:19

reporter   ~0061321

After deeper investigation, I found the 'culprit' is the word 'Roman' which is the name of a font style used by Pango. LongFontName 'Times New Roman' passed to function CreateFontIndirectEx was thus interpreted as a nonexistent 'Times New' font with style Roman. What the patch changed is adding a comma to the name so it gets the form 'Times New Roman,' and does not confuse function pango_font_description_from_string (comma indicates the end of the font family name).

This however prevents passing font names containing style information of the form 'Courier New Bold' as 'Courier New Bold,' means font with family name 'Courier New Bold' which does not exist.

The dillema can be solved by either a) withdrawing the patch and tell programmers to always set TFont.Name := 'Times New Roman, [style] [size]' when they want to use the font even if [style] and [size] are empty (the name ends with comma then), or b) leave the change and, except for XLFD fonts, forget passing and parsing complex LongFontNames under Gtk2.

I think b) is the right choice as it also solves potential problems with font family names of the form 'Bla 2012' passed allone in which case 2012 would be interpreted as the font size.

See also cobines suggestion in his 0059493 note to ticket 0021775.

Issue History

Date Modified Username Field Change
2012-07-29 15:21 G. Zakrzewski New Issue
2012-07-29 15:21 G. Zakrzewski File Added: TimesNewRoman.patch
2012-07-29 15:21 G. Zakrzewski Widgetset => GTK 2
2012-07-29 17:37 Maxim Ganetsky Fixed in Revision => 38090
2012-07-29 17:37 Maxim Ganetsky LazTarget => -
2012-07-29 17:37 Maxim Ganetsky Status new => resolved
2012-07-29 17:37 Maxim Ganetsky Fixed in Version => 1.1 (SVN)
2012-07-29 17:37 Maxim Ganetsky Resolution open => fixed
2012-07-29 17:37 Maxim Ganetsky Assigned To => Maxim Ganetsky
2012-07-29 17:37 Maxim Ganetsky Note Added: 0061280
2012-07-30 17:14 Juha Manninen Relationship added related to 0021775
2012-07-31 14:19 G. Zakrzewski Note Added: 0061321
2012-08-01 08:46 G. Zakrzewski Status resolved => closed