From 1fed8f12887a57a1fdb9c790bb359e8fa9c05e26 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Fri, 19 Mar 2010 15:16:35 -0700 Subject: [PATCH] generate correct left side bearings --- lib/gfxfont.c | 1 + lib/ttf.c | 4 ++-- lib/ttf.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/gfxfont.c b/lib/gfxfont.c index 760db9a..acc8e34 100644 --- a/lib/gfxfont.c +++ b/lib/gfxfont.c @@ -665,6 +665,7 @@ ttf_t* gfxfont_to_ttf(gfxfont_t*font) } } + dest->bearing = dest->xmin; dest->advance = src->advance*scale; int u = font->glyphs[t].unicode; diff --git a/lib/ttf.c b/lib/ttf.c index 69cd3f1..fbbf200 100644 --- a/lib/ttf.c +++ b/lib/ttf.c @@ -849,10 +849,10 @@ static int mtx_write(ttf_t*ttf, ttf_table_t*w) int t; for(t=0;tglyphs[t].advance); - writeU16(w, ttf->glyphs[t].bearing); + writeS16(w, ttf->glyphs[t].bearing); } for(;tnum_glyphs;t++) { - writeU16(w, ttf->glyphs[t].bearing); + writeS16(w, ttf->glyphs[t].bearing); } return num_advances; } diff --git a/lib/ttf.h b/lib/ttf.h index 8d5ea61..e5462e9 100644 --- a/lib/ttf.h +++ b/lib/ttf.h @@ -122,7 +122,7 @@ typedef struct _ttfpoint { } ttfpoint_t; typedef struct _ttfglyph { U16 advance; - U16 bearing; + S16 bearing; S16 xmin,ymin,xmax,ymax; int code_size; U8*code; -- 1.7.10.4