aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-06-04 21:26:03 +0000
committerJason Rumney2007-06-04 21:26:03 +0000
commit1065a502e9d916079a192da26b675a5b34dcc855 (patch)
tree638d9bddb098fc7901a19ec19b27c4d71b9e2b86 /src
parentdc1ce20e62e83aaf1df2b08d5e808cf0d10e2fb2 (diff)
downloademacs-1065a502e9d916079a192da26b675a5b34dcc855.tar.gz
emacs-1065a502e9d916079a192da26b675a5b34dcc855.zip
(w32font_open): Don't set font_idx.
(w32font_text_extents): Try GetTextExtentPoint32W before defaulting to font settings. (w32font_draw): Fill background explicitly.
Diffstat (limited to 'src')
-rw-r--r--src/w32font.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/w32font.c b/src/w32font.c
index b8b8e6a71d9..8f9350cdd96 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -273,7 +273,6 @@ w32font_open (f, font_entity, pixel_size)
273 bcopy (&w32_font->metrics, &compat_w32_font->tm, sizeof (TEXTMETRIC)); 273 bcopy (&w32_font->metrics, &compat_w32_font->tm, sizeof (TEXTMETRIC));
274 compat_w32_font->hfont = hfont; 274 compat_w32_font->hfont = hfont;
275 275
276 font->font.font_idx = 0;
277 len = strlen (logfont.lfFaceName); 276 len = strlen (logfont.lfFaceName);
278 font->font.name = (char *) xmalloc (len + 1); 277 font->font.name = (char *) xmalloc (len + 1);
279 bcopy (logfont.lfFaceName, font->font.name, len); 278 bcopy (logfont.lfFaceName, font->font.name, len);
@@ -425,6 +424,16 @@ w32font_text_extents (font, code, nglyphs, metrics)
425 metrics[i].ascent = -gm.gmptGlyphOrigin.y; 424 metrics[i].ascent = -gm.gmptGlyphOrigin.y;
426 metrics[i].descent = gm.gmBlackBoxY + gm.gmptGlyphOrigin.y; 425 metrics[i].descent = gm.gmBlackBoxY + gm.gmptGlyphOrigin.y;
427 } 426 }
427 else if (GetTextExtentPoint32W (dc, wcode + i, 1, &size)
428 != GDI_ERROR)
429 {
430 metrics[i].lbearing = 0;
431 metrics[i].rbearing = size.cx
432 + ((struct w32font_info *) font)->metrics.tmOverhang;
433 metrics[i].width = size.cx;
434 metrics[i].ascent = font->ascent;
435 metrics[i].descent = font->descent;
436 }
428 else 437 else
429 { 438 {
430 metrics[i].lbearing = 0; 439 metrics[i].lbearing = 0;
@@ -486,8 +495,15 @@ w32font_draw (s, from, to, x, y, with_background)
486 495
487 if (with_background) 496 if (with_background)
488 { 497 {
489 options = ETO_OPAQUE; 498 HBRUSH brush;
490 SetBkColor (s->hdc, s->gc->background); 499 RECT rect;
500
501 brush = CreateSolidBrush (s->gc->background);
502 rect.left = x;
503 rect.top = y - ((struct font *) (s->font_info->font))->ascent;
504 rect.right = x + s->width;
505 rect.bottom = y + ((struct font *) (s->font_info->font))->descent;
506 FillRect (s->hdc, &rect, brush);
491 } 507 }
492 else 508 else
493 SetBkMode (s->hdc, TRANSPARENT); 509 SetBkMode (s->hdc, TRANSPARENT);