diff options
-rw-r--r-- | src/net/java/dev/typecast/ot/table/CmapFormat12.java | 31 | ||||
-rw-r--r-- | src/net/java/dev/typecast/ot/table/CmapFormat4.java | 2 | ||||
-rw-r--r-- | src/net/java/dev/typecast/ot/table/ID.java | 5 |
3 files changed, 29 insertions, 9 deletions
diff --git a/src/net/java/dev/typecast/ot/table/CmapFormat12.java b/src/net/java/dev/typecast/ot/table/CmapFormat12.java index 6593043..daf6306 100644 --- a/src/net/java/dev/typecast/ot/table/CmapFormat12.java +++ b/src/net/java/dev/typecast/ot/table/CmapFormat12.java @@ -65,17 +65,40 @@ public class CmapFormat12 extends CmapFormat { @Override public int getRangeCount() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return _nGroups; } @Override public Range getRange(int index) throws ArrayIndexOutOfBoundsException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + if (index < 0 || index >= _nGroups) { + throw new ArrayIndexOutOfBoundsException(); + } + return new Range(_startCharCode[index], _endCharCode[index]); } @Override public int mapCharCode(int charCode) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + try { + for (int i = 0; i < _nGroups; i++) { + if (_endCharCode[i] >= charCode) { + if (_startCharCode[i] <= charCode) { + return charCode - _startCharCode[i] + _startGlyphId[i]; + } else { + break; + } + } + } + } catch (ArrayIndexOutOfBoundsException e) { + System.err.println("error: Array out of bounds - " + e.getMessage()); + } + return 0; + } + + @Override + public String toString() { + return new StringBuilder() + .append(super.toString()) + .append(", nGroups: ") + .append(_nGroups).toString(); } - } diff --git a/src/net/java/dev/typecast/ot/table/CmapFormat4.java b/src/net/java/dev/typecast/ot/table/CmapFormat4.java index a7225ff..034e6f3 100644 --- a/src/net/java/dev/typecast/ot/table/CmapFormat4.java +++ b/src/net/java/dev/typecast/ot/table/CmapFormat4.java @@ -132,7 +132,7 @@ public class CmapFormat4 extends CmapFormat { @Override public String toString() { - return new StringBuffer() + return new StringBuilder() .append(super.toString()) .append(", segCountX2: ") .append(_segCountX2) diff --git a/src/net/java/dev/typecast/ot/table/ID.java b/src/net/java/dev/typecast/ot/table/ID.java index c77fac0..298b1b2 100644 --- a/src/net/java/dev/typecast/ot/table/ID.java +++ b/src/net/java/dev/typecast/ot/table/ID.java @@ -1,9 +1,7 @@ /* - * $Id: ID.java,v 1.1.1.1 2004-12-05 23:14:47 davidsch Exp $ - * * Typecast - The Font Development Environment * - * Copyright (c) 2004 David Schweinsberg + * Copyright (c) 2004-2016 David Schweinsberg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +21,6 @@ package net.java.dev.typecast.ot.table; /** * * @author <a href="mailto:[email protected]">David Schweinsberg</a> - * @version $Id: ID.java,v 1.1.1.1 2004-12-05 23:14:47 davidsch Exp $ */ public abstract class ID { |