When you get the font description with gtk_font_chooser_get_font
then sometimes the font size is given as a fractional value, e.g. “DejaVu Sans Mono 29.849609375”. It seems to happen only by using the slider in the GtkFontChooserDialog
, not by using plus/minus buttons. I guess that the raw value produced by the slider is used for generating the returned string. The gtk_font_chooser_get_font_size
returns an integer which (in my case) must be divided by PANGO_SCALE
: 30566 / 1024 = 29.849609375.
I can reproduce this only with older GTK3 versions, not with newer ones. So it seems to be rather a bug that was fixed. My problem is that I need to support all GTK3 versions starting from 3.10.
However, the old-fashioned GtkFontSelectionDialog
also allows using values with a fractional part in the field “Size” (and this is definitely not a bug).
So I would like to ask a more general question: Do fractional font size (point) values make sense? Should I try to round fractional values returned by GtkFileChooser
as described above?
I use font descriptions returned by GtkFontChooser
for styling, e.g.: “*{font:DejaVu Sans Mono 29.849609375;}”.