diff options
author | Tor Lillqvist <tml@novell.com> | 2005-09-22 15:00:39 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2005-09-22 15:00:39 +0000 |
commit | 9b9374594df6c1e58eea8be0c3b96f680316430e (patch) | |
tree | a987766a04bdd0268f7c21865d71bc90cbd8d14a /pango/pangocairo-win32font.c | |
parent | 070475029649c86d378cb12eb6def74c01b8acf4 (diff) | |
download | pango-9b9374594df6c1e58eea8be0c3b96f680316430e.tar.gz |
Move the calculation of dpi and size earlier. Use the size variable instad
2005-09-22 Tor Lillqvist <tml@novell.com>
* pango/pangocairo-win32font.c (_pango_cairo_win32_font_new): Move
the calculation of dpi and size earlier. Use the size variable
instad of isize when looking for a matching cached font. Isize was
supposed to be the same as size anyway. (Actually it was the same
only when LOGPIXELSY equalled 96 (which often is the default
value), see below.)
* pango/pangocairo-win32fontmap.c (pango_cairo_win32_font_map_init):
Set dpi to the LOGPIXELSY value instead of hardcoding 96.
* pango/Makefile.am (libpangocairo_1_0_la_LIBADD): Need WIN32_LIBS
now.
Diffstat (limited to 'pango/pangocairo-win32font.c')
-rw-r--r-- | pango/pangocairo-win32font.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/pango/pangocairo-win32font.c b/pango/pangocairo-win32font.c index 37136b06..e5d8dc0d 100644 --- a/pango/pangocairo-win32font.c +++ b/pango/pangocairo-win32font.c @@ -436,22 +436,33 @@ _pango_cairo_win32_font_new (PangoCairoWin32FontMap *cwfontmap, #ifdef USE_FACE_CACHED_FONTS PangoWin32FontMap *win32fontmap; GSList *tmp_list; - int isize; #endif g_return_val_if_fail (PANGO_IS_CAIRO_WIN32_FONT_MAP (cwfontmap), NULL); + size = (double) pango_font_description_get_size (desc) / PANGO_SCALE; + + if (context) + { + dpi = pango_cairo_context_get_resolution (context); + + if (dpi <= 0) + dpi = cwfontmap->dpi; + } + else + dpi = cwfontmap->dpi; + + if (!pango_font_description_get_size_is_absolute (desc)) + size *= dpi / 72.; + #ifdef USE_FACE_CACHED_FONTS win32fontmap = PANGO_WIN32_FONT_MAP (cwfontmap); - isize = pango_font_description_get_size (desc); - if (!pango_font_description_get_size_is_absolute (desc)) - isize = (int) 0.5 + (isize * PANGO_SCALE) / win32fontmap->resolution; tmp_list = face->cached_fonts; while (tmp_list) { win32font = tmp_list->data; - if (ABS (win32font->size- isize) < 2) + if (ABS (win32font->size - size * PANGO_SCALE) < 2) { g_object_ref (win32font); if (win32font->in_cache) @@ -474,21 +485,6 @@ _pango_cairo_win32_font_new (PangoCairoWin32FontMap *cwfontmap, face->cached_fonts = g_slist_prepend (face->cached_fonts, win32font); #endif - size = (double) pango_font_description_get_size (desc) / PANGO_SCALE; - - if (context) - { - dpi = pango_cairo_context_get_resolution (context); - - if (dpi <= 0) - dpi = cwfontmap->dpi; - } - else - dpi = cwfontmap->dpi; - - if (!pango_font_description_get_size_is_absolute (desc)) - size *= dpi / 72.; - /* FIXME: This is a pixel size, so not really what we want for describe(), * but it's what we need when computing the scale factor. */ |