You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2013/04/09 19:31:45 UTC
svn commit: r1466146 [10/20] - in /xmlgraphics/fop/trunk: ./
src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/
src/codegen/unicode/java/org/apache/fop/text/linebreak/
src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/modca/ src/java/o...
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java?rev=1466146&r1=1466145&r2=1466146&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java Tue Apr 9 17:31:41 2013
@@ -68,7 +68,7 @@ public final class OTFAdvancedTypographi
* @param ttf parent font file reader (must be non-null)
* @param in font file reader (must be non-null)
*/
- public OTFAdvancedTypographicTableReader ( TTFFile ttf, FontFileReader in ) {
+ public OTFAdvancedTypographicTableReader (TTFFile ttf, FontFileReader in) {
assert ttf != null;
assert in != null;
this.ttf = ttf;
@@ -84,12 +84,12 @@ public final class OTFAdvancedTypographi
readGDEF();
readGSUB();
readGPOS();
- } catch ( AdvancedTypographicTableFormatException e ) {
+ } catch (AdvancedTypographicTableFormatException e) {
resetATStateAll();
throw e;
- } catch ( IOException e ) {
+ } catch (IOException e) {
resetATStateAll();
- throw new AdvancedTypographicTableFormatException ( e.getMessage(), e );
+ throw new AdvancedTypographicTableFormatException (e.getMessage(), e);
} finally {
resetATState();
}
@@ -100,7 +100,7 @@ public final class OTFAdvancedTypographi
* @return true if advanced (typographic) table is present
*/
public boolean hasAdvancedTable() {
- return ( gdef != null ) || ( gsub != null ) || ( gpos != null );
+ return (gdef != null) || (gsub != null) || (gpos != null);
}
/**
@@ -130,14 +130,14 @@ public final class OTFAdvancedTypographi
private void readLangSysTable(TTFTableName tableTag, long langSysTable, String langSysTag) throws IOException {
in.seekSet(langSysTable);
if (log.isDebugEnabled()) {
- log.debug(tableTag + " lang sys table: " + langSysTag );
+ log.debug(tableTag + " lang sys table: " + langSysTag);
}
// read lookup order (reorder) table offset
int lo = in.readTTFUShort();
// read required feature index
int rf = in.readTTFUShort();
String rfi;
- if ( rf != 65535 ) {
+ if (rf != 65535) {
rfi = "f" + rf;
} else {
rfi = null;
@@ -146,25 +146,25 @@ public final class OTFAdvancedTypographi
int nf = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " lang sys table reorder table: " + lo );
- log.debug(tableTag + " lang sys table required feature index: " + rf );
- log.debug(tableTag + " lang sys table non-required feature count: " + nf );
+ log.debug(tableTag + " lang sys table reorder table: " + lo);
+ log.debug(tableTag + " lang sys table required feature index: " + rf);
+ log.debug(tableTag + " lang sys table non-required feature count: " + nf);
}
// read (non-required) feature indices
int[] fia = new int[nf];
List fl = new java.util.ArrayList();
- for ( int i = 0; i < nf; i++ ) {
+ for (int i = 0; i < nf; i++) {
int fi = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " lang sys table non-required feature index: " + fi );
+ log.debug(tableTag + " lang sys table non-required feature index: " + fi);
}
fia[i] = fi;
- fl.add ( "f" + fi );
+ fl.add ("f" + fi);
}
- if ( seLanguages == null ) {
+ if (seLanguages == null) {
seLanguages = new java.util.LinkedHashMap();
}
- seLanguages.put ( langSysTag, new Object[] { rfi, fl } );
+ seLanguages.put (langSysTag, new Object[] { rfi, fl });
}
private static String defaultTag = "dflt";
@@ -172,53 +172,53 @@ public final class OTFAdvancedTypographi
private void readScriptTable(TTFTableName tableTag, long scriptTable, String scriptTag) throws IOException {
in.seekSet(scriptTable);
if (log.isDebugEnabled()) {
- log.debug(tableTag + " script table: " + scriptTag );
+ log.debug(tableTag + " script table: " + scriptTag);
}
// read default language system table offset
int dl = in.readTTFUShort();
String dt = defaultTag;
- if ( dl > 0 ) {
+ if (dl > 0) {
if (log.isDebugEnabled()) {
- log.debug(tableTag + " default lang sys tag: " + dt );
- log.debug(tableTag + " default lang sys table offset: " + dl );
+ log.debug(tableTag + " default lang sys tag: " + dt);
+ log.debug(tableTag + " default lang sys table offset: " + dl);
}
}
// read language system record count
int nl = in.readTTFUShort();
List ll = new java.util.ArrayList();
- if ( nl > 0 ) {
+ if (nl > 0) {
String[] lta = new String[nl];
int[] loa = new int[nl];
// read language system records
- for ( int i = 0, n = nl; i < n; i++ ) {
+ for (int i = 0, n = nl; i < n; i++) {
String lt = in.readTTFString(4);
int lo = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " lang sys tag: " + lt );
- log.debug(tableTag + " lang sys table offset: " + lo );
+ log.debug(tableTag + " lang sys tag: " + lt);
+ log.debug(tableTag + " lang sys table offset: " + lo);
}
lta[i] = lt;
loa[i] = lo;
- if ( dl == lo ) {
+ if (dl == lo) {
dl = 0;
dt = lt;
}
- ll.add ( lt );
+ ll.add (lt);
}
// read non-default language system tables
- for ( int i = 0, n = nl; i < n; i++ ) {
- readLangSysTable ( tableTag, scriptTable + loa [ i ], lta [ i ] );
+ for (int i = 0, n = nl; i < n; i++) {
+ readLangSysTable (tableTag, scriptTable + loa [ i ], lta [ i ]);
}
}
// read default language system table (if specified)
- if ( dl > 0 ) {
- readLangSysTable ( tableTag, scriptTable + dl, dt );
- } else if ( dt != null ) {
+ if (dl > 0) {
+ readLangSysTable (tableTag, scriptTable + dl, dt);
+ } else if (dt != null) {
if (log.isDebugEnabled()) {
- log.debug(tableTag + " lang sys default: " + dt );
+ log.debug(tableTag + " lang sys default: " + dt);
}
}
- seScripts.put ( scriptTag, new Object[] { dt, ll, seLanguages } );
+ seScripts.put (scriptTag, new Object[] { dt, ll, seLanguages });
seLanguages = null;
}
@@ -227,26 +227,26 @@ public final class OTFAdvancedTypographi
// read script record count
int ns = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " script list record count: " + ns );
+ log.debug(tableTag + " script list record count: " + ns);
}
- if ( ns > 0 ) {
+ if (ns > 0) {
String[] sta = new String[ns];
int[] soa = new int[ns];
// read script records
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
String st = in.readTTFString(4);
int so = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " script tag: " + st );
- log.debug(tableTag + " script table offset: " + so );
+ log.debug(tableTag + " script tag: " + st);
+ log.debug(tableTag + " script table offset: " + so);
}
sta[i] = st;
soa[i] = so;
}
// read script tables
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
seLanguages = null;
- readScriptTable ( tableTag, scriptList + soa [ i ], sta [ i ] );
+ readScriptTable (tableTag, scriptList + soa [ i ], sta [ i ]);
}
}
}
@@ -254,7 +254,7 @@ public final class OTFAdvancedTypographi
private void readFeatureTable(TTFTableName tableTag, long featureTable, String featureTag, int featureIndex) throws IOException {
in.seekSet(featureTable);
if (log.isDebugEnabled()) {
- log.debug(tableTag + " feature table: " + featureTag );
+ log.debug(tableTag + " feature table: " + featureTag);
}
// read feature params offset
int po = in.readTTFUShort();
@@ -262,21 +262,21 @@ public final class OTFAdvancedTypographi
int nl = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " feature table parameters offset: " + po );
- log.debug(tableTag + " feature table lookup list index count: " + nl );
+ log.debug(tableTag + " feature table parameters offset: " + po);
+ log.debug(tableTag + " feature table lookup list index count: " + nl);
}
// read lookup table indices
int[] lia = new int[nl];
List lul = new java.util.ArrayList();
- for ( int i = 0; i < nl; i++ ) {
+ for (int i = 0; i < nl; i++) {
int li = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " feature table lookup index: " + li );
+ log.debug(tableTag + " feature table lookup index: " + li);
}
lia[i] = li;
- lul.add ( "lu" + li );
+ lul.add ("lu" + li);
}
- seFeatures.put ( "f" + featureIndex, new Object[] { featureTag, lul } );
+ seFeatures.put ("f" + featureIndex, new Object[] { featureTag, lul });
}
private void readFeatureList(TTFTableName tableTag, long featureList) throws IOException {
@@ -284,28 +284,28 @@ public final class OTFAdvancedTypographi
// read feature record count
int nf = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " feature list record count: " + nf );
+ log.debug(tableTag + " feature list record count: " + nf);
}
- if ( nf > 0 ) {
+ if (nf > 0) {
String[] fta = new String[nf];
int[] foa = new int[nf];
// read feature records
- for ( int i = 0, n = nf; i < n; i++ ) {
+ for (int i = 0, n = nf; i < n; i++) {
String ft = in.readTTFString(4);
int fo = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " feature tag: " + ft );
- log.debug(tableTag + " feature table offset: " + fo );
+ log.debug(tableTag + " feature tag: " + ft);
+ log.debug(tableTag + " feature table offset: " + fo);
}
fta[i] = ft;
foa[i] = fo;
}
// read feature tables
- for ( int i = 0, n = nf; i < n; i++ ) {
+ for (int i = 0, n = nf; i < n; i++) {
if (log.isDebugEnabled()) {
- log.debug(tableTag + " feature index: " + i );
+ log.debug(tableTag + " feature index: " + i);
}
- readFeatureTable ( tableTag, featureList + foa [ i ], fta [ i ], i );
+ readFeatureTable (tableTag, featureList + foa [ i ], fta [ i ], i);
}
}
}
@@ -317,9 +317,9 @@ public final class OTFAdvancedTypographi
static final int MARK_ATTACHMENT = 4;
private GDEFLookupType() {
}
- public static int getSubtableType ( int lt ) {
+ public static int getSubtableType (int lt) {
int st;
- switch ( lt ) {
+ switch (lt) {
case GDEFLookupType.GLYPH_CLASS:
st = GlyphDefinitionTable.GDEF_LOOKUP_TYPE_GLYPH_CLASS;
break;
@@ -340,7 +340,7 @@ public final class OTFAdvancedTypographi
}
public static String toString(int type) {
String s;
- switch ( type ) {
+ switch (type) {
case GLYPH_CLASS:
s = "GlyphClass";
break;
@@ -372,9 +372,9 @@ public final class OTFAdvancedTypographi
static final int REVERSE_CHAINED_SINGLE = 8;
private GSUBLookupType() {
}
- public static int getSubtableType ( int lt ) {
+ public static int getSubtableType (int lt) {
int st;
- switch ( lt ) {
+ switch (lt) {
case GSUBLookupType.SINGLE:
st = GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_SINGLE;
break;
@@ -407,7 +407,7 @@ public final class OTFAdvancedTypographi
}
public static String toString(int type) {
String s;
- switch ( type ) {
+ switch (type) {
case SINGLE:
s = "Single";
break;
@@ -454,7 +454,7 @@ public final class OTFAdvancedTypographi
}
public static String toString(int type) {
String s;
- switch ( type ) {
+ switch (type) {
case SINGLE:
s = "Single";
break;
@@ -502,48 +502,48 @@ public final class OTFAdvancedTypographi
public static String toString(int flags) {
StringBuffer sb = new StringBuffer();
boolean first = true;
- if ( ( flags & RIGHT_TO_LEFT ) != 0 ) {
- if ( first ) {
+ if ((flags & RIGHT_TO_LEFT) != 0) {
+ if (first) {
first = false;
} else {
- sb.append ( '|' );
+ sb.append ('|');
}
- sb.append ( "RightToLeft" );
+ sb.append ("RightToLeft");
}
- if ( ( flags & IGNORE_BASE_GLYPHS ) != 0 ) {
- if ( first ) {
+ if ((flags & IGNORE_BASE_GLYPHS) != 0) {
+ if (first) {
first = false;
} else {
- sb.append ( '|' );
+ sb.append ('|');
}
- sb.append ( "IgnoreBaseGlyphs" );
+ sb.append ("IgnoreBaseGlyphs");
}
- if ( ( flags & IGNORE_LIGATURE ) != 0 ) {
- if ( first ) {
+ if ((flags & IGNORE_LIGATURE) != 0) {
+ if (first) {
first = false;
} else {
- sb.append ( '|' );
+ sb.append ('|');
}
- sb.append ( "IgnoreLigature" );
+ sb.append ("IgnoreLigature");
}
- if ( ( flags & IGNORE_MARKS ) != 0 ) {
- if ( first ) {
+ if ((flags & IGNORE_MARKS) != 0) {
+ if (first) {
first = false;
} else {
- sb.append ( '|' );
+ sb.append ('|');
}
- sb.append ( "IgnoreMarks" );
+ sb.append ("IgnoreMarks");
}
- if ( ( flags & USE_MARK_FILTERING_SET ) != 0 ) {
- if ( first ) {
+ if ((flags & USE_MARK_FILTERING_SET) != 0) {
+ if (first) {
first = false;
} else {
- sb.append ( '|' );
+ sb.append ('|');
}
- sb.append ( "UseMarkFilteringSet" );
+ sb.append ("UseMarkFilteringSet");
}
- if ( sb.length() == 0 ) {
- sb.append ( '-' );
+ if (sb.length() == 0) {
+ sb.append ('-');
}
return sb.toString();
}
@@ -553,30 +553,30 @@ public final class OTFAdvancedTypographi
List entries = new java.util.ArrayList();
in.seekSet(tableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read glyph count
int ng = in.readTTFUShort();
int[] ga = new int[ng];
- for ( int i = 0, n = ng; i < n; i++ ) {
+ for (int i = 0, n = ng; i < n; i++) {
int g = in.readTTFUShort();
ga[i] = g;
- entries.add ( Integer.valueOf(g) );
+ entries.add (Integer.valueOf(g));
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(label + " glyphs: " + toString(ga) );
+ log.debug(label + " glyphs: " + toString(ga));
}
- return GlyphCoverageTable.createCoverageTable ( entries );
+ return GlyphCoverageTable.createCoverageTable (entries);
}
private GlyphCoverageTable readCoverageTableFormat2(String label, long tableOffset, int coverageFormat) throws IOException {
List entries = new java.util.ArrayList();
in.seekSet(tableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read range record count
int nr = in.readTTFUShort();
- for ( int i = 0, n = nr; i < n; i++ ) {
+ for (int i = 0, n = nr; i < n; i++) {
// read range start
int s = in.readTTFUShort();
// read range end
@@ -585,11 +585,11 @@ public final class OTFAdvancedTypographi
int m = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(label + " range[" + i + "]: [" + s + "," + e + "]: " + m );
+ log.debug(label + " range[" + i + "]: [" + s + "," + e + "]: " + m);
}
- entries.add ( new GlyphCoverageTable.MappingRange ( s, e, m ) );
+ entries.add (new GlyphCoverageTable.MappingRange (s, e, m));
}
- return GlyphCoverageTable.createCoverageTable ( entries );
+ return GlyphCoverageTable.createCoverageTable (entries);
}
private GlyphCoverageTable readCoverageTable(String label, long tableOffset) throws IOException {
@@ -598,14 +598,14 @@ public final class OTFAdvancedTypographi
in.seekSet(tableOffset);
// read coverage table format
int cf = in.readTTFUShort();
- if ( cf == 1 ) {
- gct = readCoverageTableFormat1 ( label, tableOffset, cf );
- } else if ( cf == 2 ) {
- gct = readCoverageTableFormat2 ( label, tableOffset, cf );
+ if (cf == 1) {
+ gct = readCoverageTableFormat1 (label, tableOffset, cf);
+ } else if (cf == 2) {
+ gct = readCoverageTableFormat2 (label, tableOffset, cf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported coverage table format: " + cf );
+ throw new AdvancedTypographicTableFormatException ("unsupported coverage table format: " + cf);
}
- in.seekSet ( cp );
+ in.seekSet (cp);
return gct;
}
@@ -613,34 +613,34 @@ public final class OTFAdvancedTypographi
List entries = new java.util.ArrayList();
in.seekSet(tableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read start glyph
int sg = in.readTTFUShort();
- entries.add ( Integer.valueOf(sg) );
+ entries.add (Integer.valueOf(sg));
// read glyph count
int ng = in.readTTFUShort();
// read glyph classes
int[] ca = new int[ng];
- for ( int i = 0, n = ng; i < n; i++ ) {
+ for (int i = 0, n = ng; i < n; i++) {
int gc = in.readTTFUShort();
ca[i] = gc;
- entries.add ( Integer.valueOf(gc) );
+ entries.add (Integer.valueOf(gc));
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(label + " glyph classes: " + toString(ca) );
+ log.debug(label + " glyph classes: " + toString(ca));
}
- return GlyphClassTable.createClassTable ( entries );
+ return GlyphClassTable.createClassTable (entries);
}
private GlyphClassTable readClassDefTableFormat2(String label, long tableOffset, int classFormat) throws IOException {
List entries = new java.util.ArrayList();
in.seekSet(tableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read range record count
int nr = in.readTTFUShort();
- for ( int i = 0, n = nr; i < n; i++ ) {
+ for (int i = 0, n = nr; i < n; i++) {
// read range start
int s = in.readTTFUShort();
// read range end
@@ -649,11 +649,11 @@ public final class OTFAdvancedTypographi
int m = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(label + " range[" + i + "]: [" + s + "," + e + "]: " + m );
+ log.debug(label + " range[" + i + "]: [" + s + "," + e + "]: " + m);
}
- entries.add ( new GlyphClassTable.MappingRange ( s, e, m ) );
+ entries.add (new GlyphClassTable.MappingRange (s, e, m));
}
- return GlyphClassTable.createClassTable ( entries );
+ return GlyphClassTable.createClassTable (entries);
}
private GlyphClassTable readClassDefTable(String label, long tableOffset) throws IOException {
@@ -662,14 +662,14 @@ public final class OTFAdvancedTypographi
in.seekSet(tableOffset);
// read class table format
int cf = in.readTTFUShort();
- if ( cf == 1 ) {
- gct = readClassDefTableFormat1 ( label, tableOffset, cf );
- } else if ( cf == 2 ) {
- gct = readClassDefTableFormat2 ( label, tableOffset, cf );
+ if (cf == 1) {
+ gct = readClassDefTableFormat1 (label, tableOffset, cf);
+ } else if (cf == 2) {
+ gct = readClassDefTableFormat2 (label, tableOffset, cf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported class definition table format: " + cf );
+ throw new AdvancedTypographicTableFormatException ("unsupported class definition table format: " + cf);
}
- in.seekSet ( cp );
+ in.seekSet (cp);
return gct;
}
@@ -677,48 +677,48 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read delta glyph
int dg = in.readTTFShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " single substitution subtable format: " + subtableFormat + " (delta)" );
- log.debug(tableTag + " single substitution coverage table offset: " + co );
- log.debug(tableTag + " single substitution delta: " + dg );
+ log.debug(tableTag + " single substitution subtable format: " + subtableFormat + " (delta)");
+ log.debug(tableTag + " single substitution coverage table offset: " + co);
+ log.debug(tableTag + " single substitution delta: " + dg);
}
// read coverage table
- seMapping = readCoverageTable ( tableTag + " single substitution coverage", subtableOffset + co );
- seEntries.add ( Integer.valueOf ( dg ) );
+ seMapping = readCoverageTable (tableTag + " single substitution coverage", subtableOffset + co);
+ seEntries.add (Integer.valueOf (dg));
}
private void readSingleSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException {
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read glyph count
int ng = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " single substitution subtable format: " + subtableFormat + " (mapped)" );
- log.debug(tableTag + " single substitution coverage table offset: " + co );
- log.debug(tableTag + " single substitution glyph count: " + ng );
+ log.debug(tableTag + " single substitution subtable format: " + subtableFormat + " (mapped)");
+ log.debug(tableTag + " single substitution coverage table offset: " + co);
+ log.debug(tableTag + " single substitution glyph count: " + ng);
}
// read coverage table
- seMapping = readCoverageTable ( tableTag + " single substitution coverage", subtableOffset + co );
+ seMapping = readCoverageTable (tableTag + " single substitution coverage", subtableOffset + co);
// read glyph substitutions
int[] gsa = new int[ng];
- for ( int i = 0, n = ng; i < n; i++ ) {
+ for (int i = 0, n = ng; i < n; i++) {
int gs = in.readTTFUShort();
if (log.isDebugEnabled()) {
- log.debug(tableTag + " single substitution glyph[" + i + "]: " + gs );
+ log.debug(tableTag + " single substitution glyph[" + i + "]: " + gs);
}
gsa[i] = gs;
- seEntries.add ( Integer.valueOf ( gs ) );
+ seEntries.add (Integer.valueOf (gs));
}
}
@@ -726,12 +726,12 @@ public final class OTFAdvancedTypographi
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readSingleSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
- } else if ( sf == 2 ) {
- readSingleSubTableFormat2 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readSingleSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
+ } else if (sf == 2) {
+ readSingleSubTableFormat2 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported single substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported single substitution subtable format: " + sf);
}
return sf;
}
@@ -740,56 +740,56 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read sequence count
int ns = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " multiple substitution subtable format: " + subtableFormat + " (mapped)" );
- log.debug(tableTag + " multiple substitution coverage table offset: " + co );
- log.debug(tableTag + " multiple substitution sequence count: " + ns );
+ log.debug(tableTag + " multiple substitution subtable format: " + subtableFormat + " (mapped)");
+ log.debug(tableTag + " multiple substitution coverage table offset: " + co);
+ log.debug(tableTag + " multiple substitution sequence count: " + ns);
}
// read coverage table
- seMapping = readCoverageTable ( tableTag + " multiple substitution coverage", subtableOffset + co );
+ seMapping = readCoverageTable (tableTag + " multiple substitution coverage", subtableOffset + co);
// read sequence table offsets
int[] soa = new int[ns];
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
soa[i] = in.readTTFUShort();
}
// read sequence tables
int[][] gsa = new int [ ns ] [];
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
int so = soa[i];
int[] ga;
- if ( so > 0 ) {
+ if (so > 0) {
in.seekSet(subtableOffset + so);
// read glyph count
int ng = in.readTTFUShort();
ga = new int[ng];
- for ( int j = 0; j < ng; j++ ) {
+ for (int j = 0; j < ng; j++) {
ga[j] = in.readTTFUShort();
}
} else {
ga = null;
}
if (log.isDebugEnabled()) {
- log.debug(tableTag + " multiple substitution sequence[" + i + "]: " + toString ( ga ) );
+ log.debug(tableTag + " multiple substitution sequence[" + i + "]: " + toString (ga));
}
gsa [ i ] = ga;
}
- seEntries.add ( gsa );
+ seEntries.add (gsa);
}
private int readMultipleSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException {
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readMultipleSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readMultipleSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported multiple substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported multiple substitution subtable format: " + sf);
}
return sf;
}
@@ -798,39 +798,39 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read alternate set count
int ns = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " alternate substitution subtable format: " + subtableFormat + " (mapped)" );
- log.debug(tableTag + " alternate substitution coverage table offset: " + co );
- log.debug(tableTag + " alternate substitution alternate set count: " + ns );
+ log.debug(tableTag + " alternate substitution subtable format: " + subtableFormat + " (mapped)");
+ log.debug(tableTag + " alternate substitution coverage table offset: " + co);
+ log.debug(tableTag + " alternate substitution alternate set count: " + ns);
}
// read coverage table
- seMapping = readCoverageTable ( tableTag + " alternate substitution coverage", subtableOffset + co );
+ seMapping = readCoverageTable (tableTag + " alternate substitution coverage", subtableOffset + co);
// read alternate set table offsets
int[] soa = new int[ns];
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
soa[i] = in.readTTFUShort();
}
// read alternate set tables
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
int so = soa[i];
in.seekSet(subtableOffset + so);
// read glyph count
int ng = in.readTTFUShort();
int[] ga = new int[ng];
- for ( int j = 0; j < ng; j++ ) {
+ for (int j = 0; j < ng; j++) {
int gs = in.readTTFUShort();
ga[j] = gs;
}
if (log.isDebugEnabled()) {
- log.debug(tableTag + " alternate substitution alternate set[" + i + "]: " + toString ( ga ) );
+ log.debug(tableTag + " alternate substitution alternate set[" + i + "]: " + toString (ga));
}
- seEntries.add ( ga );
+ seEntries.add (ga);
}
}
@@ -838,10 +838,10 @@ public final class OTFAdvancedTypographi
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readAlternateSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readAlternateSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported alternate substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported alternate substitution subtable format: " + sf);
}
return sf;
}
@@ -850,36 +850,36 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read ligature set count
int ns = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " ligature substitution subtable format: " + subtableFormat + " (mapped)" );
- log.debug(tableTag + " ligature substitution coverage table offset: " + co );
- log.debug(tableTag + " ligature substitution ligature set count: " + ns );
+ log.debug(tableTag + " ligature substitution subtable format: " + subtableFormat + " (mapped)");
+ log.debug(tableTag + " ligature substitution coverage table offset: " + co);
+ log.debug(tableTag + " ligature substitution ligature set count: " + ns);
}
// read coverage table
- seMapping = readCoverageTable ( tableTag + " ligature substitution coverage", subtableOffset + co );
+ seMapping = readCoverageTable (tableTag + " ligature substitution coverage", subtableOffset + co);
// read ligature set table offsets
int[] soa = new int[ns];
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
soa[i] = in.readTTFUShort();
}
// read ligature set tables
- for ( int i = 0, n = ns; i < n; i++ ) {
+ for (int i = 0, n = ns; i < n; i++) {
int so = soa[i];
in.seekSet(subtableOffset + so);
// read ligature table count
int nl = in.readTTFUShort();
int[] loa = new int[nl];
- for ( int j = 0; j < nl; j++ ) {
+ for (int j = 0; j < nl; j++) {
loa[j] = in.readTTFUShort();
}
List ligs = new java.util.ArrayList();
- for ( int j = 0; j < nl; j++ ) {
+ for (int j = 0; j < nl; j++) {
int lo = loa[j];
in.seekSet(subtableOffset + so + lo);
// read ligature glyph id
@@ -888,15 +888,15 @@ public final class OTFAdvancedTypographi
int nc = in.readTTFUShort();
int[] ca = new int [ nc - 1 ];
// read ligature (input) component glyph ids
- for ( int k = 0; k < nc - 1; k++ ) {
+ for (int k = 0; k < nc - 1; k++) {
ca[k] = in.readTTFUShort();
}
if (log.isDebugEnabled()) {
- log.debug(tableTag + " ligature substitution ligature set[" + i + "]: ligature(" + lg + "), components: " + toString ( ca ) );
+ log.debug(tableTag + " ligature substitution ligature set[" + i + "]: ligature(" + lg + "), components: " + toString (ca));
}
- ligs.add ( new GlyphSubstitutionTable.Ligature ( lg, ca ) );
+ ligs.add (new GlyphSubstitutionTable.Ligature (lg, ca));
}
- seEntries.add ( new GlyphSubstitutionTable.LigatureSet ( ligs ) );
+ seEntries.add (new GlyphSubstitutionTable.LigatureSet (ligs));
}
}
@@ -904,22 +904,22 @@ public final class OTFAdvancedTypographi
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readLigatureSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readLigatureSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported ligature substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported ligature substitution subtable format: " + sf);
}
return sf;
}
private GlyphTable.RuleLookup[] readRuleLookups(int numLookups, String header) throws IOException {
GlyphTable.RuleLookup[] la = new GlyphTable.RuleLookup [ numLookups ];
- for ( int i = 0, n = numLookups; i < n; i++ ) {
+ for (int i = 0, n = numLookups; i < n; i++) {
int sequenceIndex = in.readTTFUShort();
int lookupIndex = in.readTTFUShort();
- la [ i ] = new GlyphTable.RuleLookup ( sequenceIndex, lookupIndex );
+ la [ i ] = new GlyphTable.RuleLookup (sequenceIndex, lookupIndex);
// dump info if debugging and header is non-null
- if ( log.isDebugEnabled() && ( header != null ) ) {
+ if (log.isDebugEnabled() && (header != null)) {
log.debug(header + "lookup[" + i + "]: " + la[i]);
}
}
@@ -930,77 +930,77 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read rule set count
int nrs = in.readTTFUShort();
// read rule set offsets
int[] rsoa = new int [ nrs ];
- for ( int i = 0; i < nrs; i++ ) {
+ for (int i = 0; i < nrs; i++) {
rsoa [ i ] = in.readTTFUShort();
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " contextual substitution format: " + subtableFormat + " (glyphs)" );
- log.debug(tableTag + " contextual substitution coverage table offset: " + co );
- log.debug(tableTag + " contextual substitution rule set count: " + nrs );
- for ( int i = 0; i < nrs; i++ ) {
- log.debug(tableTag + " contextual substitution rule set offset[" + i + "]: " + rsoa[i] );
+ log.debug(tableTag + " contextual substitution format: " + subtableFormat + " (glyphs)");
+ log.debug(tableTag + " contextual substitution coverage table offset: " + co);
+ log.debug(tableTag + " contextual substitution rule set count: " + nrs);
+ for (int i = 0; i < nrs; i++) {
+ log.debug(tableTag + " contextual substitution rule set offset[" + i + "]: " + rsoa[i]);
}
}
// read coverage table
GlyphCoverageTable ct;
- if ( co > 0 ) {
- ct = readCoverageTable ( tableTag + " contextual substitution coverage", subtableOffset + co );
+ if (co > 0) {
+ ct = readCoverageTable (tableTag + " contextual substitution coverage", subtableOffset + co);
} else {
ct = null;
}
// read rule sets
GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet [ nrs ];
String header = null;
- for ( int i = 0; i < nrs; i++ ) {
+ for (int i = 0; i < nrs; i++) {
GlyphTable.RuleSet rs;
int rso = rsoa [ i ];
- if ( rso > 0 ) {
+ if (rso > 0) {
// seek to rule set [ i ]
- in.seekSet ( subtableOffset + rso );
+ in.seekSet (subtableOffset + rso);
// read rule count
int nr = in.readTTFUShort();
// read rule offsets
int[] roa = new int [ nr ];
GlyphTable.Rule[] ra = new GlyphTable.Rule [ nr ];
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
roa [ j ] = in.readTTFUShort();
}
// read glyph sequence rules
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
GlyphTable.GlyphSequenceRule r;
int ro = roa [ j ];
- if ( ro > 0 ) {
+ if (ro > 0) {
// seek to rule [ j ]
- in.seekSet ( subtableOffset + rso + ro );
+ in.seekSet (subtableOffset + rso + ro);
// read glyph count
int ng = in.readTTFUShort();
// read rule lookup count
int nl = in.readTTFUShort();
// read glyphs
int[] glyphs = new int [ ng - 1 ];
- for ( int k = 0, nk = glyphs.length; k < nk; k++ ) {
+ for (int k = 0, nk = glyphs.length; k < nk; k++) {
glyphs [ k ] = in.readTTFUShort();
}
// read rule lookups
if (log.isDebugEnabled()) {
header = tableTag + " contextual substitution lookups @rule[" + i + "][" + j + "]: ";
}
- GlyphTable.RuleLookup[] lookups = readRuleLookups ( nl, header );
- r = new GlyphTable.GlyphSequenceRule ( lookups, ng, glyphs );
+ GlyphTable.RuleLookup[] lookups = readRuleLookups (nl, header);
+ r = new GlyphTable.GlyphSequenceRule (lookups, ng, glyphs);
} else {
r = null;
}
ra [ j ] = r;
}
- rs = new GlyphTable.HomogeneousRuleSet ( ra );
+ rs = new GlyphTable.HomogeneousRuleSet (ra);
} else {
rs = null;
}
@@ -1008,14 +1008,14 @@ public final class OTFAdvancedTypographi
}
// store results
seMapping = ct;
- seEntries.add ( rsa );
+ seEntries.add (rsa);
}
private void readContextualSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException {
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read class def table offset
@@ -1024,78 +1024,78 @@ public final class OTFAdvancedTypographi
int ngc = in.readTTFUShort();
// read class rule set offsets
int[] csoa = new int [ ngc ];
- for ( int i = 0; i < ngc; i++ ) {
+ for (int i = 0; i < ngc; i++) {
csoa [ i ] = in.readTTFUShort();
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " contextual substitution format: " + subtableFormat + " (glyph classes)" );
- log.debug(tableTag + " contextual substitution coverage table offset: " + co );
- log.debug(tableTag + " contextual substitution class set count: " + ngc );
- for ( int i = 0; i < ngc; i++ ) {
- log.debug(tableTag + " contextual substitution class set offset[" + i + "]: " + csoa[i] );
+ log.debug(tableTag + " contextual substitution format: " + subtableFormat + " (glyph classes)");
+ log.debug(tableTag + " contextual substitution coverage table offset: " + co);
+ log.debug(tableTag + " contextual substitution class set count: " + ngc);
+ for (int i = 0; i < ngc; i++) {
+ log.debug(tableTag + " contextual substitution class set offset[" + i + "]: " + csoa[i]);
}
}
// read coverage table
GlyphCoverageTable ct;
- if ( co > 0 ) {
- ct = readCoverageTable ( tableTag + " contextual substitution coverage", subtableOffset + co );
+ if (co > 0) {
+ ct = readCoverageTable (tableTag + " contextual substitution coverage", subtableOffset + co);
} else {
ct = null;
}
// read class definition table
GlyphClassTable cdt;
- if ( cdo > 0 ) {
- cdt = readClassDefTable ( tableTag + " contextual substitution class definition", subtableOffset + cdo );
+ if (cdo > 0) {
+ cdt = readClassDefTable (tableTag + " contextual substitution class definition", subtableOffset + cdo);
} else {
cdt = null;
}
// read rule sets
GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet [ ngc ];
String header = null;
- for ( int i = 0; i < ngc; i++ ) {
+ for (int i = 0; i < ngc; i++) {
int cso = csoa [ i ];
GlyphTable.RuleSet rs;
- if ( cso > 0 ) {
+ if (cso > 0) {
// seek to rule set [ i ]
- in.seekSet ( subtableOffset + cso );
+ in.seekSet (subtableOffset + cso);
// read rule count
int nr = in.readTTFUShort();
// read rule offsets
int[] roa = new int [ nr ];
GlyphTable.Rule[] ra = new GlyphTable.Rule [ nr ];
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
roa [ j ] = in.readTTFUShort();
}
// read glyph sequence rules
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
int ro = roa [ j ];
GlyphTable.ClassSequenceRule r;
- if ( ro > 0 ) {
+ if (ro > 0) {
// seek to rule [ j ]
- in.seekSet ( subtableOffset + cso + ro );
+ in.seekSet (subtableOffset + cso + ro);
// read glyph count
int ng = in.readTTFUShort();
// read rule lookup count
int nl = in.readTTFUShort();
// read classes
int[] classes = new int [ ng - 1 ];
- for ( int k = 0, nk = classes.length; k < nk; k++ ) {
+ for (int k = 0, nk = classes.length; k < nk; k++) {
classes [ k ] = in.readTTFUShort();
}
// read rule lookups
if (log.isDebugEnabled()) {
header = tableTag + " contextual substitution lookups @rule[" + i + "][" + j + "]: ";
}
- GlyphTable.RuleLookup[] lookups = readRuleLookups ( nl, header );
- r = new GlyphTable.ClassSequenceRule ( lookups, ng, classes );
+ GlyphTable.RuleLookup[] lookups = readRuleLookups (nl, header);
+ r = new GlyphTable.ClassSequenceRule (lookups, ng, classes);
} else {
assert ro > 0 : "unexpected null subclass rule offset";
r = null;
}
ra [ j ] = r;
}
- rs = new GlyphTable.HomogeneousRuleSet ( ra );
+ rs = new GlyphTable.HomogeneousRuleSet (ra);
} else {
rs = null;
}
@@ -1103,41 +1103,41 @@ public final class OTFAdvancedTypographi
}
// store results
seMapping = ct;
- seEntries.add ( cdt );
- seEntries.add ( Integer.valueOf ( ngc ) );
- seEntries.add ( rsa );
+ seEntries.add (cdt);
+ seEntries.add (Integer.valueOf (ngc));
+ seEntries.add (rsa);
}
private void readContextualSubTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException {
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read glyph (input sequence length) count
int ng = in.readTTFUShort();
// read substitution lookup count
int nl = in.readTTFUShort();
// read glyph coverage offsets, one per glyph input sequence length count
int[] gcoa = new int [ ng ];
- for ( int i = 0; i < ng; i++ ) {
+ for (int i = 0; i < ng; i++) {
gcoa [ i ] = in.readTTFUShort();
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " contextual substitution format: " + subtableFormat + " (glyph sets)" );
- log.debug(tableTag + " contextual substitution glyph input sequence length count: " + ng );
- log.debug(tableTag + " contextual substitution lookup count: " + nl );
- for ( int i = 0; i < ng; i++ ) {
- log.debug(tableTag + " contextual substitution coverage table offset[" + i + "]: " + gcoa[i] );
+ log.debug(tableTag + " contextual substitution format: " + subtableFormat + " (glyph sets)");
+ log.debug(tableTag + " contextual substitution glyph input sequence length count: " + ng);
+ log.debug(tableTag + " contextual substitution lookup count: " + nl);
+ for (int i = 0; i < ng; i++) {
+ log.debug(tableTag + " contextual substitution coverage table offset[" + i + "]: " + gcoa[i]);
}
}
// read coverage tables
GlyphCoverageTable[] gca = new GlyphCoverageTable [ ng ];
- for ( int i = 0; i < ng; i++ ) {
+ for (int i = 0; i < ng; i++) {
int gco = gcoa [ i ];
GlyphCoverageTable gct;
- if ( gco > 0 ) {
- gct = readCoverageTable ( tableTag + " contextual substitution coverage[" + i + "]", subtableOffset + gco );
+ if (gco > 0) {
+ gct = readCoverageTable (tableTag + " contextual substitution coverage[" + i + "]", subtableOffset + gco);
} else {
gct = null;
}
@@ -1148,29 +1148,29 @@ public final class OTFAdvancedTypographi
if (log.isDebugEnabled()) {
header = tableTag + " contextual substitution lookups: ";
}
- GlyphTable.RuleLookup[] lookups = readRuleLookups ( nl, header );
+ GlyphTable.RuleLookup[] lookups = readRuleLookups (nl, header);
// construct rule, rule set, and rule set array
- GlyphTable.Rule r = new GlyphTable.CoverageSequenceRule ( lookups, ng, gca );
- GlyphTable.RuleSet rs = new GlyphTable.HomogeneousRuleSet ( new GlyphTable.Rule[] {r} );
+ GlyphTable.Rule r = new GlyphTable.CoverageSequenceRule (lookups, ng, gca);
+ GlyphTable.RuleSet rs = new GlyphTable.HomogeneousRuleSet (new GlyphTable.Rule[] {r});
GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet[] {rs};
// store results
- assert ( gca != null ) && ( gca.length > 0 );
+ assert (gca != null) && (gca.length > 0);
seMapping = gca[0];
- seEntries.add ( rsa );
+ seEntries.add (rsa);
}
private int readContextualSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException {
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readContextualSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
- } else if ( sf == 2 ) {
- readContextualSubTableFormat2 ( lookupType, lookupFlags, subtableOffset, sf );
- } else if ( sf == 3 ) {
- readContextualSubTableFormat3 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readContextualSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
+ } else if (sf == 2) {
+ readContextualSubTableFormat2 (lookupType, lookupFlags, subtableOffset, sf);
+ } else if (sf == 3) {
+ readContextualSubTableFormat3 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported contextual substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported contextual substitution subtable format: " + sf);
}
return sf;
}
@@ -1179,75 +1179,75 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read rule set count
int nrs = in.readTTFUShort();
// read rule set offsets
int[] rsoa = new int [ nrs ];
- for ( int i = 0; i < nrs; i++ ) {
+ for (int i = 0; i < nrs; i++) {
rsoa [ i ] = in.readTTFUShort();
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " chained contextual substitution format: " + subtableFormat + " (glyphs)" );
- log.debug(tableTag + " chained contextual substitution coverage table offset: " + co );
- log.debug(tableTag + " chained contextual substitution rule set count: " + nrs );
- for ( int i = 0; i < nrs; i++ ) {
- log.debug(tableTag + " chained contextual substitution rule set offset[" + i + "]: " + rsoa[i] );
+ log.debug(tableTag + " chained contextual substitution format: " + subtableFormat + " (glyphs)");
+ log.debug(tableTag + " chained contextual substitution coverage table offset: " + co);
+ log.debug(tableTag + " chained contextual substitution rule set count: " + nrs);
+ for (int i = 0; i < nrs; i++) {
+ log.debug(tableTag + " chained contextual substitution rule set offset[" + i + "]: " + rsoa[i]);
}
}
// read coverage table
GlyphCoverageTable ct;
- if ( co > 0 ) {
- ct = readCoverageTable ( tableTag + " chained contextual substitution coverage", subtableOffset + co );
+ if (co > 0) {
+ ct = readCoverageTable (tableTag + " chained contextual substitution coverage", subtableOffset + co);
} else {
ct = null;
}
// read rule sets
GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet [ nrs ];
String header = null;
- for ( int i = 0; i < nrs; i++ ) {
+ for (int i = 0; i < nrs; i++) {
GlyphTable.RuleSet rs;
int rso = rsoa [ i ];
- if ( rso > 0 ) {
+ if (rso > 0) {
// seek to rule set [ i ]
- in.seekSet ( subtableOffset + rso );
+ in.seekSet (subtableOffset + rso);
// read rule count
int nr = in.readTTFUShort();
// read rule offsets
int[] roa = new int [ nr ];
GlyphTable.Rule[] ra = new GlyphTable.Rule [ nr ];
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
roa [ j ] = in.readTTFUShort();
}
// read glyph sequence rules
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
GlyphTable.ChainedGlyphSequenceRule r;
int ro = roa [ j ];
- if ( ro > 0 ) {
+ if (ro > 0) {
// seek to rule [ j ]
- in.seekSet ( subtableOffset + rso + ro );
+ in.seekSet (subtableOffset + rso + ro);
// read backtrack glyph count
int nbg = in.readTTFUShort();
// read backtrack glyphs
int[] backtrackGlyphs = new int [ nbg ];
- for ( int k = 0, nk = backtrackGlyphs.length; k < nk; k++ ) {
+ for (int k = 0, nk = backtrackGlyphs.length; k < nk; k++) {
backtrackGlyphs [ k ] = in.readTTFUShort();
}
// read input glyph count
int nig = in.readTTFUShort();
// read glyphs
int[] glyphs = new int [ nig - 1 ];
- for ( int k = 0, nk = glyphs.length; k < nk; k++ ) {
+ for (int k = 0, nk = glyphs.length; k < nk; k++) {
glyphs [ k ] = in.readTTFUShort();
}
// read lookahead glyph count
int nlg = in.readTTFUShort();
// read lookahead glyphs
int[] lookaheadGlyphs = new int [ nlg ];
- for ( int k = 0, nk = lookaheadGlyphs.length; k < nk; k++ ) {
+ for (int k = 0, nk = lookaheadGlyphs.length; k < nk; k++) {
lookaheadGlyphs [ k ] = in.readTTFUShort();
}
// read rule lookup count
@@ -1256,14 +1256,14 @@ public final class OTFAdvancedTypographi
if (log.isDebugEnabled()) {
header = tableTag + " contextual substitution lookups @rule[" + i + "][" + j + "]: ";
}
- GlyphTable.RuleLookup[] lookups = readRuleLookups ( nl, header );
- r = new GlyphTable.ChainedGlyphSequenceRule ( lookups, nig, glyphs, backtrackGlyphs, lookaheadGlyphs );
+ GlyphTable.RuleLookup[] lookups = readRuleLookups (nl, header);
+ r = new GlyphTable.ChainedGlyphSequenceRule (lookups, nig, glyphs, backtrackGlyphs, lookaheadGlyphs);
} else {
r = null;
}
ra [ j ] = r;
}
- rs = new GlyphTable.HomogeneousRuleSet ( ra );
+ rs = new GlyphTable.HomogeneousRuleSet (ra);
} else {
rs = null;
}
@@ -1271,14 +1271,14 @@ public final class OTFAdvancedTypographi
}
// store results
seMapping = ct;
- seEntries.add ( rsa );
+ seEntries.add (rsa);
}
private void readChainedContextualSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException {
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read backtrack class def table offset
@@ -1291,89 +1291,89 @@ public final class OTFAdvancedTypographi
int ngc = in.readTTFUShort();
// read class set offsets
int[] csoa = new int [ ngc ];
- for ( int i = 0; i < ngc; i++ ) {
+ for (int i = 0; i < ngc; i++) {
csoa [ i ] = in.readTTFUShort();
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " chained contextual substitution format: " + subtableFormat + " (glyph classes)" );
- log.debug(tableTag + " chained contextual substitution coverage table offset: " + co );
- log.debug(tableTag + " chained contextual substitution class set count: " + ngc );
- for ( int i = 0; i < ngc; i++ ) {
- log.debug(tableTag + " chained contextual substitution class set offset[" + i + "]: " + csoa[i] );
+ log.debug(tableTag + " chained contextual substitution format: " + subtableFormat + " (glyph classes)");
+ log.debug(tableTag + " chained contextual substitution coverage table offset: " + co);
+ log.debug(tableTag + " chained contextual substitution class set count: " + ngc);
+ for (int i = 0; i < ngc; i++) {
+ log.debug(tableTag + " chained contextual substitution class set offset[" + i + "]: " + csoa[i]);
}
}
// read coverage table
GlyphCoverageTable ct;
- if ( co > 0 ) {
- ct = readCoverageTable ( tableTag + " chained contextual substitution coverage", subtableOffset + co );
+ if (co > 0) {
+ ct = readCoverageTable (tableTag + " chained contextual substitution coverage", subtableOffset + co);
} else {
ct = null;
}
// read backtrack class definition table
GlyphClassTable bcdt;
- if ( bcdo > 0 ) {
- bcdt = readClassDefTable ( tableTag + " contextual substitution backtrack class definition", subtableOffset + bcdo );
+ if (bcdo > 0) {
+ bcdt = readClassDefTable (tableTag + " contextual substitution backtrack class definition", subtableOffset + bcdo);
} else {
bcdt = null;
}
// read input class definition table
GlyphClassTable icdt;
- if ( icdo > 0 ) {
- icdt = readClassDefTable ( tableTag + " contextual substitution input class definition", subtableOffset + icdo );
+ if (icdo > 0) {
+ icdt = readClassDefTable (tableTag + " contextual substitution input class definition", subtableOffset + icdo);
} else {
icdt = null;
}
// read lookahead class definition table
GlyphClassTable lcdt;
- if ( lcdo > 0 ) {
- lcdt = readClassDefTable ( tableTag + " contextual substitution lookahead class definition", subtableOffset + lcdo );
+ if (lcdo > 0) {
+ lcdt = readClassDefTable (tableTag + " contextual substitution lookahead class definition", subtableOffset + lcdo);
} else {
lcdt = null;
}
// read rule sets
GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet [ ngc ];
String header = null;
- for ( int i = 0; i < ngc; i++ ) {
+ for (int i = 0; i < ngc; i++) {
int cso = csoa [ i ];
GlyphTable.RuleSet rs;
- if ( cso > 0 ) {
+ if (cso > 0) {
// seek to rule set [ i ]
- in.seekSet ( subtableOffset + cso );
+ in.seekSet (subtableOffset + cso);
// read rule count
int nr = in.readTTFUShort();
// read rule offsets
int[] roa = new int [ nr ];
GlyphTable.Rule[] ra = new GlyphTable.Rule [ nr ];
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
roa [ j ] = in.readTTFUShort();
}
// read glyph sequence rules
- for ( int j = 0; j < nr; j++ ) {
+ for (int j = 0; j < nr; j++) {
int ro = roa [ j ];
GlyphTable.ChainedClassSequenceRule r;
- if ( ro > 0 ) {
+ if (ro > 0) {
// seek to rule [ j ]
- in.seekSet ( subtableOffset + cso + ro );
+ in.seekSet (subtableOffset + cso + ro);
// read backtrack glyph class count
int nbc = in.readTTFUShort();
// read backtrack glyph classes
int[] backtrackClasses = new int [ nbc ];
- for ( int k = 0, nk = backtrackClasses.length; k < nk; k++ ) {
+ for (int k = 0, nk = backtrackClasses.length; k < nk; k++) {
backtrackClasses [ k ] = in.readTTFUShort();
}
// read input glyph class count
int nic = in.readTTFUShort();
// read input glyph classes
int[] classes = new int [ nic - 1 ];
- for ( int k = 0, nk = classes.length; k < nk; k++ ) {
+ for (int k = 0, nk = classes.length; k < nk; k++) {
classes [ k ] = in.readTTFUShort();
}
// read lookahead glyph class count
int nlc = in.readTTFUShort();
// read lookahead glyph classes
int[] lookaheadClasses = new int [ nlc ];
- for ( int k = 0, nk = lookaheadClasses.length; k < nk; k++ ) {
+ for (int k = 0, nk = lookaheadClasses.length; k < nk; k++) {
lookaheadClasses [ k ] = in.readTTFUShort();
}
// read rule lookup count
@@ -1382,14 +1382,14 @@ public final class OTFAdvancedTypographi
if (log.isDebugEnabled()) {
header = tableTag + " contextual substitution lookups @rule[" + i + "][" + j + "]: ";
}
- GlyphTable.RuleLookup[] lookups = readRuleLookups ( nl, header );
- r = new GlyphTable.ChainedClassSequenceRule ( lookups, nic, classes, backtrackClasses, lookaheadClasses );
+ GlyphTable.RuleLookup[] lookups = readRuleLookups (nl, header);
+ r = new GlyphTable.ChainedClassSequenceRule (lookups, nic, classes, backtrackClasses, lookaheadClasses);
} else {
r = null;
}
ra [ j ] = r;
}
- rs = new GlyphTable.HomogeneousRuleSet ( ra );
+ rs = new GlyphTable.HomogeneousRuleSet (ra);
} else {
rs = null;
}
@@ -1397,65 +1397,65 @@ public final class OTFAdvancedTypographi
}
// store results
seMapping = ct;
- seEntries.add ( icdt );
- seEntries.add ( bcdt );
- seEntries.add ( lcdt );
- seEntries.add ( Integer.valueOf ( ngc ) );
- seEntries.add ( rsa );
+ seEntries.add (icdt);
+ seEntries.add (bcdt);
+ seEntries.add (lcdt);
+ seEntries.add (Integer.valueOf (ngc));
+ seEntries.add (rsa);
}
private void readChainedContextualSubTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException {
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read backtrack glyph count
int nbg = in.readTTFUShort();
// read backtrack glyph coverage offsets
int[] bgcoa = new int [ nbg ];
- for ( int i = 0; i < nbg; i++ ) {
+ for (int i = 0; i < nbg; i++) {
bgcoa [ i ] = in.readTTFUShort();
}
// read input glyph count
int nig = in.readTTFUShort();
// read input glyph coverage offsets
int[] igcoa = new int [ nig ];
- for ( int i = 0; i < nig; i++ ) {
+ for (int i = 0; i < nig; i++) {
igcoa [ i ] = in.readTTFUShort();
}
// read lookahead glyph count
int nlg = in.readTTFUShort();
// read lookahead glyph coverage offsets
int[] lgcoa = new int [ nlg ];
- for ( int i = 0; i < nlg; i++ ) {
+ for (int i = 0; i < nlg; i++) {
lgcoa [ i ] = in.readTTFUShort();
}
// read substitution lookup count
int nl = in.readTTFUShort();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " chained contextual substitution format: " + subtableFormat + " (glyph sets)" );
- log.debug(tableTag + " chained contextual substitution backtrack glyph count: " + nbg );
- for ( int i = 0; i < nbg; i++ ) {
- log.debug(tableTag + " chained contextual substitution backtrack coverage table offset[" + i + "]: " + bgcoa[i] );
- }
- log.debug(tableTag + " chained contextual substitution input glyph count: " + nig );
- for ( int i = 0; i < nig; i++ ) {
- log.debug(tableTag + " chained contextual substitution input coverage table offset[" + i + "]: " + igcoa[i] );
- }
- log.debug(tableTag + " chained contextual substitution lookahead glyph count: " + nlg );
- for ( int i = 0; i < nlg; i++ ) {
- log.debug(tableTag + " chained contextual substitution lookahead coverage table offset[" + i + "]: " + lgcoa[i] );
+ log.debug(tableTag + " chained contextual substitution format: " + subtableFormat + " (glyph sets)");
+ log.debug(tableTag + " chained contextual substitution backtrack glyph count: " + nbg);
+ for (int i = 0; i < nbg; i++) {
+ log.debug(tableTag + " chained contextual substitution backtrack coverage table offset[" + i + "]: " + bgcoa[i]);
+ }
+ log.debug(tableTag + " chained contextual substitution input glyph count: " + nig);
+ for (int i = 0; i < nig; i++) {
+ log.debug(tableTag + " chained contextual substitution input coverage table offset[" + i + "]: " + igcoa[i]);
+ }
+ log.debug(tableTag + " chained contextual substitution lookahead glyph count: " + nlg);
+ for (int i = 0; i < nlg; i++) {
+ log.debug(tableTag + " chained contextual substitution lookahead coverage table offset[" + i + "]: " + lgcoa[i]);
}
- log.debug(tableTag + " chained contextual substitution lookup count: " + nl );
+ log.debug(tableTag + " chained contextual substitution lookup count: " + nl);
}
// read backtrack coverage tables
GlyphCoverageTable[] bgca = new GlyphCoverageTable[nbg];
- for ( int i = 0; i < nbg; i++ ) {
+ for (int i = 0; i < nbg; i++) {
int bgco = bgcoa [ i ];
GlyphCoverageTable bgct;
- if ( bgco > 0 ) {
- bgct = readCoverageTable ( tableTag + " chained contextual substitution backtrack coverage[" + i + "]", subtableOffset + bgco );
+ if (bgco > 0) {
+ bgct = readCoverageTable (tableTag + " chained contextual substitution backtrack coverage[" + i + "]", subtableOffset + bgco);
} else {
bgct = null;
}
@@ -1463,11 +1463,11 @@ public final class OTFAdvancedTypographi
}
// read input coverage tables
GlyphCoverageTable[] igca = new GlyphCoverageTable[nig];
- for ( int i = 0; i < nig; i++ ) {
+ for (int i = 0; i < nig; i++) {
int igco = igcoa [ i ];
GlyphCoverageTable igct;
- if ( igco > 0 ) {
- igct = readCoverageTable ( tableTag + " chained contextual substitution input coverage[" + i + "]", subtableOffset + igco );
+ if (igco > 0) {
+ igct = readCoverageTable (tableTag + " chained contextual substitution input coverage[" + i + "]", subtableOffset + igco);
} else {
igct = null;
}
@@ -1475,11 +1475,11 @@ public final class OTFAdvancedTypographi
}
// read lookahead coverage tables
GlyphCoverageTable[] lgca = new GlyphCoverageTable[nlg];
- for ( int i = 0; i < nlg; i++ ) {
+ for (int i = 0; i < nlg; i++) {
int lgco = lgcoa [ i ];
GlyphCoverageTable lgct;
- if ( lgco > 0 ) {
- lgct = readCoverageTable ( tableTag + " chained contextual substitution lookahead coverage[" + i + "]", subtableOffset + lgco );
+ if (lgco > 0) {
+ lgct = readCoverageTable (tableTag + " chained contextual substitution lookahead coverage[" + i + "]", subtableOffset + lgco);
} else {
lgct = null;
}
@@ -1490,29 +1490,29 @@ public final class OTFAdvancedTypographi
if (log.isDebugEnabled()) {
header = tableTag + " chained contextual substitution lookups: ";
}
- GlyphTable.RuleLookup[] lookups = readRuleLookups ( nl, header );
+ GlyphTable.RuleLookup[] lookups = readRuleLookups (nl, header);
// construct rule, rule set, and rule set array
- GlyphTable.Rule r = new GlyphTable.ChainedCoverageSequenceRule ( lookups, nig, igca, bgca, lgca );
- GlyphTable.RuleSet rs = new GlyphTable.HomogeneousRuleSet ( new GlyphTable.Rule[] {r} );
+ GlyphTable.Rule r = new GlyphTable.ChainedCoverageSequenceRule (lookups, nig, igca, bgca, lgca);
+ GlyphTable.RuleSet rs = new GlyphTable.HomogeneousRuleSet (new GlyphTable.Rule[] {r});
GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet[] {rs};
// store results
- assert ( igca != null ) && ( igca.length > 0 );
+ assert (igca != null) && (igca.length > 0);
seMapping = igca[0];
- seEntries.add ( rsa );
+ seEntries.add (rsa);
}
private int readChainedContextualSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException {
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readChainedContextualSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
- } else if ( sf == 2 ) {
- readChainedContextualSubTableFormat2 ( lookupType, lookupFlags, subtableOffset, sf );
- } else if ( sf == 3 ) {
- readChainedContextualSubTableFormat3 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readChainedContextualSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
+ } else if (sf == 2) {
+ readChainedContextualSubTableFormat2 (lookupType, lookupFlags, subtableOffset, sf);
+ } else if (sf == 3) {
+ readChainedContextualSubTableFormat3 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported chained contextual substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported chained contextual substitution subtable format: " + sf);
}
return sf;
}
@@ -1521,29 +1521,29 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read extension lookup type
int lt = in.readTTFUShort();
// read extension offset
long eo = in.readTTFULong();
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " extension substitution subtable format: " + subtableFormat );
- log.debug(tableTag + " extension substitution lookup type: " + lt );
- log.debug(tableTag + " extension substitution lookup table offset: " + eo );
+ log.debug(tableTag + " extension substitution subtable format: " + subtableFormat);
+ log.debug(tableTag + " extension substitution lookup type: " + lt);
+ log.debug(tableTag + " extension substitution lookup table offset: " + eo);
}
// read referenced subtable from extended offset
- readGSUBSubtable ( lt, lookupFlags, lookupSequence, subtableSequence, subtableOffset + eo );
+ readGSUBSubtable (lt, lookupFlags, lookupSequence, subtableSequence, subtableOffset + eo);
}
private int readExtensionSubTable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) throws IOException {
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readExtensionSubTableFormat1 ( lookupType, lookupFlags, lookupSequence, subtableSequence, subtableOffset, sf );
+ if (sf == 1) {
+ readExtensionSubTableFormat1 (lookupType, lookupFlags, lookupSequence, subtableSequence, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported extension substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported extension substitution subtable format: " + sf);
}
return sf;
}
@@ -1552,53 +1552,53 @@ public final class OTFAdvancedTypographi
String tableTag = "GSUB";
in.seekSet(subtableOffset);
// skip over format (already known)
- in.skip ( 2 );
+ in.skip (2);
// read coverage offset
int co = in.readTTFUShort();
// read backtrack glyph count
int nbg = in.readTTFUShort();
// read backtrack glyph coverage offsets
int[] bgcoa = new int [ nbg ];
- for ( int i = 0; i < nbg; i++ ) {
+ for (int i = 0; i < nbg; i++) {
bgcoa [ i ] = in.readTTFUShort();
}
// read lookahead glyph count
int nlg = in.readTTFUShort();
// read backtrack glyph coverage offsets
int[] lgcoa = new int [ nlg ];
- for ( int i = 0; i < nlg; i++ ) {
+ for (int i = 0; i < nlg; i++) {
lgcoa [ i ] = in.readTTFUShort();
}
// read substitution (output) glyph count
int ng = in.readTTFUShort();
// read substitution (output) glyphs
int[] glyphs = new int [ ng ];
- for ( int i = 0, n = ng; i < n; i++ ) {
+ for (int i = 0, n = ng; i < n; i++) {
glyphs [ i ] = in.readTTFUShort();
}
// dump info if debugging
if (log.isDebugEnabled()) {
- log.debug(tableTag + " reverse chained contextual substitution format: " + subtableFormat );
- log.debug(tableTag + " reverse chained contextual substitution coverage table offset: " + co );
- log.debug(tableTag + " reverse chained contextual substitution backtrack glyph count: " + nbg );
- for ( int i = 0; i < nbg; i++ ) {
- log.debug(tableTag + " reverse chained contextual substitution backtrack coverage table offset[" + i + "]: " + bgcoa[i] );
+ log.debug(tableTag + " reverse chained contextual substitution format: " + subtableFormat);
+ log.debug(tableTag + " reverse chained contextual substitution coverage table offset: " + co);
+ log.debug(tableTag + " reverse chained contextual substitution backtrack glyph count: " + nbg);
+ for (int i = 0; i < nbg; i++) {
+ log.debug(tableTag + " reverse chained contextual substitution backtrack coverage table offset[" + i + "]: " + bgcoa[i]);
}
- log.debug(tableTag + " reverse chained contextual substitution lookahead glyph count: " + nlg );
- for ( int i = 0; i < nlg; i++ ) {
- log.debug(tableTag + " reverse chained contextual substitution lookahead coverage table offset[" + i + "]: " + lgcoa[i] );
+ log.debug(tableTag + " reverse chained contextual substitution lookahead glyph count: " + nlg);
+ for (int i = 0; i < nlg; i++) {
+ log.debug(tableTag + " reverse chained contextual substitution lookahead coverage table offset[" + i + "]: " + lgcoa[i]);
}
- log.debug(tableTag + " reverse chained contextual substitution glyphs: " + toString(glyphs) );
+ log.debug(tableTag + " reverse chained contextual substitution glyphs: " + toString(glyphs));
}
// read coverage table
- GlyphCoverageTable ct = readCoverageTable ( tableTag + " reverse chained contextual substitution coverage", subtableOffset + co );
+ GlyphCoverageTable ct = readCoverageTable (tableTag + " reverse chained contextual substitution coverage", subtableOffset + co);
// read backtrack coverage tables
GlyphCoverageTable[] bgca = new GlyphCoverageTable[nbg];
- for ( int i = 0; i < nbg; i++ ) {
+ for (int i = 0; i < nbg; i++) {
int bgco = bgcoa[i];
GlyphCoverageTable bgct;
- if ( bgco > 0 ) {
- bgct = readCoverageTable ( tableTag + " reverse chained contextual substitution backtrack coverage[" + i + "]", subtableOffset + bgco );
+ if (bgco > 0) {
+ bgct = readCoverageTable (tableTag + " reverse chained contextual substitution backtrack coverage[" + i + "]", subtableOffset + bgco);
} else {
bgct = null;
}
@@ -1606,11 +1606,11 @@ public final class OTFAdvancedTypographi
}
// read lookahead coverage tables
GlyphCoverageTable[] lgca = new GlyphCoverageTable[nlg];
- for ( int i = 0; i < nlg; i++ ) {
+ for (int i = 0; i < nlg; i++) {
int lgco = lgcoa[i];
GlyphCoverageTable lgct;
- if ( lgco > 0 ) {
- lgct = readCoverageTable ( tableTag + " reverse chained contextual substitution lookahead coverage[" + i + "]", subtableOffset + lgco );
+ if (lgco > 0) {
+ lgct = readCoverageTable (tableTag + " reverse chained contextual substitution lookahead coverage[" + i + "]", subtableOffset + lgco);
} else {
lgct = null;
}
@@ -1618,19 +1618,19 @@ public final class OTFAdvancedTypographi
}
// store results
seMapping = ct;
- seEntries.add ( bgca );
- seEntries.add ( lgca );
- seEntries.add ( glyphs );
+ seEntries.add (bgca);
+ seEntries.add (lgca);
+ seEntries.add (glyphs);
}
private int readReverseChainedSingleSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException {
in.seekSet(subtableOffset);
// read substitution subtable format
int sf = in.readTTFUShort();
- if ( sf == 1 ) {
- readReverseChainedSingleSubTableFormat1 ( lookupType, lookupFlags, subtableOffset, sf );
+ if (sf == 1) {
+ readReverseChainedSingleSubTableFormat1 (lookupType, lookupFlags, subtableOffset, sf);
} else {
- throw new AdvancedTypographicTableFormatException ( "unsupported reverse chained single substitution subtable format: " + sf );
+ throw new AdvancedTypographicTableFormatException ("unsupported reverse chained single substitution subtable format: " + sf);
}
return sf;
}
@@ -1638,35 +1638,35 @@ public final class OTFAdvancedTypographi
private void readGSUBSubtable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) throws IOException {
initATSubState();
int subtableFormat = -1;
- switch ( lookupType ) {
+ switch (lookupType) {
case GSUBLookupType.SINGLE:
- subtableFormat = readSingleSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readSingleSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.MULTIPLE:
- subtableFormat = readMultipleSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readMultipleSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.ALTERNATE:
- subtableFormat = readAlternateSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readAlternateSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.LIGATURE:
- subtableFormat = readLigatureSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readLigatureSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.CONTEXTUAL:
- subtableFormat = readContextualSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readContextualSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.CHAINED_CONTEXTUAL:
- subtableFormat = readChainedContextualSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readChainedContextualSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.REVERSE_CHAINED_SINGLE:
- subtableFormat = readReverseChainedSingleSubTable ( lookupType, lookupFlags, subtableOffset );
+ subtableFormat = readReverseChainedSingleSubTable (lookupType, lookupFlags, subtableOffset);
break;
case GSUBLookupType.EXTENSION:
- subtableFormat = readExtensionSubTable ( lookupType, lookupFlags, lookupSequence, subtableSequence, subtableOffset );
+ subtableFormat = readExtensionSubTable (lookupType, lookupFlags, lookupSequence, subtableSequence, subtableOffset);
break;
default:
break;
}
- extractSESubState ( GlyphTable.GLYPH_TABLE_TYPE_SUBSTITUTION, lookupType, lookupFlags, lookupSequence, subtableSequence, subtableFormat );
+ extractSESubState (GlyphTable.GLYPH_TABLE_TYPE_SUBSTITUTION, lookupType, lookupFlags, lookupSequence, subtableSequence, subtableFormat);
resetATSubState();
}
@@ -1684,43 +1684,43 @@ public final class OTFAdvancedTypographi
int dm;
int dd;
int s2;
- if ( df == 1 ) {
+ if (df == 1) {
s1 = 14;
m1 = 0x3;
dm = 1;
dd = 4;
s2 = 2;
- } else if ( df == 2 ) {
+ } else if (df == 2) {
s1 = 12;
m1 = 0xF;
dm = 7;
dd = 16;
s2 = 4;
- } else if ( df == 3 ) {
+ } else if (df == 3) {
s1 = 8;
m1 = 0xFF;
dm = 127;
dd = 256;
s2 = 8;
} else {
- log.debug ( "unsupported device table delta format: " + df + ", ignoring device table" );
+ log.debug ("unsupported device table delta format: " + df + ", ignoring device table");
return null;
}
// read deltas
- int n = ( es - ss ) + 1;
- if ( n < 0 ) {
- log.debug ( "invalid device table delta count: " + n + ", ignoring device table" );
+ int n = (es - ss) + 1;
+ if (n < 0) {
+ log.debug ("invalid device table delta count: " + n + ", ignoring device table");
return null;
}
int[] da = new int [ n ];
- for ( int i = 0; ( i < n ) && ( s2 > 0 );) {
+ for (int i = 0; (i < n) && (s2 > 0);) {
int p = in.readTTFUShort();
- for ( int j = 0, k = 16 / s2; j < k; j++ ) {
- int d = ( p >> s1 ) & m1;
- if ( d > dm ) {
+ for (int j = 0, k = 16 / s2; j < k; j++) {
+ int d = (p >> s1) & m1;
+ if (d > dm) {
d -= dd;
}
- if ( i < n ) {
+ if (i < n) {
da [ i++ ] = d;
} else {
break;
[... 2446 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org