![]() |
|
SignDoc SDK (C++)
5.0.1
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- A font configuration file specifies font files and and font
substitutions. See SPFontConfig-Noto.xml for a font configuration
file that tries to cover all Noto fonts. -->
<!ELEMENT SPFontConfig (FontFiles*, Flag*, Substitution*)>
<!-- Load fonts from files. The contents of this element specify
either the pathname of a single font or a pathname containing
wildcard characters "*" and "?" in the last component such as
c:\fonts\*.ttf. Relative pathnames are relative to the directory
containing the font configuration file. If font configuration is
read from a stream, relative pathnames will be relative to a
specified directory. If no directory is specified, "FontFiles"
elements with relative pathnames will be ignored.
The "embed" attribute controls whether the fonts will be embedded
into the document or not. If a font is already embedded and contains
all required glyphs, it won't be embedded again. These values are
available:
no The fonts won't be embedded; this is not allowed unless
explicitly overriden with setShootInFoot().
yes The fonts will be embedded completely.
subset Only the required glyphs will be embedded.
The "Substitution" element can override this attribute.
Note that documents compliant with PDF/A must embed all fonts
(subsetted or not).
The "family" attribute overrides the family name for the fonts. If this
attribute is missing or if its value is empty, the family names are
taken from the font files.
The "features" attribute can be used to disable font features
such as ligatures. Its value is a HarfBuzz feature string, see
https://github.com/deepakjois/luaharfbuzz/wiki/Feature-Strings.
The "raw-cff" attribute is used to control how OpenType fonts
with CFF outlines will be embedded. If its value is "no", those
fonts will be embedded as OpenType fonts. If its value is "yes",
those fonts will be embedded as Type1 CFF fonts. If the PDF
document claims to conform to PDF/A-1 or if the PDF version of
the PDF document is 1.4 or less, the "raw-cff" will be ignored
and OpenType fonts with CFF outlines will be embedded as Type1
CFF fonts. -->
<!ELEMENT FontFiles (#PCDATA)>
<!ATTLIST FontFiles
embed (no|yes|subset) "subset"
family CDATA #IMPLIED
features CDATA #IMPLIED
raw-cff (no|yes) "yes"
>
<!-- Define one flag derived from font names. Flags can be used to
avoid repeating font names over and over (for instance to select
serif fonts by name) and for testing values in the font
descriptor of fonts already existing in the PDF document and to
be substituted. If the font name to be substituted matches a
"FontName" element of a "Flag" element or if at least one of the
conditions is met, the flag named by the "name" attribute will be
set. The "name" attribute must start with an ASCII letter and can
contain only ASCII letters, ASCII digits, and hyphens. See the
"flags" attribute of the "Substitution" element. -->
<!ELEMENT Flag ((FontName|Condition)+)>
<!ATTLIST Flag name CDATA
#REQUIRED
>
<!-- Defines one font substitution. Font substitutions are tried one
by one until a match is found or the end is reached. Letter case
and space characters are ignored in font names. The output of a
substitution rule is never used as input for another rule.
Font substitution for a font named A is performed using these steps:
- (1) Apply the first matching font substitution of type "forced",
resulting in font name B. If there is no such substitution,
using A as B.
- (2) Search the font files specified by "FontFiles" elements,
fonts already embedded in the document, and standard fonts for
a font named B that covers all required characters and
scripts. For complex scripts, the font must have GSUB/GPOS
tables (ie, standard fonts cannot be used). If there is such a
font, use that font.
- (3) Apply the first matching font substitution of type "fallback",
matching against font A (ie, ignoring any "forced" substitution).
Give up if there is no such font substitution.
- (4) If the font substitution results in a single font C, search
the font files specified by "FontFiles" elements, fonts already
embedded in the document, and standard fonts for a font named C
that covers all required characters and scripts. For complex
scripts, the font must have GSUB/GPOS tables (ie, standard
fonts cannot be used). If there is such a font, use that font.
- (5) If the font substitution results in multiple font names D,
check if there is a font file specified by "FontFiles" elements
that has a name in D and that covers all required characters and
scripts. If there is such a font file, use that font. Otherwise,
try to find a set of font files specified by "FontFiles" elements
having names in D that covers all required characters and scripts.
If there is such a subset, use those fonts.
- (6) Give up if the text uses just one script.
- (7) Partition the text into segments based on scripts. For each
script, repeat steps (1) through (6), trying to find a font
or a set of fonts covering all the characters of that script.
On failure, try steps (1) through (6) again without requiring
GPOS/GSUB tables. Give up if there is a script for which no
suitable font is found.
.
If a suitable substitution is found before step (7), exactly one
substitution will be applied. If step (7) is needed and succeeds,
at most one substitution per script will be applied. Using step (7)
is the only way to apply multiple font substitutions for a single
text.
For embedded fonts and font files, the font name will be matched
against the PostScript names and font family names. In the
latter case, the italic and bold attributes of the fonts are also
compared.
There are two types of font substitutions: If the "type"
attribute is "forced", the substitution will be applied before
trying to locate the font. That way, a font can be substituted
even if it is already embedded and covers all required
characters. A substitution rule of this type must have exactly
two "FontName" elements and no "Script" element. (Usage of
forced substitutions is not recommended.)
If the "type" attribute is "fallback", the substitution will be
applied only if no standard font, already-embedded font, or font
loaded by "FontFiles" elements covers all required characters and
scripts as described above. The substitution will be applied to
the original font name, ie, without taking a substitution of type
"forced" into account.
If two "FontName" elements (without "Script" element) are
provided, substitute the first font with the second one. "*" in
the first "FontName" element matches any sequence of characters
in the font name (including no characters).
If a "Script" element is used, the "FontName" elements before the
"Script" element specify the fonts to be substituted (at least
one of the font names must match), the "FontName" elements after
the "Script" element specifies the replacement fonts. "*" in the
"FontName" elements before the "Script" element matches any
sequence of characters in the font name (including no
characters). Using multiple "FontName" elements before the
"Script" element is equivalent to using one "Substitution"
element per such "FontName" element.
If there is a single "FontName" element specifying a replacement
font, that font is searched for in the PDF document, in the
standard fonts, and in the font files; it must cover all required
characters for the specified scripts. If there are multiple
"FontName" elements specifying replacement fonts, only font files
will be searched for matching fonts. If one of those font files
coveres all required characters for the specified scripts, the
first one of those font files will be used. Otherwise, a subset
of the font files must together cover all required characters for
the specified script. (The algorithm for computing that subset is
undefined.) Substitution rules having multiple replacement fonts
cannot be rewritten as substitution rules having one replacement
font.
If there is a "Script" element, use the substitution for the
specified scripts only (in that case, the "FontName" elements
before the "Script" element should use wildcard patterns).
Using a "Script" element with multiple script tags is equivalent
to using one "Substitution" element per script tag.
It is recommended to restrict substitution rules with "Script"
elements in order to avoid accidentally using generic Latin
glyphs from, say, CJK fonts.
If the "flags" attribute has a non-empty value, it specifies a
comma-separated list of flags. Each flag can be preceded by a "!"
character to negate its value. The substitution is applied only
if all flags not preceded by "!" are set and all flags preceded
by "!" are not set. The flag names are case-sensitive. All flags
used in "flags" attributes must be defined by "Flag" elements.
The "embed" attribute controls whether the font will be
embedded into the document or not. If a font is already
embedded and contains all required glyphs, it won't be
embedded again. These values are available:
default Use the "embed" attribute of the "FontFiles" element for the
substituted font
no The font won't be embedded; this is not allowed unless
explicitly overriden with setShootInFoot()
yes The font will be embedded completely
subset Only the required glyphs will be embedded
The "no", "yes", and "subset" values override the "embed" attribute
of the "FontFiles" element for the substituted font.
Note that documents compliant with PDF/A must embed all fonts
(subsetted or not).
The sequence of substitution rules matters as the first matching
one will be used. You can use this behavior to map font names
ending with "Bold" (<FontName>*Bold</FontName) to a bold font and
(in a subsequent rule) all other font names
(<FontName>*</FontName>) to a regular font.
When using a font configuration file for configuring fonts to be
used for rendering PDF documents, only substitutions using
exactly one target "FontName" element and only source "FontName"
elements that don't contain any "*" characters take effect.
The "Script" element will be ignored. All attributes
of "FontName" elements will be ignored. "Substitution" elements
having a "type" attribute with value "forced" take precedence
over "Substitution" elements having a "type" attribute of
"fallback", all other attributes of "Substitution" elements are
ignored. -->
<!ELEMENT Substitution ((FontName, FontName) | (FontName+, Script, FontName+))>
<!ATTLIST Substitution
flags CDATA #IMPLIED
type (forced|fallback) "fallback"
embed (default|no|yes|subset) "default"
>
<!-- Contents: the font family name or PostScript name of the font to be
substituted or of the font used as substitute. -->
<!ELEMENT FontName (#PCDATA)>
<!-- A condition for the "Flag" element. The contents are an
expression of the form "LHS OP RHS", where LHS specifies a
number-valued entry (such as FontWeight, ItalicAngle, or StemV)
in the font descriptor, OP specifies a comparison operator:
LT LHS is less than RHS
LE LHS is less than or equal to RHS
EQ LHS equals RHS
NE LHS does not equal RHS
GE LHS is greater than or equal to RHS
GT LHS is greater than RHS
BITSET Bit RHS (1 through 31) is set in LHS (which should be "Flags")
BITCLEAR Bit RHS (1 through 31) is not set in LHS (which should
be "Flags")
RHS is the number against which the entry's value shall be
compared or the bit number (for BITSET and BITCLEAR). Note
that bits are numbered as in the PDF specification: bit 1
is the least significant bit.
If the entry does not exist and no default value is
defined for it, the condition won't be met.
Examples:
<Flag name="italic">
<Condition>ItalicAngle LE -2</Condition>
<Condition>Flags BITSET 7</Condition>
</Flag>
<Flag name="bold">
<Condition>FontWeight GE 500</Condition>
</Flag>
Note that the values of StemV and Flags are usually unreliable.
Note that a value of 0 for StemV or StemH means that the value
is unknown.-->
<!ELEMENT Condition (#PCDATA)>
<!-- Contents: space-separated OpenType script tags of the font to be
substituted:
arab Arabic
armi Imperial Aramaic
armn Armenian
avst Avestan
bali Balinese
bamu Bamum
bass Bassa Vah
batk Batak
beng Bengali
bopo Bopomofo
brah Brahmi
brai Braille
bugi Buginese
buhd Buhid
cakm Chakma
cans Canadian Syllabics
cari Carian
cham Cham
cher Cherokee
copt Coptic
cprt Cypriot Syllabary
cyrl Cyrillic
deva Devanagari
dsrt Deseret
dupl Duployan
egyp Egyptian Hieroglyphs
elba Elbasan
ethi Ethiopic
geor Georgian
glag Glagolitic
goth Gothic
gran Grantha
grek Greek
gujr Gujarati
guru Gurmukhi
hang Hangul
hani CJK Ideographic
hano Hanunoo
hebr Hebrew
hira Hiragana
hluw Anatolian Hieroglyphs
hmng Pahawh Hmong
hung Old Hungarian
ital Old Italic
java Javanese
kali Kayah Li
kana Hiragana
khar Kharosthi
khmr Khmer
khoj Khojki
knda Kannada
kthi Kaithi
lana Tai Tham (Lanna)
lao Lao
latn Latin
lepc Lepcha
limb Limbu
lina Linear A
linb Linear B
lisu Lisu (Fraser)
lyci Lycian
lydi Lydian
mand Mandaic, Mandaean
mani Manichaean
math Mathematical Alphanumeric Symbols
mend Mende Kikakui
merc Meroitic Cursive
mero Meroitic Hieroglyphs
mlym Malayalam
modi Modi
mong Mongolian
mroo Mro
mtei Meitei Mayek (Meithei, Meetei)
musc Musical Symbols
mymr Myanmar
narb Old North Arabian
nbat Nabataean
nko N'Ko
ogam Ogham
olck Ol Chiki
orkh Old Turkic, Orkhon Runic
orya Odia (formerly Oriya)
osma Osmanya
palm Palmyrene
perm Old Permic
phag Phags-pa
phli Inscriptional Pahlavi
phlp Psalter Pahlavi
phnx Phoenician
plrd Miao
prti Inscriptional Parthian
rjng Rejang
runr Runic
samr Samaritan
sarb Old South Arabian
saur Saurashtra
sgnw Sign Writing
shaw Shavian
shrd Sharada
sind Khudawadi
sinh Sinhala
sora Sora Sompeng
sund Sundanese
sylo Syloti Nagri
syrc Syriac
tagb Tagbanwa
takr Takri
tale Tai Le
talu New Tai Lue
taml Tamil
tavt Tai Viet
telu Telugu
tfng Tifinagh
tglg Tagalog
thaa Thaana
thai Thai
tibt Tibetan
tirh Tirhuta
ugar Ugaritic Cuneiform
vai Vai
wara Warang Citi
xpeo Old Persian Cuneiform
xsux Sumero-Akkadian Cuneiform
yi Yi
Additionally, script tag "OTHR" is used for code points not
covered by the above scripts.
If the value of a text field is empty, script tag "latn" will be
used. In consequence, if you use the "Script" element, you should
always have a rule for script tag "latn".
If the content of the "Script" element is empty, all scripts will
match, that is, an empty "Script" element behaves like a missing
"Script" element (except for syntactically separating "FontName"
elements). -->
<!ELEMENT Script (#PCDATA)>