summaryrefslogtreecommitdiff
path: root/pango/pangowin32.c
diff options
context:
space:
mode:
authorHans Breuer <hans@breuer.org>2001-08-09 23:40:54 +0000
committerHans Breuer <hans@src.gnome.org>2001-08-09 23:40:54 +0000
commit20cd4088fe5bab1cde436ab572a0cc8b38cb7418 (patch)
tree5086639592b55020d4029042ac6d8514742e9650 /pango/pangowin32.c
parent8634415d0e761d18210e54fb045f7b4af07bf046 (diff)
downloadpango-20cd4088fe5bab1cde436ab572a0cc8b38cb7418.tar.gz
restore the previously selected font into the device context.
2001-08-10 Hans Breuer <hans@breuer.org> * pango/pangowin32.c (pango_win32_render) : restore the previously selected font into the device context. (pango_win32_font_get_glyph_extents) : info->ink_rect.y needs to be negative to get underlines right * pango/pangowin32-fontmap.c (pango_win32_font_map_list_fonts) : Don't g_assert_not_reached () on !family case. This is what the X version does as well. Testcase for win32: testfonts.c * pango/testfonts.c : (new file) simple test program for win32 which renders all or selected fonts into a bitmap * pango/makefile.msc : re-enable testfonts compiling
Diffstat (limited to 'pango/pangowin32.c')
-rw-r--r--pango/pangowin32.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 2e83aafb..3d04fb29 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -99,7 +99,7 @@ pango_win32_get_hfont (PangoFont *font)
SelectObject (pango_win32_hdc, win32font->hfont);
GetTextMetrics (pango_win32_hdc, &tm);
-
+
win32font->tm_overhang = tm.tmOverhang;
win32font->tm_descent = tm.tmDescent;
win32font->tm_ascent = tm.tmAscent;
@@ -246,7 +246,7 @@ pango_win32_render (HDC hdc,
if (!hfont)
return;
- hfont = SelectObject (hdc, hfont);
+ old_hfont = SelectObject (hdc, hfont);
glyph_indexes = g_new (guint16, glyphs->num_glyphs);
dX = g_new (INT, glyphs->num_glyphs);
@@ -263,6 +263,7 @@ pango_win32_render (HDC hdc,
glyph_indexes, glyphs->num_glyphs,
dX);
+ SelectObject (hdc, old_hfont); /* restore */
g_free (glyph_indexes);
g_free (dX);
}
@@ -320,7 +321,7 @@ pango_win32_font_get_glyph_extents (PangoFont *font,
info->ink_rect.x = PANGO_SCALE * gm.gmptGlyphOrigin.x;
info->ink_rect.width = PANGO_SCALE * gm.gmBlackBoxX;
- info->ink_rect.y = PANGO_SCALE * gm.gmptGlyphOrigin.y;
+ info->ink_rect.y = - PANGO_SCALE * gm.gmptGlyphOrigin.y;
info->ink_rect.height = PANGO_SCALE * gm.gmBlackBoxY;
info->logical_rect.x = 0;
@@ -360,6 +361,7 @@ pango_win32_font_get_metrics (PangoFont *font,
{
SelectObject (pango_win32_hdc, hfont);
GetTextMetrics (pango_win32_hdc, &tm);
+
metrics->ascent = tm.tmAscent * PANGO_SCALE;
metrics->descent = tm.tmDescent * PANGO_SCALE;
metrics->approximate_digit_width = /* really an approximation ... */