diff options
author | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-08-03 15:39:38 +0000 |
---|---|---|
committer | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-08-03 15:39:38 +0000 |
commit | 4267831c822c9d126ffb250fcdcd35d1b738394e (patch) | |
tree | fc8fd1a930ab3e4488e6edc8adc88c084e6f4c46 /libass | |
parent | 7c9011871e254f2481eda6f7cefa239a760b6160 (diff) | |
download | libass-4267831c822c9d126ffb250fcdcd35d1b738394e.tar.bz2 libass-4267831c822c9d126ffb250fcdcd35d1b738394e.tar.xz |
Don't apply windows-like font scaling if hhea or os2 tables contain invalid
metrics.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24003 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass')
-rw-r--r-- | libass/ass_font.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c index b93c41e1..c434da7c 100644 --- a/libass/ass_font.c +++ b/libass/ass_font.c @@ -204,8 +204,12 @@ static void 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) - mscale = ((double)(hori->Ascender - hori->Descender)) / (os2->usWinAscent + os2->usWinDescent); + if (hori && os2) { + int hori_height = hori->Ascender - hori->Descender; + int os2_height = os2->usWinAscent + os2->usWinDescent; + if (hori_height && os2_height) + mscale = (double)hori_height / os2_height; + } memset(&rq, 0, sizeof(rq)); rq.type = FT_SIZE_REQUEST_TYPE_REAL_DIM; rq.width = 0; |