aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2008-03-03 01:49:33 +0000
committerJason Rumney2008-03-03 01:49:33 +0000
commit54efdcd13333e758aa61c6a6082168397efb4b18 (patch)
tree411612d3f3ab2e3b446c0099b6bd878c7180dbb5 /src
parent34fd2d28e93778b6220719d8e1780ca1304c240d (diff)
downloademacs-54efdcd13333e758aa61c6a6082168397efb4b18.tar.gz
emacs-54efdcd13333e758aa61c6a6082168397efb4b18.zip
(recompute_cached_metrics): Change font arg to w32font_info.
Compute options separately. (w32font_open_internal): Set glyph_idx before caching metrics.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/w32font.c27
2 files changed, 18 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 01436686571..a302a14d288 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12008-03-03 Jason Rumney <jasonr@gnu.org> 12008-03-03 Jason Rumney <jasonr@gnu.org>
2 2
3 * w32font.c (recompute_cached_metrics): Change font arg to w32font_info.
4 Compute options separately.
5 (w32font_open_internal): Set glyph_idx before caching metrics.
6
3 * w32font.h (NTM_PS_OPENTYPE, NTM_TT_OPENTYPE, NTM_TYPE1): Define 7 * w32font.h (NTM_PS_OPENTYPE, NTM_TT_OPENTYPE, NTM_TYPE1): Define
4 if system headers don't. 8 if system headers don't.
5 (struct w32font_info): Enlarge ascii_metrics. Add glyph_idx. 9 (struct w32font_info): Enlarge ascii_metrics. Add glyph_idx.
diff --git a/src/w32font.c b/src/w32font.c
index b5aa29d37b2..7c7b9faa045 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -80,7 +80,7 @@ static Lisp_Object lispy_antialias_type P_ ((BYTE type));
80static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE * sig)); 80static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE * sig));
81static int w32font_full_name P_ ((LOGFONT * font, Lisp_Object font_obj, 81static int w32font_full_name P_ ((LOGFONT * font, Lisp_Object font_obj,
82 int pixel_size, char *name, int nbytes)); 82 int pixel_size, char *name, int nbytes));
83static void recompute_cached_metrics P_ ((HDC dc, struct font * font)); 83static void recompute_cached_metrics P_ ((HDC dc, struct w32font_info * font));
84 84
85static Lisp_Object w32_registry P_ ((LONG w32_charset)); 85static Lisp_Object w32_registry P_ ((LONG w32_charset));
86 86
@@ -324,7 +324,7 @@ w32font_encode_char (font, c)
324 /* Mark this font as not supporting glyph indices. This can happen 324 /* Mark this font as not supporting glyph indices. This can happen
325 on Windows9x, and maybe with non-Truetype fonts on NT etc. */ 325 on Windows9x, and maybe with non-Truetype fonts on NT etc. */
326 w32_font->glyph_idx = 0; 326 w32_font->glyph_idx = 0;
327 recompute_cached_metrics (dc, font); 327 recompute_cached_metrics (dc, w32_font);
328 328
329 return c; 329 return c;
330 } 330 }
@@ -426,7 +426,7 @@ w32font_text_extents (font, code, nglyphs, metrics)
426 any problems should be caught when initialising the 426 any problems should be caught when initialising the
427 metrics cache. */ 427 metrics cache. */
428 w32_font->glyph_idx = 0; 428 w32_font->glyph_idx = 0;
429 recompute_cached_metrics (dc, font); 429 recompute_cached_metrics (dc, w32_font);
430 SelectObject (dc, old_font); 430 SelectObject (dc, old_font);
431 release_frame_dc (f, dc); 431 release_frame_dc (f, dc);
432 return 0; 432 return 0;
@@ -781,12 +781,12 @@ w32font_open_internal (f, font_entity, pixel_size, w32_font)
781 GetTextMetrics (dc, &w32_font->metrics); 781 GetTextMetrics (dc, &w32_font->metrics);
782 782
783 /* Cache ASCII metrics. */ 783 /* Cache ASCII metrics. */
784 recompute_cached_metrics (dc, font); 784 w32_font->glyph_idx = ETO_GLYPH_INDEX;
785 recompute_cached_metrics (dc, w32_font);
786
785 SelectObject (dc, old_font); 787 SelectObject (dc, old_font);
786 release_frame_dc (f, dc); 788 release_frame_dc (f, dc);
787 789
788 w32_font->glyph_idx = ETO_GLYPH_INDEX;
789
790 /* W32FontStruct - we should get rid of this, and use the w32font_info 790 /* W32FontStruct - we should get rid of this, and use the w32font_info
791 struct for any W32 specific fields. font->font.font can then be hfont. */ 791 struct for any W32 specific fields. font->font.font can then be hfont. */
792 font->font.font = xmalloc (sizeof (W32FontStruct)); 792 font->font.font = xmalloc (sizeof (W32FontStruct));
@@ -1702,14 +1702,13 @@ w32font_full_name (font, font_obj, pixel_size, name, nbytes)
1702 1702
1703 1703
1704static void 1704static void
1705recompute_cached_metrics (dc, font) 1705recompute_cached_metrics (dc, w32_font)
1706 HDC dc; 1706 HDC dc;
1707 struct font *font; 1707 struct w32font_info *w32_font;
1708{ 1708{
1709 GLYPHMETRICS gm; 1709 GLYPHMETRICS gm;
1710 MAT2 transform; 1710 MAT2 transform;
1711 int i; 1711 unsigned int i;
1712 struct w32font_info *w32_font;
1713 1712
1714 bzero (&transform, sizeof (transform)); 1713 bzero (&transform, sizeof (transform));
1715 transform.eM11.value = 1; 1714 transform.eM11.value = 1;
@@ -1718,10 +1717,12 @@ recompute_cached_metrics (dc, font)
1718 for (i = 0; i < 128; i++) 1717 for (i = 0; i < 128; i++)
1719 { 1718 {
1720 struct font_metrics* char_metric = &w32_font->ascii_metrics[i]; 1719 struct font_metrics* char_metric = &w32_font->ascii_metrics[i];
1720 unsigned int options = GGO_METRICS;
1721 if (w32_font->glyph_idx)
1722 options |= GGO_GLYPH_INDEX;
1721 1723
1722 if (GetGlyphOutlineW (dc, i + 32, GGO_METRICS 1724 if (GetGlyphOutlineW (dc, i, options, &gm, 0, NULL, &transform)
1723 | w32_font->glyph_idx ? GGO_GLYPH_INDEX : 0, 1725 != GDI_ERROR)
1724 &gm, 0, NULL, &transform) != GDI_ERROR)
1725 { 1726 {
1726 char_metric->lbearing = -gm.gmptGlyphOrigin.x; 1727 char_metric->lbearing = -gm.gmptGlyphOrigin.x;
1727 char_metric->rbearing = gm.gmBlackBoxX + gm.gmptGlyphOrigin.x; 1728 char_metric->rbearing = gm.gmBlackBoxX + gm.gmptGlyphOrigin.x;