[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/w32font.c,v
From: |
Jason Rumney |
Subject: |
[Emacs-diffs] Changes to emacs/src/w32font.c,v |
Date: |
Sun, 24 Feb 2008 15:07:47 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Jason Rumney <jasonr> 08/02/24 15:07:46
Index: w32font.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32font.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- w32font.c 6 Feb 2008 22:35:30 -0000 1.7
+++ w32font.c 24 Feb 2008 15:07:46 -0000 1.8
@@ -290,8 +290,8 @@
struct font_metrics *metrics;
{
int i;
- HFONT old_font;
- HDC dc;
+ HFONT old_font = NULL;
+ HDC dc = NULL;
struct frame * f;
int total_width = 0;
WORD *wcode = alloca(nglyphs * sizeof (WORD));
@@ -302,9 +302,6 @@
until the API is updated to pass in a frame. */
f = XFRAME (selected_frame);
- dc = get_frame_dc (f);
- old_font = SelectObject (dc, ((W32FontStruct *)(font->font.font))->hfont);
-
if (metrics)
{
GLYPHMETRICS gm;
@@ -339,7 +336,15 @@
metrics->ascent = max (metrics->ascent, char_metric->ascent);
metrics->descent = max (metrics->descent, char_metric->descent);
}
- else if (GetGlyphOutlineW (dc, *(code + i), GGO_METRICS, &gm, 0,
+ else
+ {
+ if (dc == NULL)
+ {
+ dc = get_frame_dc (f);
+ old_font = SelectObject (dc, ((W32FontStruct *)
+ (font->font.font))->hfont);
+ }
+ if (GetGlyphOutlineW (dc, *(code + i), GGO_METRICS, &gm, 0,
NULL, &transform) != GDI_ERROR)
{
int new_val = metrics->width + gm.gmBlackBoxX
@@ -359,13 +364,17 @@
break;
}
}
+ }
/* If we got through everything, return. */
if (i == nglyphs)
{
+ if (dc != NULL)
+ {
/* Restore state and release DC. */
SelectObject (dc, old_font);
release_frame_dc (f, dc);
+ }
return metrics->width;
}
@@ -382,6 +391,13 @@
}
}
+ if (dc == NULL)
+ {
+ dc = get_frame_dc (f);
+ old_font = SelectObject (dc, ((W32FontStruct *)
+ (font->font.font))->hfont);
+ }
+
if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size))
{
total_width = size.cx;
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Glenn Morris, 2008/02/01
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Jason Rumney, 2008/02/03
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Jason Rumney, 2008/02/04
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Jason Rumney, 2008/02/05
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Jason Rumney, 2008/02/06
- [Emacs-diffs] Changes to emacs/src/w32font.c,v,
Jason Rumney <=
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Kenichi Handa, 2008/02/24
- [Emacs-diffs] Changes to emacs/src/w32font.c,v, Jason Rumney, 2008/02/25