summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-09-22 15:00:39 +0000
committerTor Lillqvist <tml@src.gnome.org>2005-09-22 15:00:39 +0000
commit9b9374594df6c1e58eea8be0c3b96f680316430e (patch)
treea987766a04bdd0268f7c21865d71bc90cbd8d14a /pango
parent070475029649c86d378cb12eb6def74c01b8acf4 (diff)
downloadpango-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')
-rw-r--r--pango/Makefile.am2
-rw-r--r--pango/pangocairo-win32font.c36
-rw-r--r--pango/pangocairo-win32fontmap.c2
3 files changed, 18 insertions, 22 deletions
diff --git a/pango/Makefile.am b/pango/Makefile.am
index 07811a0e..4f00c730 100644
--- a/pango/Makefile.am
+++ b/pango/Makefile.am
@@ -230,7 +230,7 @@ if HAVE_CAIRO_WIN32
libpangocairo_1_0_la_LDFLAGS += -export-symbols $(srcdir)/pangocairo.def
libpangocairo_1_0_la_DEPENDENCIES += pangocairo.def
-libpangocairo_1_0_la_LIBADD += libpangowin32-$(PANGO_API_VERSION).la
+libpangocairo_1_0_la_LIBADD += libpangowin32-$(PANGO_API_VERSION).la $(WIN32_LIBS)
libpangocairo_1_0_la_DEPENDENCIES += libpangowin32-$(PANGO_API_VERSION).la
libpangocairo_1_0_la_SOURCES += pangocairo-win32font.c pangocairo-win32fontmap.c pangocairo-win32.h
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.
*/
diff --git a/pango/pangocairo-win32fontmap.c b/pango/pangocairo-win32fontmap.c
index 51393efa..9449fda7 100644
--- a/pango/pangocairo-win32fontmap.c
+++ b/pango/pangocairo-win32fontmap.c
@@ -104,5 +104,5 @@ pango_cairo_win32_font_map_class_init (PangoCairoWin32FontMapClass *class)
static void
pango_cairo_win32_font_map_init (PangoCairoWin32FontMap *cwfontmap)
{
- cwfontmap->dpi = 96.0;
+ cwfontmap->dpi = GetDeviceCaps (pango_win32_get_dc (), LOGPIXELSY);
}