summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2014-02-11 15:58:14 +0000
committerOleg Oshmyan <chortos@inbox.lv>2014-02-11 16:51:24 +0000
commit502c29e6d7f0deef67a0b7a806b699b6aaefa67c (patch)
treed00f2bb2c3ae95df2db1cb83a1af7d361bbd2818
parentd72fdb66f426cd7fbd05ab93d1470dabe92a4bd4 (diff)
downloadlibass-502c29e6d7f0deef67a0b7a806b699b6aaefa67c.tar.bz2
libass-502c29e6d7f0deef67a0b7a806b699b6aaefa67c.tar.xz
Font metrics: FreeType falls back to sTypoAscender/Descender
Fixes libass#8.
-rw-r--r--libass/ass_font.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c
index dd275c1..c9761a8 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -236,12 +236,16 @@ void ass_face_set_size(FT_Face face, double size)
FT_Size_Metrics *m = &face->size->metrics;
// VSFilter uses metrics from TrueType OS/2 table
// The idea was borrowed from asa (http://asa.diac24.net)
- if (hori && os2) {
- int hori_height = hori->Ascender - hori->Descender;
+ if (os2) {
+ int ft_height = 0;
+ if (hori)
+ ft_height = hori->Ascender - hori->Descender;
+ if (!ft_height)
+ ft_height = os2->sTypoAscender - os2->sTypoDescender;
/* sometimes used for signed values despite unsigned in spec */
int os2_height = (short)os2->usWinAscent + (short)os2->usWinDescent;
- if (hori_height && os2_height)
- mscale = (double) hori_height / os2_height;
+ if (ft_height && os2_height)
+ mscale = (double) ft_height / os2_height;
}
memset(&rq, 0, sizeof(rq));
rq.type = FT_SIZE_REQUEST_TYPE_REAL_DIM;