summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Zimmermann <madroach@gmerlin.de>2020-05-31 07:58:10 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2020-09-22 22:00:38 +0000
commitde8068f9c4251fb6cb9407c07bf245e1937270bc (patch)
tree887e9fcbfe02fbcefd39199c61246e5d1d09f68e
parent7096c58f3fe3b6c79508cb16daac5c5bb2f042e7 (diff)
don't add arbitrary number to the glypth metrics
This caused pango to calculate wrong, too large font extents and in consequence gvim used too large character cells.
-rw-r--r--struct.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/struct.c b/struct.c
index 294f498..bcb07ba 100644
--- a/struct.c
+++ b/struct.c
@@ -453,7 +453,7 @@ glyphMetrics(FontPtr font, int code,
if(bitmap) {
if(width_return)
*width_return =
- (((float)bitmap->advanceWidth + 0.5) / strike->sizeX) *
+ (((float)bitmap->advanceWidth) / strike->sizeX) *
TWO_SIXTEENTH;
if(x_min_return)
*x_min_return =
@@ -463,17 +463,13 @@ glyphMetrics(FontPtr font, int code,
*y_min_return =
(((float)bitmap->horiBearingY - bitmap->height)
/ strike->sizeY) * TWO_SIXTEENTH;
- /* For the following two, 0.9 instead of 0.5 might make
- more sense. However, using different rounding rules
- for x_max and awidth causes problems for detecting
- charcell fonts. */
if(x_max_return)
*x_max_return =
- (((float)bitmap->horiBearingX + bitmap->width + 0.5)
+ (((float)bitmap->horiBearingX + bitmap->width)
/ strike->sizeX) * TWO_SIXTEENTH;
if(y_max_return)
*y_max_return =
- (((float)bitmap->horiBearingY + 0.5) / strike->sizeY) *
+ (((float)bitmap->horiBearingY) / strike->sizeY) *
TWO_SIXTEENTH;
return 1;
}