summaryrefslogtreecommitdiff
path: root/src/fcfreetype.c
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2019-07-29 09:38:51 +0000
committerAkira TAGOH <akira@tagoh.org>2019-07-29 10:19:26 +0000
commit80047ed8e8b63153ad2014f731453eb47c79c296 (patch)
tree86821089ecf96c513c8d9e61d9354135fc52f793 /src/fcfreetype.c
parentf555f50a207a96689dd6cf8ef96fd7f01b37a952 (diff)
downloadfontconfig-80047ed8e8b63153ad2014f731453eb47c79c296.tar.gz
Add FC_FONT_HAS_HINT property to see if font has hinting or not.
This may helps to enable autohint only when font doesn't have any hinting
Diffstat (limited to 'src/fcfreetype.c')
-rw-r--r--src/fcfreetype.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 28fa8ac..77c174e 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -543,6 +543,9 @@ static const FcMacRomanFake fcMacRomanFake[] = {
static FcChar8 *
FcFontCapabilities(FT_Face face);
+static FcBool
+FcFontHasHint (FT_Face face);
+
static int
FcFreeTypeSpacing (FT_Face face);
@@ -1829,6 +1832,9 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
free (complex_);
}
+ if (!FcPatternAddBool (pat, FC_FONT_HAS_HINT, FcFontHasHint (face)))
+ goto bail1;
+
if (!variable_size && os2 && os2->version >= 0x0005 && os2->version != 0xffff)
{
double lower_size, upper_size;
@@ -2552,6 +2558,7 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks FC_UNUSED, int *spac
#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' )
#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' )
#define TTAG_SILF FT_MAKE_TAG( 'S', 'i', 'l', 'f')
+#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
#define OTLAYOUT_HEAD "otlayout:"
#define OTLAYOUT_HEAD_LEN 9
@@ -2736,6 +2743,20 @@ bail:
return complex_;
}
+static FcBool
+FcFontHasHint (FT_Face face)
+{
+ FT_ULong *prep = NULL;
+ FT_UShort prep_count = 0;
+
+ prep_count = GetScriptTags (face, TTAG_prep, &prep);
+
+ free (prep);
+
+ return prep_count > 0;
+}
+
+
#define __fcfreetype__
#include "fcaliastail.h"
#include "fcftaliastail.h"