diff options
author | Bernhard Haumacher <[email protected]> | 2020-05-10 14:35:31 +0200 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-03 02:00:49 +0100 |
commit | 2a23fede0f8ee99ed958f0f547f2558da7662cd9 (patch) | |
tree | 891fae85b74c81df8c3ff324087165669d1e53ba | |
parent | 24a4f764c1f7b07c81a31991bf65808c2406e5bd (diff) |
Added documentation to the 'loca' table.
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java index 785d99036..3a1dcd037 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java @@ -12,12 +12,42 @@ import java.io.DataInput; import java.io.IOException; /** + * Index to Location table + * + * <p> + * The indexToLoc table stores the offsets to the locations of the glyphs in the + * font, relative to the beginning of the glyphData table. In order to compute + * the length of the last glyph element, there is an extra entry after the last + * valid index. + * </p> + * + * <p> + * By definition, index zero points to the “missing character”, which is the + * character that appears if a character is not found in the font. The missing + * character is commonly represented by a blank box or a space. If the font does + * not contain an outline for the missing character, then the first and second + * offsets should have the same value. This also applies to any other characters + * without an outline, such as the space character. If a glyph has no outline, + * then loca[n] = loca[n+1]. In the particular case of the last glyph(s), + * loca[n] will be equal the length of the glyph data ('glyf') table. The + * offsets must be in ascending order with loca[n] <= loca[n+1]. + * </p> + * + * <p> + * Most routines will look at the 'maxp' table to determine the number of glyphs + * in the font, but the value in the 'loca' table must agree. + * </p> + * + * <p> + * There are two versions of this table: a short version, and a long version. + * The version is specified in the indexToLocFormat entry in the 'head' table. + * </p> + * * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class LocaTable implements Table { private int[] _offsets; - private short _factor; private int _length; public LocaTable( @@ -29,12 +59,10 @@ public class LocaTable implements Table { boolean shortEntries = head.useShortEntries(); // FIXME boolean shortEntries = head.getIndexToLocFormat() == 0; if (shortEntries) { - _factor = 2; for (int i = 0; i <= maxp.getNumGlyphs(); i++) { - _offsets[i] = di.readUnsignedShort(); + _offsets[i] = 2 * di.readUnsignedShort(); } } else { - _factor = 1; for (int i = 0; i <= maxp.getNumGlyphs(); i++) { _offsets[i] = di.readInt(); } @@ -62,7 +90,7 @@ public class LocaTable implements Table { if (_offsets == null) { return 0; } - return _offsets[i] * _factor; + return _offsets[i]; } @Override |