[cairo-commit] cairo/src cairo-win32-font.c,1.40,1.41
Tor Lillqvist
commit at pdx.freedesktop.org
Mon Sep 26 07:48:12 PDT 2005
Committed by: tml
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv23873/src
Modified Files:
cairo-win32-font.c
Log Message:
2005-09-26 Tor Lillqvist <tml at novell.com>
* src/cairo-win32-font.c (_win32_scaled_font_get_scaled_hfont),
(_win32_scaled_font_get_unscaled_hfont): Set LOGFONT::lfHeight
negative. A negative lfHeight means "em height" which is what we
want, and matches how other toolkits interpret font sizes on
Win32. (Positive lfHeight means "cell height".) (#4593)
(_cairo_win32_scaled_font_init_glyph_metrics): If
GetGlyphOutlineW() fails, print error message and set metrics to
zero. (#3927, Hans Breuer)
(cairo_win32_scaled_font_select_font): Add detail on what API
failed to the error messages.
Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cairo-win32-font.c 1 Sep 2005 02:11:22 -0000 1.40
+++ cairo-win32-font.c 26 Sep 2005 14:48:10 -0000 1.41
@@ -344,7 +344,7 @@
{
if (!scaled_font->scaled_hfont) {
LOGFONTW logfont = scaled_font->logfont;
- logfont.lfHeight = scaled_font->logical_size;
+ logfont.lfHeight = -scaled_font->logical_size;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
@@ -399,7 +399,7 @@
free (otm);
logfont = scaled_font->logfont;
- logfont.lfHeight = scaled_font->em_square;
+ logfont.lfHeight = -scaled_font->em_square;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
@@ -744,9 +744,12 @@
status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
if (status)
return status;
- GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
- GGO_METRICS | GGO_GLYPH_INDEX,
- &metrics, 0, NULL, &matrix);
+ if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
+ GGO_METRICS | GGO_GLYPH_INDEX,
+ &metrics, 0, NULL, &matrix) == GDI_ERROR) {
+ status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
+ memset (&metrics, 0, sizeof (GLYPHMETRICS));
+ }
cairo_win32_scaled_font_done_font (&scaled_font->base);
if (scaled_font->swap_axes) {
@@ -780,9 +783,12 @@
* of the font.
*/
status = _cairo_win32_scaled_font_select_unscaled_font (&scaled_font->base, hdc);
- GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
- GGO_METRICS | GGO_GLYPH_INDEX,
- &metrics, 0, NULL, &matrix);
+ if (GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
+ GGO_METRICS | GGO_GLYPH_INDEX,
+ &metrics, 0, NULL, &matrix) == GDI_ERROR) {
+ status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
+ memset (&metrics, 0, sizeof (GLYPHMETRICS));
+ }
_cairo_win32_scaled_font_done_unscaled_font (&scaled_font->base);
extents.x_bearing = (double)metrics.gmptGlyphOrigin.x / scaled_font->em_square;
@@ -1456,11 +1462,11 @@
old_hfont = SelectObject (hdc, hfont);
if (!old_hfont)
- return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font");
+ return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font:SelectObject");
old_mode = SetGraphicsMode (hdc, GM_ADVANCED);
if (!old_mode) {
- status = _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font");
+ status = _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font:SetGraphicsMode");
SelectObject (hdc, old_hfont);
return status;
}
More information about the cairo-commit
mailing list