[FOray-commit] SF.net SVN: foray: [6873] trunk/foray/foray-font/src/java/org/foray/font/format
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-03-04 12:54:23
|
Revision: 6873 Author: victormote Date: 2006-03-04 04:54:11 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6873&view=rev Log Message: ----------- Add and use methods to let the cmap table handle the encoding and decoding. This way the choice about which cmap subtable(s) to use is centralized. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-04 12:37:53 UTC (rev 6872) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-04 12:54:11 UTC (rev 6873) @@ -209,8 +209,7 @@ int capHeightToUse = 0; if (pcltTable == null) { // Approximate capHeight from height of "H". - int metricIndex = this.cmapTable.getUnicodeCMap() - .encodeCharacter('H'); + int metricIndex = this.cmapTable.encodeCharacter('H'); if (metricIndex != Character.MAX_VALUE) { capHeightToUse = hmtxTable.metrics[metricIndex].getHeight(); } Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2006-03-04 12:37:53 UTC (rev 6872) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2006-03-04 12:54:11 UTC (rev 6873) @@ -158,4 +158,12 @@ return this.unicodeCMap; } + public int encodeCharacter(int codePoint) { + return this.unicodeCMap.encodeCharacter(codePoint); + } + + public int decodeCharacter(int glyphIndex) { + return this.unicodeCMap.decodeCharacter(glyphIndex); + } + } Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java 2006-03-04 12:37:53 UTC (rev 6872) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java 2006-03-04 12:54:11 UTC (rev 6873) @@ -24,8 +24,6 @@ package org.foray.font.format; -import org.foray.ps.encode.CMap04; - import java.io.IOException; /** @@ -80,19 +78,16 @@ getReader().skipBytes(2); // Search range getReader().skipBytes(2); // Entry selector getReader().skipBytes(2); // Range shift - CMap04 cmap = null; - if (this.ttfFont.cmapTable != null) { - cmap = this.ttfFont.cmapTable.getUnicodeCMap(); - } - if (cmap == null) { + TTFTableCMAP cmapTable = null; + if (cmapTable == null) { return; } for (int i = 0; i < numPairs; i++) { char glyph1 = (char) getReader().readUnsignedShort(); char glyph2 = (char) getReader().readUnsignedShort(); short kernAmount = getReader().readShort(); - kerningTab.addKerningEntry(cmap.decodeCharacter(glyph1), - cmap.decodeCharacter(glyph2), kernAmount); + kerningTab.addKerningEntry(cmapTable.decodeCharacter(glyph1), + cmapTable.decodeCharacter(glyph2), kernAmount); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |