glyf | Chrome new tab extension | Browser Plugin library
kandi X-RAY | glyf Summary
kandi X-RAY | glyf Summary
Chrome new tab extension
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of glyf
glyf Key Features
glyf Examples and Code Snippets
Community Discussions
Trending Discussions on glyf
QUESTION
According to Apple's Reference manual for TrueType font files, there are 45 different types of font tables. Checking those ttf I have installed on my system, I have acertained that the number of tables actually present in those files ranges from 12 to maximum 22 font tables per file.
Looking further at the structure of a true type font file, it start with this information:
uint32 scaler type A tag to indicate the OFA scaler to be used to rasterize this font; see the note on the scaler type below for more information.
uint16 numTables number of tables
uint16 searchRange (maximum power of 2 <= numTables)*16
uint16 entrySelector log2(maximum power of 2 <= numTables)
uint16 rangeShift numTables*16-searchRange
which gives reason to believe there would be a common need for the precalculated, but yet totally imho redudant fields rangeShift
, entrySelector
, searchRange
. It even states them to be employed for binary searching of the list of font tables:
The entries for searchRange, entrySelector and rangeShift are used to facilitate quick binary searches of the table directory that follows (source https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html)
A valid reason to even consider adding those fields, which could anyway be calculated on the fly from numTables
would be indeed that there is a large number of font tables.
My question is therefore, if despite my testing there exist indeed occasions in which true type fonts are reasonably to be expected to have a larger (e.g. >1000) number of tables, which would imply the question if it is at all possible that any of the 45 different type of font tables can occure multiple times?
The tables it listed are the following.
- The 'acnt' (accent attachment) table
- The 'ankr' (anchor point) table
- The 'avar' (axis variation) table
- The 'bdat' (bitmap data) table
- The 'bhed' (bitmap font header) table
- The 'bloc' (bitmap location) table
- The 'bsln' (baseline) table
- The 'cmap' (character code mapping) table
- The 'cvar' (CVT variation) table
- The 'cvt ' (control value) table
- The 'EBSC' (embedded bitmap scaling control) table
- The 'fdsc' (font descriptor) table
- The 'feat' (layout feature) table
- The 'fmtx' (font metrics) table
- The 'fond' (font family compatibility) table
- The 'fpgm' (font program) table
- The 'fvar' (font variation) table
- The 'gasp' (grid-fitting and scan-conversion procedure) table
- The 'glyf' (glyph outline) table
- The 'gvar' (glyph variation) table
- The 'hdmx' (horizontal device metrics) table
- The 'head' (font header) table
- The 'hhea' (horizontal header) table
- The 'hmtx' (horizontal metrics) table
- The 'just' (justification) table
- The 'kern' (kerning) table
- The 'kerx' (extended kerning) table
- The 'lcar' (ligature caret) table
- The 'loca' (glyph location) table
- The 'ltag' (language tag) table
- The 'maxp' (maximum profile) table
- The 'meta' (metadata) table
- The 'morx' (extended metamorphosis) table
- The 'name' (name) table
- The 'opbd' (optical bounds) table
- The 'OS/2' (compatibility) table
- The 'post' (glyph name and PostScript compatibility) table
- The 'prep' (control value program) table
- The 'prop' (properties) table
- The 'sbix' (extended bitmaps) table
- The 'trak' (tracking) table
- The 'vhea' (vertical header) table
- The 'vmtx' (vertical metrics) table
- The 'xref' (cross-reference) table
- The 'Zapf' (glyph reference) table
It seems that the "font tables" allow any random "extension" among them, as for instance there is a font table labeled FFTM
, which
"[...] is unique to FontForge. It contains three timestamps: First FontForge's version date, then when the font was generated, and when the font was created. I describe its format here."
https://fontforge.github.io/TrueOpenTables.html
Still even those occasional added tables like FFTM
would not seem to merit the fields searchRange etc.
ANSWER
Answered 2019-Aug-02 at 15:30When TrueType was invented in the late 1980s/early 1990s, the developers were not certain how things would evolve as the format was adopted. Also remember that processor speeds were considerably slower then.
As it turns out, indeed, few fonts have more than about 25 tables, and probably none that approach the number where a binary search and the use of the pre-calculated fields would make much difference in locating a table (versus just iterating through the sorted list).
Nevertheless, the fields are part of the specification and can’t be “omitted”. Many implementations ignore the fields, and they are frequently filled with wrong values, but be aware that many font checkers/validators/sanitizers DO check them and might flag wrong values as an invalid font. So if you’re asking this question as regards creating a font, I would advise filling in the fields with correct data.
QUESTION
Here is the data I am using to construct the table:
...ANSWER
Answered 2019-Jan-22 at 16:16It looks like Chrome, which uses OTS, doesn't support format 0.
QUESTION
I am having issue with solving these problems with regard to TTF spec.
- "Computing the checksum" in "head".
- "xMin", "yMin", etc. in "head"
- maxPoints, maxContours, maxComponentPoints, maxComponentContours, maxTwilightPoints in "maxp"
uint8 flags[variable] Array of flags
in "glyf"
I would like to know if someone could clarify these pieces.
1For (1) it says this:
checkSumAdjustment To compute: set it to 0, calculate the checksum for the 'head' table and put it in the table directory, sum the entire font as a uint32_t, then store 0xB1B0AFBA - sum. (The checksum for the 'head' table will be wrong as a result. That is OK; do not reset it.),
I found two checksum implementations they referenced:
...ANSWER
Answered 2019-Jan-13 at 21:58In general, you might find the current OpenType specification helpful as it contains a number of updates, clarifications, and corrections that don't appear in the Apple version.
As to your specific questions:
1 head.checksumAdj
calculation
The instructions are reasonably clear, though there is an implied "step zero" of assemble all font data (tables, directory, etc.) into final form and order. Once you have that:
set the value of
checkSumAdj
in thehead
table to zerocalculate the checksum of just the
head
table and store it in the corresponding field in the font's table directory (where tag/checksum/offset/length are stored for all tables included in the font)calculate the sum of the entire font (sum of all uint32s, just like table checksums), including the modifications in steps 1 and 2.
store 0xB1B0AFBA minus the value from step 3 in
head.checkSumAdj
. That's all! The wording about the head checksum appearing incorrect means that if you were to run the checksum calculation on thehead
table after storing the final value, it would appear wrong. But that is okay, because that's how it was defined: essentially for the checksum of thehead
table, you must ignore (set to 0) thecheckSumAdj
value first.
2 head
xMin, xMax, yMin, yMax
This is simply the xMin, xMax, yMin, and yMax of all glyphs. Each glyph xMin, xMax, etc. is quite simply "the minimum (maximum) X (Y) coordinate" of all points (for compound glyphs, you would take that result after composing the glyph, i.e. after applying any shift, scale, or other transformations in the composite glyph definition). In both the head
table and glyph data, the bounding box is an array of 16-bit signed integers. So generally the procedure would be to loop over every glyph, get the calculated bounding box, and as you are doing this, keep track of the X/Y min/max (independently). When you are done with the loop, you'll have the values for the head
table which is essentially a rectangle that includes every coordinate of every glyph in the font.
3 maxp
values
These are reasonably well-defined in the maxp
table definition:
maxPoints
is the maximum number of points of any single non-composite ("simple") glyphmaxContours
is similarly the maximum number of contours of any single non-composite glyphmaxComponentPoints
is the maximum number of points in a composite glyph (i.e. the sum of points of all component glyphs)maxComponentContours
is similarly the maximum number of contours in a composite glyphmaxTwilightPoints
refers to the maximum number of "twilight" points used in Zone 0 of TrueType instructions. If your font does not make use of TrueType instructions, this (and other instruction-related fields) can be set to zero. You might want to review the "Instructing TrueType Glyphs" and "TrueType Instruction Set" sections of the OpenType specification if you are not familiar with TrueType instructions (often referred to as "hints") and how they are stored in the glyph data.
4 glyf
table simple glyph flags
uint8 flags[variable]
indicates that the length of the flags array is variable. The reason for that is discussed in the specification ("Simple Glyph Flags"):
In logical terms, there is one flag byte element, one x-coordinate, and one y-coordinate for each point. Note, however, that the flag byte elements and coordinate arrays used packed representations. In particular if a logical sequence of flag elements or sequence of x- or y- coordinates is repeated, then the actual flag byte element or coordinate value can be given in a single entry, with special flags used to indicate that this value is repeated for subsequent logical entries.
In other words, the elements of the flags
array, when expanded are per-coordinate, but the actual storage as an array of uint8 is not necessarily (as with the storage of the coordinate data itself). It largely depends on the arrangement of coordinates in each glyph.
QUESTION
I cannot find any information in the specification for the OpenType/TrueType glyf table that clarifies if the components of a compound glyph are always simple glyphs, or if they can be compound glyphs themselves (i.e. recursive compound glyphs).
Since the specification does not explicitly prohibit compound glyphs as components, I would assume that it is possible in theory. But my question is: Are there any fonts that actually contain recursive compound glyphs? And do any of the major font tools support this?
The background is that I am writing a simple font parser and I want to know if I need to be aware of recursive compound glyphs, because this would make the algorithms a bit more complicated.
Update: I found some information in the spec for the maxp table. This defines maxComponentDepth, which is the maximum level of recursions for compound glyphs. This shows me that recursive compound glyphs are possible. But are they actually being used?
...ANSWER
Answered 2017-Mar-11 at 21:58I found that in the standard Arial font there are four compound glyphs that have another compound glyph as a component. One example is the glyph at index 471, which is used for unicode U+01FB (latin small letter a with ring above and acute). It consists of the Acute glyph, which is a simple glyph, and the small latin a with ring above, which is a compound glyph.
Composition of glyph 471 in TrueType font Arial:
So the conclusions from this are:
- Recursivly compound glyphs are possible in TrueType/OpenType fonts.
- These glyphs exist in common fonts.
QUESTION
In the glyf table, if a glyph is a composite glyph, I don't understand what it means if the flag ARGS_ARE_XY_VALUES is not set. The msdn docs say
the first point number indicates the point that is to be matched to the new glyph. The second number indicates the new glyph’s “matched” point. Once a glyph is added, its point numbers begin directly after the last glyphs (endpoint of first glyph + 1).
But I have NO idea what it means:
- What is a "point number"? Is it an index into the glyph's points?
- What does "matched to the new glyph" mean?
ANSWER
Answered 2018-Aug-28 at 23:38What is a "point number"? Is it an index into the glyph's points?
Yes. It’s an index into the array of pairs of coordinates that make up the glyph’s outline (as defined in the glyph’s contour data).
What does "matched to the new glyph" mean?
It means that the new component glyph of that composite/compound glyph is to be positioned so that the coordinates of its ‘match point’ are equal to those of the ‘match point’ of the base component glyph. In other words: so that the indicated points for the two components match. This is repeated for each new component glyph, with the point numbers/indices of the already matched components being treated as if it were a single, base component glyph.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install glyf
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page