# HG changeset patch # User eugeni # Date 1186155578 0 # Node ID 90038c72d69ed20dae4eaf05cfb109e6f127fd6f # Parent 17b5fa69243c90d6ef91fcef2aabfc0a34637d7b Don't apply windows-like font scaling if hhea or os2 tables contain invalid metrics. diff -r 17b5fa69243c -r 90038c72d69e libass/ass_font.c --- a/libass/ass_font.c Fri Aug 03 15:22:55 2007 +0000 +++ b/libass/ass_font.c Fri Aug 03 15:39:38 2007 +0000 @@ -204,8 +204,12 @@ 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;