diff options
author | Bernhard Haumacher <[email protected]> | 2020-05-10 21:39:01 +0200 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-02 21:05:28 +0100 |
commit | f584e1dcc200b9ca59490227c7280fbd0b40039e (patch) | |
tree | b4f94929f185cd4bdfbc3f660f5779cf2a628e67 | |
parent | c1fdc5470259376ca3e2e985471fcc4b7eaa6021 (diff) |
Enhanced dump format of cmap table.
8 files changed, 77 insertions, 36 deletions
diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat.java b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat.java index cac85e1..2ad5ece 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat.java @@ -99,11 +99,9 @@ public abstract class CmapFormat { @Override public String toString() { - return "format: " + - getFormat() + - ", length: " + - getLength() + - ", language: " + - getLanguage(); + return + " format: " + getFormat() + "\n" + + " length: " + getLength() + "\n" + + " language: " + getLanguage() + "\n"; } } diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat0.java b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat0.java index 3e33aae..2070d5c 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat0.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat0.java @@ -21,6 +21,7 @@ package net.java.dev.typecast.ot.table; import java.io.DataInput; import java.io.IOException; +import java.util.Arrays; /** * Format 0: Byte encoding table @@ -95,4 +96,12 @@ public class CmapFormat0 extends CmapFormat { return 0; } } + + @Override + public String toString() { + return super.toString() + + " format: " + getFormat() + "\n" + + " language: " + getLanguage() + "\n" + + " glyphIdArray: " + Arrays.toString(_glyphIdArray) + "\n"; + } } diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat12.java b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat12.java index 56c65f2..560400c 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat12.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat12.java @@ -112,7 +112,26 @@ public class CmapFormat12 extends CmapFormat { @Override public String toString() { return super.toString() + - ", nGroups: " + - _nGroups; + " format: " + getFormat() + "\n" + + " language: " + getLanguage() + "\n" + + " nGroups: " + _nGroups + "\n" + + " mapping: " + toStringMappingTable() + "\n"; } + + private String toStringMappingTable() { + StringBuilder result = new StringBuilder(); + for (int n = 0; n < _nGroups; n++) { + if (n > 0) { + result.append(", "); + } + result.append("["); + result.append(_startCharCode[n]); + result.append(", "); + result.append(_endCharCode[n]); + result.append("]: "); + result.append(_startGlyphId[n]); + } + return result.toString(); + } + } diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat2.java b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat2.java index 33b93df..09fb4a4 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat2.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat2.java @@ -21,6 +21,7 @@ package net.java.dev.typecast.ot.table; import java.io.DataInput; import java.io.IOException; +import java.util.Arrays; /** * Format 2: High-byte mapping through table. @@ -232,4 +233,13 @@ public class CmapFormat2 extends CmapFormat { } return glyphIndex; } + + @Override + public String toString() { + return super.toString() + + " format: " + getFormat() + "\n" + + " language: " + getLanguage() + "\n" + + " subHeaderKeys: " + Arrays.toString(_subHeaderKeys) + "\n" + + " glyphIndexArray:" + Arrays.toString(_glyphIndexArray) + "\n"; + } } diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat4.java b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat4.java index 080dfa9..7769505 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat4.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat4.java @@ -205,21 +205,14 @@ public class CmapFormat4 extends CmapFormat { @Override public String toString() { return super.toString() + - ", segCountX2: " + - _segCountX2 + - ", searchRange: " + - _searchRange + - ", entrySelector: " + - _entrySelector + - ", rangeShift: " + - _rangeShift + - ", endCode: " + - Arrays.toString(_endCode) + - ", startCode: " + - Arrays.toString(_endCode) + - ", idDelta: " + - Arrays.toString(_idDelta) + - ", idRangeOffset: " + - Arrays.toString(_idRangeOffset); + " format: " + getFormat() + "\n" + + " segCountX2: " + _segCountX2 + "\n" + + " searchRange: " + _searchRange + "\n" + + " entrySelector: " + _entrySelector + "\n" + + " rangeShift: " + _rangeShift + "\n" + + " endCode: " + Arrays.toString(_endCode) + "\n" + + " startCode: " + Arrays.toString(_startCode) + "\n" + + " idDelta: " + Arrays.toString(_idDelta) + "\n" + + " idRangeOffset: " + Arrays.toString(_idRangeOffset) + "\n"; } } diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat6.java b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat6.java index baff2c8..e4b51ff 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapFormat6.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapFormat6.java @@ -20,6 +20,7 @@ package net.java.dev.typecast.ot.table; import java.io.DataInput; import java.io.IOException; +import java.util.Arrays; /** * Format 6: Trimmed table mapping @@ -83,4 +84,14 @@ public class CmapFormat6 extends CmapFormat { return 0; } } + + @Override + public String toString() { + return super.toString() + + " format: " + getFormat() + "\n" + + " language: " + getLanguage() + "\n" + + " firstCode: " + _firstCode + "\n" + + " entryCount: " + _entryCount + "\n" + + " glyphIdArray: " + Arrays.toString(_glyphIdArray) + "\n"; + } } diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapIndexEntry.java b/src/main/java/net/java/dev/typecast/ot/table/CmapIndexEntry.java index 1ccd8ce..1e41e09 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapIndexEntry.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapIndexEntry.java @@ -142,16 +142,13 @@ public class CmapIndexEntry implements Comparable<CmapIndexEntry> { @Override public String toString() { - return "platform id: " + - _platformId + - " (" + - ID.getPlatformName((short) _platformId) + - "), encoding id: " + - _encodingId + - " (" + - ID.getEncodingName((short) _platformId, (short) _encodingId) + - "), offset: " + - _offset; + return + " Index entry\n"+ + " -----------\n"+ + " platformId: " + _platformId + " (" + ID.getPlatformName((short) _platformId) + ")\n" + + " encodingId: " + _encodingId + " (" + ID.getEncodingName((short) _platformId, (short) _encodingId) + ")\n" + + " offset: " + _offset + "\n" + + _format; } @Override diff --git a/src/main/java/net/java/dev/typecast/ot/table/CmapTable.java b/src/main/java/net/java/dev/typecast/ot/table/CmapTable.java index 355f145..a77fee8 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/CmapTable.java +++ b/src/main/java/net/java/dev/typecast/ot/table/CmapTable.java @@ -206,11 +206,15 @@ public class CmapTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder().append("cmap\n"); + StringBuilder sb = new StringBuilder(); + + sb.append("cmap Table\n"); + sb.append("----------\n"); + sb.append(" numTables: " + _numTables + "\n"); // Get each of the index entries for (int i = 0; i < _numTables; i++) { - sb.append("\t").append(_entries[i].toString()).append("\n"); + sb.append("\n").append(_entries[i].toString()); } // Get each of the tables |