Only set FC_SIZE for scalable fonts if OS/2 version 5 is present

Part of https://bugs.freedesktop.org/show_bug.cgi?id=80873
This commit is contained in:
Behdad Esfahbod 2014-07-04 16:13:45 -04:00
parent d09ba38589
commit 51756aab18
1 changed files with 15 additions and 13 deletions

View File

@ -1199,7 +1199,6 @@ FcFreeTypeQueryFace (const FT_Face face,
const char *tmp; const char *tmp;
FcRange *r = NULL; FcRange *r = NULL;
double lower_size = 0.0L, upper_size = DBL_MAX;
FcBool symbol = FcFalse; FcBool symbol = FcFalse;
@ -1614,16 +1613,17 @@ FcFreeTypeQueryFace (const FT_Face face,
free (complex_); free (complex_);
} }
if (os2)
{
#if defined (HAVE_TT_OS2_USUPPEROPTICALPOINTSIZE) && defined (HAVE_TT_OS2_USLOWEROPTICALPOINTSIZE) #if defined (HAVE_TT_OS2_USUPPEROPTICALPOINTSIZE) && defined (HAVE_TT_OS2_USLOWEROPTICALPOINTSIZE)
if (os2 && os2->version >= 0x0005 && os2->version != 0xffff) if (os2 && os2->version >= 0x0005 && os2->version != 0xffff)
{ {
double lower_size, upper_size;
/* usLowerPointSize and usUpperPointSize is actually twips */ /* usLowerPointSize and usUpperPointSize is actually twips */
lower_size = os2->usLowerOpticalPointSize / 20.0L; lower_size = os2->usLowerOpticalPointSize / 20.0L;
upper_size = os2->usUpperOpticalPointSize / 20.0L; upper_size = os2->usUpperOpticalPointSize / 20.0L;
}
#endif
if (os2)
{
r = FcRangeCreateDouble (lower_size, upper_size); r = FcRangeCreateDouble (lower_size, upper_size);
if (!FcPatternAddRange (pat, FC_SIZE, r)) if (!FcPatternAddRange (pat, FC_SIZE, r))
{ {
@ -1632,6 +1632,8 @@ FcFreeTypeQueryFace (const FT_Face face,
} }
FcRangeDestroy (r); FcRangeDestroy (r);
} }
#endif
}
else else
{ {
for (i = 0; i < face->num_fixed_sizes; i++) for (i = 0; i < face->num_fixed_sizes; i++)