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
This commit is contained in:
parent
f555f50a20
commit
80047ed8e8
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
|
||||
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
|
||||
</its:rules>
|
||||
|
||||
<description>Enable autohinter if font doesn't have any hinting</description>
|
||||
<!-- Use the Autohinter -->
|
||||
<match target="font">
|
||||
<test name="fonthashint"><bool>false</bool></test>
|
||||
<!--
|
||||
This configuration is available on the major desktop environments.
|
||||
We shouldn't overwrite it with "assign" unconditionally.
|
||||
Most clients may picks up the first value only. so using "append"
|
||||
may simply works to avoid it.
|
||||
-->
|
||||
<edit name="autohint" mode="append"><bool>true</bool></edit>
|
||||
</match>
|
||||
</fontconfig>
|
|
@ -57,6 +57,7 @@ config_DATA = $(DOC_FILES)
|
|||
templatedir = $(TEMPLATEDIR)
|
||||
template_DATA = \
|
||||
05-reset-dirs-sample.conf \
|
||||
09-autohint-if-no-hinting.conf \
|
||||
10-autohint.conf \
|
||||
10-hinting-full.conf \
|
||||
10-hinting-medium.conf \
|
||||
|
|
|
@ -211,6 +211,7 @@ convenience for the application's rendering mechanism.
|
|||
color FC_COLOR Bool Whether any glyphs have color
|
||||
fontvariations FC_FONT_VARIATIONS String comma-separated string of axes in variable font
|
||||
variable FC_VARIABLE Bool Whether font is Variable Font
|
||||
fonthashint FC_FONT_HAS_HINT Bool Whether font has hinting
|
||||
</programlisting>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
|
|
@ -140,6 +140,7 @@ convenience for the applications' rendering mechanism.
|
|||
familylang, stylelang, and fullnamelang
|
||||
prgname String String Name of the running program
|
||||
postscriptname String Font family name in PostScript
|
||||
fonthashint Bool Whether the font has hinting
|
||||
</programlisting>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
|
|
|
@ -126,6 +126,7 @@ typedef int FcBool;
|
|||
#define FC_PRGNAME "prgname" /* String */
|
||||
#define FC_HASH "hash" /* String (deprecated) */
|
||||
#define FC_POSTSCRIPT_NAME "postscriptname" /* String */
|
||||
#define FC_FONT_HAS_HINT "fonthashint" /* Bool - true if font has hinting */
|
||||
|
||||
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
|
||||
#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -72,4 +72,5 @@ FC_OBJECT (COLOR, FcTypeBool, FcCompareBool)
|
|||
FC_OBJECT (SYMBOL, FcTypeBool, FcCompareBool)
|
||||
FC_OBJECT (FONT_VARIATIONS, FcTypeString, NULL)
|
||||
FC_OBJECT (VARIABLE, FcTypeBool, FcCompareBool)
|
||||
FC_OBJECT (FONT_HAS_HINT, FcTypeBool, NULL)
|
||||
/* ^-------------- Add new objects here. */
|
||||
|
|
Loading…
Reference in New Issue