@Override public void setData(ByteBuffer data) { setVersion(data.getShort()); CMap cMap = CMap.getMap(mapData); if (cMap != null) { addCMap(platformID, platformSpecificID, cMap);
/** * lookup the outline using the CMAPs, as specified in 32000-1:2008, * 9.6.6.4, when an Encoding is specified. * * @param val * @param width * @return GeneralPath */ protected synchronized GeneralPath getOutlineFromCMaps (char val, float width) { // find the cmaps CmapTable cmap = (CmapTable) font.getTable ("cmap"); if (cmap == null) { return null; } // try maps in required order of (3, 1), (1, 0) CMap map = cmap.getCMap ((short) 3, (short) 1); if (map == null) { map = cmap.getCMap ((short) 1, (short) 0); } int idx = map.map (val); if (idx != 0) { return getOutline (idx, width); } return null; }
@Override public ByteBuffer getData() { ByteBuffer buf = ByteBuffer.allocate(getLength()); buf.putShort(getVersion()); buf.putShort((short) subtables.size());
/** Print a pretty string */ @Override public String toString() { StringBuffer buf = new StringBuffer(); String indent = " "; buf.append(indent + "Version: " + this.getVersion() + "\n"); buf.append(indent + "NumMaps: " + this.getNumberSubtables() + "\n"); for (Iterator i = subtables.keySet().iterator(); i.hasNext();) { CmapSubtable key = (CmapSubtable) i.next(); buf.append(indent + "Map: platformID: " + key.platformID + " PlatformSpecificID: " + key.platformSpecificID + "\n"); CMap map = (CMap) subtables.get(key); buf.append(map.toString()); } return buf.toString(); }
/** Creates a new instance of CmapTable */ protected CmapTable() { super(TrueTypeTable.CMAP_TABLE); setVersion((short) 0x0); subtables = Collections.synchronizedSortedMap(new TreeMap<CmapSubtable,CMap>()); }
/** * Get the outline of a character given the character code */ protected synchronized GeneralPath getOutline (char src, float width) { // find the cmaps CmapTable cmap = (CmapTable) font.getTable ("cmap"); // if there are no cmaps, this is (hopefully) a cid-mapped font, // so just trust the value we were given for src if (cmap == null) { return getOutline ((int) src, width); } CMap[] maps = cmap.getCMaps (); // try the maps in order for (int i = 0; i < maps.length; i++) { int idx = maps[i].map (src); if (idx != 0) { return getOutline (idx, width); } } // not found, return the empty glyph return getOutline (0, width); }
outTable = new CmapTable(); break; case GLYF_TABLE:
/** Print a pretty string */ @Override public String toString() { StringBuffer buf = new StringBuffer(); String indent = " "; buf.append(indent + "Version: " + this.getVersion() + "\n"); buf.append(indent + "NumMaps: " + this.getNumberSubtables() + "\n"); for (Iterator i = subtables.keySet().iterator(); i.hasNext();) { CmapSubtable key = (CmapSubtable) i.next(); buf.append(indent + "Map: platformID: " + key.platformID + " PlatformSpecificID: " + key.platformSpecificID + "\n"); CMap map = (CMap) subtables.get(key); buf.append(map.toString()); } return buf.toString(); }
/** Creates a new instance of CmapTable */ protected CmapTable() { super(TrueTypeTable.CMAP_TABLE); setVersion((short) 0x0); subtables = Collections.synchronizedSortedMap(new TreeMap<CmapSubtable,CMap>()); }
/** * Get the outline of a character given the character code */ protected synchronized GeneralPath getOutline (char src, float width) { // find the cmaps CmapTable cmap = (CmapTable) font.getTable ("cmap"); // if there are no cmaps, this is (hopefully) a cid-mapped font, // so just trust the value we were given for src if (cmap == null) { return getOutline ((int) src, width); } CMap[] maps = cmap.getCMaps (); // try the maps in order for (int i = 0; i < maps.length; i++) { int idx = maps[i].map (src); if (idx != 0) { return getOutline (idx, width); } } // not found, return the empty glyph return getOutline (0, width); }
outTable = new CmapTable(); break; case GLYF_TABLE:
/** Print a pretty string */ @Override public String toString() { StringBuffer buf = new StringBuffer(); String indent = " "; buf.append(indent + "Version: " + this.getVersion() + "\n"); buf.append(indent + "NumMaps: " + this.getNumberSubtables() + "\n"); for (Iterator i = subtables.keySet().iterator(); i.hasNext();) { CmapSubtable key = (CmapSubtable) i.next(); buf.append(indent + "Map: platformID: " + key.platformID + " PlatformSpecificID: " + key.platformSpecificID + "\n"); CMap map = (CMap) subtables.get(key); buf.append(map.toString()); } return buf.toString(); }
@Override public void setData(ByteBuffer data) { setVersion(data.getShort()); CMap cMap = CMap.getMap(mapData); if (cMap != null) { addCMap(platformID, platformSpecificID, cMap);
@Override public ByteBuffer getData() { ByteBuffer buf = ByteBuffer.allocate(getLength()); buf.putShort(getVersion()); buf.putShort((short) subtables.size());
/** * lookup the outline using the CMAPs, as specified in 32000-1:2008, * 9.6.6.4, when an Encoding is specified. * * @param val * @param width * @return GeneralPath */ protected synchronized GeneralPath getOutlineFromCMaps (char val, float width) { // find the cmaps CmapTable cmap = (CmapTable) font.getTable ("cmap"); if (cmap == null) { return null; } // try maps in required order of (3, 1), (1, 0) CMap map = cmap.getCMap ((short) 3, (short) 1); if (map == null) { map = cmap.getCMap ((short) 1, (short) 0); } int idx = map.map (val); if (idx != 0) { return getOutline (idx, width); } return null; }
/** Creates a new instance of CmapTable */ protected CmapTable() { super(TrueTypeTable.CMAP_TABLE); setVersion((short) 0x0); subtables = Collections.synchronizedSortedMap(new TreeMap<CmapSubtable,CMap>()); }