GNOME Bugzilla – Bug 119081
Allow font size specification in pixels
Last modified: 2004-12-22 21:47:04 UTC
In some apps, specifying a particular pixel size of font is necessary - for such apps having a: pango_font_description_set_absolute_size() that took pixels/PANGO_SCALE for screen, points/PANGO_SCALE for PS (that is, the same units as the extents) would be useful The alternative would be something like: pango_context_get_dpi() to allow getting the DPI number that is being used to convert points to pixels.
FWIW, it may be a good idea to be able to retrieve the dpi on each axis. Most displays have the same resolution on both axis, but I think that some of them support different resolutions on X than on Y. Also, I don't see both functions (pango_font_description_set_absolute_size() and pango_context_get_dpi ()) as exclusive. It makes sense to me to have both of them, even if it's not strictly need. Cheers,
Created attachment 29494 [details] [review] Adds the ability to set pixel sizes. Doesn't implement this on windows, but windows will still compile and work. It'll just ignore the size_is_absolute flag.
Created attachment 29657 [details] [review] Adds the ability to set pixel size. Fixed missing glyph drawing, but still doesn't get the size right on windows.
Got lost on future milestone. Definitely for 1.8.
Applied with some changes: - Decided after all to go with the non-paired pango_font_description_set_absolute_size() / pango_font_description_get_size_is_absolute() - setting the size and then saying "oh, yeah, that size was absolute" seems odd to me. - Dropped the handling of FC_PIXEL_SIZE in pango_fc_font_description_from_pattern(); don't think it's clear enough how that would interact. Documented that it is ignored. - Implemented simply for Win32 (just convert pixels => points before calling pango_win32_font_new()) - Doc improvements - pango_attr_size_absolute_new() => pango_attr_size_new_absolute() - Added Since: 1.8 annotations - Added some temporary variables to deal with huge line lengths - Use indentation as documented in docs/TEXT/coding-style === Wed Dec 15 22:09:42 2004 Owen Taylor <otaylor@redhat.com> Add pixel sizes for fonts (#119081, patch from Chris Lahey) * pango/fonts.c pango/pango-font.h: Add pango_font_description_set_absolute_size(), pango_font_description_get_size_is_absolute() * pango/pango-attributes.[ch]: Add pango_attr_size_new_absolute(), change PANGO_ATTR_SIZE from PangoAttrInt to PangoAttrSize (preserves compat because first component is identical) * pango/pangowin32-fontmap.c (pango_win32_font_map_load_font): For absolute sizes, convert pixels to points, before calling pango_win32_font_new(). * pango/pangofc-fontmap.c pango/pangoft2.c pango/pangoxft-font.c: Handle absolute sizes.
Created attachment 34884 [details] [review] Patch as applied