src/share/classes/sun/font/FontDesignMetrics.java

Print this page
rev 1297 : [mq]: fontmanager.patch

@@ -259,12 +259,13 @@
          * cache the physical fonts, its not a problem to just return a
          * new instance in this case.
          * Note that currently Swing native L&F composites are not handled
          * by this code as they use the metrics of the physical anyway.
          */
-        if (FontManager.maybeUsingAlternateCompositeFonts() &&
-            FontManager.getFont2D(font) instanceof CompositeFont) {
+        SunFontManager fm = SunFontManager.getInstance();
+        if (fm.maybeUsingAlternateCompositeFonts() &&
+            FontUtilities.getFont2D(font) instanceof CompositeFont) {
             return new FontDesignMetrics(font, frc);
         }
 
         FontDesignMetrics m = null;
         KeyReference r;

@@ -351,11 +352,11 @@
       initAdvCache();
     }
 
     private void initMatrixAndMetrics() {
 
-        Font2D font2D = FontManager.getFont2D(font);
+        Font2D font2D = FontUtilities.getFont2D(font);
         fontStrike = font2D.getStrike(font, frc);
         StrikeMetrics metrics = fontStrike.getFontMetrics();
         this.ascent = metrics.getAscent();
         this.descent = metrics.getDescent();
         this.leading = metrics.getLeading();

@@ -471,11 +472,11 @@
             int length = str.length();
             for (int i=0; i < length; i++) {
                 char ch = str.charAt(i);
                 if (ch < 0x100) {
                     width += getLatinCharWidth(ch);
-                } else if (FontManager.isNonSimpleChar(ch)) {
+                } else if (FontUtilities.isNonSimpleChar(ch)) {
                     width = new TextLayout(str, font, frc).getAdvance();
                     break;
                 } else {
                     width += handleCharWidth(ch);
                 }

@@ -502,11 +503,11 @@
             int limit = off + len;
             for (int i=off; i < limit; i++) {
                 char ch = data[i];
                 if (ch < 0x100) {
                     width += getLatinCharWidth(ch);
-                } else if (FontManager.isNonSimpleChar(ch)) {
+                } else if (FontUtilities.isNonSimpleChar(ch)) {
                     String str = new String(data, off, len);
                     width = new TextLayout(str, font, frc).getAdvance();
                     break;
                 } else {
                     width += handleCharWidth(ch);