Index: modules/awt/src/main/java/common/java/awt/Font.java =================================================================== --- modules/awt/src/main/java/common/java/awt/Font.java (revision 581589) +++ modules/awt/src/main/java/common/java/awt/Font.java (working copy) @@ -319,11 +319,6 @@ } public GlyphVector createGlyphVector(FontRenderContext frc, int[] glyphCodes) throws org.apache.harmony.luni.util.NotImplementedException { - if (!FontManager.IS_FONTLIB) { - // TODO : to find out, how to operate with glyphcodes - throw new NotImplementedException(); - } - int length = glyphCodes.length; char[] chars = new char[length]; FontPeerImpl peer = (FontPeerImpl) getPeer(); Index: modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java =================================================================== --- modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java (revision 581589) +++ modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java (working copy) @@ -462,6 +462,9 @@ } } + /** + * Returns unicode by glyph index. + */ public char getUnicodeByIndex(int glyphCode) { return 0; } Index: modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java =================================================================== --- modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java (revision 581589) +++ modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java (working copy) @@ -46,6 +46,8 @@ // table with loaded cached Glyphs private final Hashtable glyphs = new Hashtable(); + // table with loaded glyph codes + private final Hashtable glyphCodes = new Hashtable(); // Pairs of [begin, end],[..].. unicode ranges values private int[] fontUnicodeRanges; @@ -404,6 +406,31 @@ return faceName; } + + /** + * Returns unicode by index from the 'cmap' table of this font. + */ + @Override + public char getUnicodeByIndex(int glyphCode) { + char result; + if (glyphCodes.isEmpty()){ + for (int i = 0; i < fontUnicodeRanges.length - 1; i++) { + for (int j = fontUnicodeRanges[i]; j <= fontUnicodeRanges[i+1]; j++){ + Integer code = Integer.valueOf(NativeFont.getGlyphCodeNative(this.pFont,(char)j)); + glyphCodes.put(Integer.valueOf(code),Integer.valueOf(j)); + } + } + } + + + Integer key = Integer.valueOf(glyphCode); + if (glyphCodes.containsKey(key)) + result = (char)glyphCodes.get(key).intValue(); + else + result = defaultChar; + + return result; + } /** * Returns initiated FontExtraMetrics instance of this WindowsFont.