[libbluray-devel] Store font metrics in Font

hpi1 git at videolan.org
Sun Nov 23 13:19:55 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Nov 21 13:13:03 2014 +0200| [ee362cb35e8d240a0079cd6b3edc0bbfcf1a78ed] | committer: hpi1

Store font metrics in Font

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=ee362cb35e8d240a0079cd6b3edc0bbfcf1a78ed
---

 src/libbluray/bdj/java/java/awt/BDFontMetrics.java |    9 ++++-----
 src/libbluray/bdj/java/java/awt/Font.java          |    1 +
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bdj/java/java/awt/BDFontMetrics.java b/src/libbluray/bdj/java/java/awt/BDFontMetrics.java
index f149420..5c2492d 100644
--- a/src/libbluray/bdj/java/java/awt/BDFontMetrics.java
+++ b/src/libbluray/bdj/java/java/awt/BDFontMetrics.java
@@ -136,9 +136,8 @@ public class BDFontMetrics extends FontMetrics {
      to ensure native fonts are not loaded twice for the same font. */
     static synchronized BDFontMetrics getFontMetrics(Font font) {
         /* See if metrics has been stored in font already. */
-        BDFontMetrics fm = null;
-        //BDFontMetrics fm = (BDFontMetrics)font.metrics;
-        //if (fm == null) {
+        BDFontMetrics fm = (BDFontMetrics)font.metrics;
+        if (fm == null || fm.ftFace == 0) {
             /* See if a font metrics of the same native name and size has already been loaded.
              If it has then we use that one. */
             String nativeName = (String)discFontNameMap.get(font.getName().toLowerCase() + "." + font.getStyle());
@@ -153,8 +152,8 @@ public class BDFontMetrics extends FontMetrics {
             if (fm == null) {
                 fontMetricsMap.put(key, fm = new BDFontMetrics(font, nativeName));
             }
-            //font.metrics = fm;
-        //}
+            font.metrics = fm;
+        }
         return fm;
     }
 
diff --git a/src/libbluray/bdj/java/java/awt/Font.java b/src/libbluray/bdj/java/java/awt/Font.java
index 174540b..e97b9b1 100644
--- a/src/libbluray/bdj/java/java/awt/Font.java
+++ b/src/libbluray/bdj/java/java/awt/Font.java
@@ -167,6 +167,7 @@ public class Font implements java.io.Serializable {
      * libbluray implementation-specific extensions
      */
 
+    transient FontMetrics metrics = null;
     private transient String family = null;
     protected transient File fontFile = null;
 



More information about the libbluray-devel mailing list