1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<HTML>
<HEAD>
<!-- Created with AOLpress/2.0 -->
<!-- AP: Created on: 13-Nov-2005 -->
<!-- AP: Last modified: 8-Jan-2008 -->
<TITLE>Caveats about References</TITLE>
<LINK REL="icon" href="fftype16.png">
<LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css">
</HEAD>
<BODY>
<P>
Different font formats place different restrictions on the use of references.
This does NOT mean you should avoid references -- they are a useful way of
encapsulating information even if the font format cannot support them directly.
If FontForge finds a situation where it can't use a refered glyph as a reference
it will fix it up somehow, usually this means replacing it with the equivalent
outlines.
<P>
Let us examine the most common font formats:
<DL>
<DT>
TrueType
<DD>
In TrueType any glyph may be referenced, and TrueType supports almost a full
range of linear transformations that may be applied to a reference, however
if a reference is scaled by 200% or more (or -200% or less) it cannot be
represented in TrueType.
<P>
TrueType also does not support mixing outlines and references.
<P>
If you have a glyph containing a reference which cannot be used (or that
mixes outlines and references) then ALL references will be converted to outlines
during output.
<P>
This means that any instructions in the glyph itself will be meaningless,
and any instructions in referred glyphs will not be executed.<BR>
NOTE: Just because general transformations are supported, it isn't always
a good idea to use them. If you flip a reference, the rasterizer will probably
have difficulties with it (its contours will run in the wrong direction).
If you rotate a reference any instructions inside it will not work well.
<DT>
Type1
<DD>
Type1 (and Type2) fonts have the basic limitation that the only transformation
that may be applied to a reference is translation no scaling, rotating or
flipping are allowed. Type1 fonts have two different mechanisms for using
references. The first is the simplest to describe.
<P>
If you have a glyph which contains exactly two references to characters which
are themselves part of the Adobe Standard Encoding, and one of those references
has an identity transformation matrix applied to it (that is, it is not moved,
scaled, rotated, flipped, etc.) and the width of the composite glyph is the
same as the width of this referred glyph and the other is only translated
(possibly by 0, but not scaled, rotated, flipped, etc.) THEN FontForge can
generate two references (this is done with the 'seac' instruction). CID-keyed
fonts do not support this.<BR>
The implications of this are that this form of referencing is useless for
non-latin scripts (except for glyphs shared by latin and another script,
Greek and Cyrillic often share the glyph used for latin A).<BR>
FontForge makes a slight extension, in that if you have a glyph which contains
one single untranslated reference, then FontForge will add a dummy reference
to the space glyph to make it fit the two reference requirement.
<P>
The second format is more general in some ways but has more arcane restrictions
imposed on it. PostScript fonts have the concept of "subroutines" which can
be used to define the contours of several glyphs. FontForge's algorithm is
quite complex and can depend on what other glyphs are refered to. But basically
if a glyph contains no hint substitutions, nor flex hints it can be put into
a subroutine. If it does contain these it can be put into a subroutine if
it has not been translated. Even if one reference cannot be put into a
subroutine, another may be (ie. TrueType references are an all or nothing
affair, that is not true of PostScript subroutines). If a reference cannot
be put in a subroutine, FF may still be able to put some of its components
(assuming it is a glyph with references) in a subroutine.
<P>
FontForge will recognize 'seac' as defining references, but it does not recognize
subroutine calls. Use <A HREF="editmenu.html#ReplaceRef">Edit->Replace
With Reference</A> after loading a Type1 font.
<P>
FontForge can also break an outline into smaller segments and place those
in subroutines these may be shared more easily among glyphs. They are no
longer true references, but they will make the output font smaller.
<DT>
Type2 ("OpenType")
<DD>
As above references may only be translated (not scaled, rotated, etc.). Type2
does not have anything equivalent to the 'seac' instruction (well, it sort
of does, but the instruction is depreciated and FontForge will not generate
it) but does support subroutines.
<P>
Here a referenced glyph can be put into a subroutine if it contains no hint
substitutions, or if it is not translated and none of the other components
of the final composite contain any hints at all. Again this is not an all
or nothing affair.
<P>
And again FontForge can break glyphs into smaller segements which can be
placed in subroutines and shared among glyphs. These are not true references
but do make the font smaller.
<P>
FontForge will not recognize any references when loading a Type2 (otf, cff,
cef, gai) font. Use <A HREF="editmenu.html#ReplaceRef">Edit->Replace With
Reference</A> after loading the font.
<DT>
Type3
<DD>
There are no restrictions on references.
<DT>
SVG
<DD>
Does not seem to have an easy way of handling references.
</DL>
<P>
</BODY></HTML>
|