summaryrefslogtreecommitdiff
path: root/src/macfont.m
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-08-25 11:00:42 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-08-25 11:00:42 +0400
commit8661ebaa6c0ef3f9517c5288855657b274c723d6 (patch)
tree98c72571f410d28d3228cb30ea68dadf49f36860 /src/macfont.m
parent90c5c87753fb69dafd664615558fa3fdce3ba5b1 (diff)
downloademacs-8661ebaa6c0ef3f9517c5288855657b274c723d6.tar.gz
One more minor cleanup of font subsystem.
* font.h (struct font_driver): Convert text_extents to return void because returned value is never actually used. * macfont.c (macfont_text_extents): * w32font.c (w32font_text_extents): * xftfont.c (xftfont_text_extents): Adjust to return void and assume that 'metrics' argument is always non-NULL. * ftfont.c (ftfont_text_extents): * xfont.c (xfont_text_extents): Likewise. Avoid redundant memset.
Diffstat (limited to 'src/macfont.m')
-rw-r--r--src/macfont.m39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/macfont.m b/src/macfont.m
index 0d702873220..4bc58229d6e 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1553,8 +1553,8 @@ static Lisp_Object macfont_open (struct frame *, Lisp_Object, int);
static void macfont_close (struct font *);
static int macfont_has_char (Lisp_Object, int);
static unsigned macfont_encode_char (struct font *, int);
-static int macfont_text_extents (struct font *, unsigned int *, int,
- struct font_metrics *);
+static void macfont_text_extents (struct font *, unsigned int *, int,
+ struct font_metrics *);
static int macfont_draw (struct glyph_string *, int, int, int, int, bool);
static Lisp_Object macfont_shape (Lisp_Object);
static int macfont_variation_glyphs (struct font *, int c,
@@ -2653,9 +2653,9 @@ macfont_encode_char (struct font *font, int c)
return glyph != kCGFontIndexInvalid ? glyph : FONT_INVALID_CODE;
}
-static int
-macfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
- struct font_metrics *metrics)
+static void
+macfont_text_extents (struct font *font, unsigned int *code,
+ int nglyphs, struct font_metrics *metrics)
{
int width, i;
@@ -2664,28 +2664,21 @@ macfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
for (i = 1; i < nglyphs; i++)
{
struct font_metrics m;
- int w = macfont_glyph_extents (font, code[i], metrics ? &m : NULL,
- NULL, 0);
-
- if (metrics)
- {
- if (width + m.lbearing < metrics->lbearing)
- metrics->lbearing = width + m.lbearing;
- if (width + m.rbearing > metrics->rbearing)
- metrics->rbearing = width + m.rbearing;
- if (m.ascent > metrics->ascent)
- metrics->ascent = m.ascent;
- if (m.descent > metrics->descent)
- metrics->descent = m.descent;
- }
+ int w = macfont_glyph_extents (font, code[i], &m, NULL, 0);
+
+ if (width + m.lbearing < metrics->lbearing)
+ metrics->lbearing = width + m.lbearing;
+ if (width + m.rbearing > metrics->rbearing)
+ metrics->rbearing = width + m.rbearing;
+ if (m.ascent > metrics->ascent)
+ metrics->ascent = m.ascent;
+ if (m.descent > metrics->descent)
+ metrics->descent = m.descent;
width += w;
}
unblock_input ();
- if (metrics)
- metrics->width = width;
-
- return width;
+ metrics->width = width;
}
static int