8023990: Regression: postscript size increase from 6u18
authoranashaty
Wed, 05 Feb 2014 19:46:36 +0400
changeset 23282 3ea147eb359c
parent 23281 93c0a5484bb5
child 23283 fbd991796648
8023990: Regression: postscript size increase from 6u18 Reviewed-by: prr, bae
jdk/src/share/classes/sun/awt/FontConfiguration.java
jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java	Tue Feb 04 16:24:39 2014 -0800
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java	Wed Feb 05 19:46:36 2014 +0400
@@ -867,7 +867,7 @@
         return descriptors;
     }
 
-    private FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+    protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
         String fontName = fontNames[fontIndex];
         String styleName = styleNames[styleIndex];
 
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Tue Feb 04 16:24:39 2014 -0800
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Wed Feb 05 19:46:36 2014 +0400
@@ -33,6 +33,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -173,8 +174,16 @@
     }
 
     @Override
-    public FontDescriptor[] getFontDescriptors(String fontName, int style) {
-        return new FontDescriptor[0];
+    protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+        CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
+        int idx = fontIndex * NUM_STYLES + styleIndex;
+        String[] componentFaceNames = cfi[idx].getComponentFaceNames();
+        FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
+        for (int i = 0; i < componentFaceNames.length; i++) {
+            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.UTF_8.newEncoder(), new int[0]);
+        }
+
+        return ret;
     }
 
     @Override
@@ -250,10 +259,12 @@
                 }
 
                 String[] fileNames = new String[numFonts];
+                String[] faceNames = new String[numFonts];
 
                 int index;
                 for (index = 0; index < fcFonts.length; index++) {
                     fileNames[index] = fcFonts[index].fontFile;
+                    faceNames[index] = fcFonts[index].familyName;
                 }
 
                 if (installedFallbackFontFiles != null) {
@@ -266,7 +277,7 @@
                         = new CompositeFontDescriptor(
                             faceName,
                             1,
-                            null,
+                            faceNames,
                             fileNames,
                             null, null);
             }