diff options
| author | Jason Rumney | 2008-04-04 23:05:43 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-04-04 23:05:43 +0000 |
| commit | 388c38f9b30c5f8dbf21b3dac0179cd37d8432b2 (patch) | |
| tree | 679db645c1284df182c924de808bc8272ee54f0d /src | |
| parent | 7cd25617fee4882e2cb918166a181d89ecdf3ee6 (diff) | |
| download | emacs-388c38f9b30c5f8dbf21b3dac0179cd37d8432b2.tar.gz emacs-388c38f9b30c5f8dbf21b3dac0179cd37d8432b2.zip | |
(w32font_text_extents): Use font's ascent and descent.
(recompute_cached_metrics): Don't set ascent and descent per char.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32font.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/w32font.c b/src/w32font.c index 4ee618085ea..866b86e2287 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -378,8 +378,8 @@ w32font_text_extents (font, code, nglyphs, metrics) | |||
| 378 | transform.eM11.value = 1; | 378 | transform.eM11.value = 1; |
| 379 | transform.eM22.value = 1; | 379 | transform.eM22.value = 1; |
| 380 | metrics->width = 0; | 380 | metrics->width = 0; |
| 381 | metrics->ascent = 0; | 381 | metrics->ascent = font->ascent; |
| 382 | metrics->descent = 0; | 382 | metrics->descent = font->descent; |
| 383 | metrics->lbearing = 0; | 383 | metrics->lbearing = 0; |
| 384 | 384 | ||
| 385 | for (i = 0; i < nglyphs; i++) | 385 | for (i = 0; i < nglyphs; i++) |
| @@ -399,8 +399,6 @@ w32font_text_extents (font, code, nglyphs, metrics) | |||
| 399 | metrics->rbearing = max (metrics->rbearing, | 399 | metrics->rbearing = max (metrics->rbearing, |
| 400 | metrics->width + char_metric->rbearing); | 400 | metrics->width + char_metric->rbearing); |
| 401 | metrics->width += char_metric->width; | 401 | metrics->width += char_metric->width; |
| 402 | metrics->ascent = max (metrics->ascent, char_metric->ascent); | ||
| 403 | metrics->descent = max (metrics->descent, char_metric->descent); | ||
| 404 | } | 402 | } |
| 405 | else | 403 | else |
| 406 | { | 404 | { |
| @@ -422,11 +420,6 @@ w32font_text_extents (font, code, nglyphs, metrics) | |||
| 422 | new_val = metrics->width + gm.gmptGlyphOrigin.x; | 420 | new_val = metrics->width + gm.gmptGlyphOrigin.x; |
| 423 | metrics->lbearing = min (metrics->lbearing, new_val); | 421 | metrics->lbearing = min (metrics->lbearing, new_val); |
| 424 | metrics->width += gm.gmCellIncX; | 422 | metrics->width += gm.gmCellIncX; |
| 425 | new_val = gm.gmBlackBoxY; | ||
| 426 | metrics->ascent = max (metrics->ascent, new_val); | ||
| 427 | new_val = (gm.gmCellIncY - gm.gmptGlyphOrigin.y | ||
| 428 | - gm.gmBlackBoxY); | ||
| 429 | metrics->descent = max (metrics->descent, new_val); | ||
| 430 | } | 423 | } |
| 431 | else | 424 | else |
| 432 | { | 425 | { |
| @@ -505,8 +498,6 @@ w32font_text_extents (font, code, nglyphs, metrics) | |||
| 505 | if (metrics) | 498 | if (metrics) |
| 506 | { | 499 | { |
| 507 | metrics->width = total_width; | 500 | metrics->width = total_width; |
| 508 | metrics->ascent = font->ascent; | ||
| 509 | metrics->descent = font->descent; | ||
| 510 | metrics->lbearing = 0; | 501 | metrics->lbearing = 0; |
| 511 | metrics->rbearing = total_width | 502 | metrics->rbearing = total_width |
| 512 | + ((struct w32font_info *) font)->metrics.tmOverhang; | 503 | + ((struct w32font_info *) font)->metrics.tmOverhang; |
| @@ -1842,9 +1833,6 @@ recompute_cached_metrics (dc, w32_font) | |||
| 1842 | char_metric->lbearing = gm.gmptGlyphOrigin.x; | 1833 | char_metric->lbearing = gm.gmptGlyphOrigin.x; |
| 1843 | char_metric->rbearing = gm.gmBlackBoxX + gm.gmptGlyphOrigin.x; | 1834 | char_metric->rbearing = gm.gmBlackBoxX + gm.gmptGlyphOrigin.x; |
| 1844 | char_metric->width = gm.gmCellIncX; | 1835 | char_metric->width = gm.gmCellIncX; |
| 1845 | char_metric->ascent = gm.gmBlackBoxY; | ||
| 1846 | char_metric->descent = (gm.gmCellIncY - gm.gmptGlyphOrigin.y | ||
| 1847 | - gm.gmBlackBoxY); | ||
| 1848 | } | 1836 | } |
| 1849 | else | 1837 | else |
| 1850 | char_metric->width = 0; | 1838 | char_metric->width = 0; |