Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 97590 invoked from network); 12 Oct 2007 07:32:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Oct 2007 07:32:24 -0000 Received: (qmail 17851 invoked by uid 500); 12 Oct 2007 07:32:11 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 17835 invoked by uid 500); 12 Oct 2007 07:32:11 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 17826 invoked by uid 99); 12 Oct 2007 07:32:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Oct 2007 00:32:11 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Oct 2007 07:32:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 953FD1A9838; Fri, 12 Oct 2007 00:31:29 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r584088 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/java: common/java/awt/Font.java common/org/apache/harmony/awt/gl/font/FontPeerImpl.java windows/org/apache/harmony/awt/gl/font/WindowsFont.java Date: Fri, 12 Oct 2007 07:31:09 -0000 To: commits@harmony.apache.org From: ayza@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071012073132.953FD1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ayza Date: Fri Oct 12 00:31:08 2007 New Revision: 584088 URL: http://svn.apache.org/viewvc?rev=584088&view=rev Log: Adding getUnicodeByIndex() implementation from HARMONY-4556 ([classlib][awt] Font.createGlyphVector(FontRenderContext frc, int[] glyphCodes) is not implemented) Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java?rev=584088&r1=584087&r2=584088&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java Fri Oct 12 00:31:08 2007 @@ -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(); Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java?rev=584088&r1=584087&r2=584088&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java Fri Oct 12 00:31:08 2007 @@ -462,15 +462,13 @@ } } + /** + * Returns unicode by glyph index. + */ public char getUnicodeByIndex(int glyphCode) { return 0; } - /** - * Sets new font type to the font object. - * - * @param newType new type value - */ @Override protected void finalize() throws Throwable { super.finalize(); Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java?rev=584088&r1=584087&r2=584088&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/WindowsFont.java Fri Oct 12 00:31:08 2007 @@ -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,7 +406,33 @@ 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 += 2) { + for (int j = fontUnicodeRanges[i]; j <= fontUnicodeRanges[i + 1]; j++) + { + int code = NativeFont.getGlyphCodeNative(pFont, (char) j); + glyphCodes.put(code, j); + } + } + } + + if (glyphCodes.containsKey(glyphCode)) { + result = (char) glyphCodes.get(glyphCode).intValue(); + } else { + result = defaultChar; + } + + return result; + } + /** * Returns initiated FontExtraMetrics instance of this WindowsFont. */