[libbluray-devel] FontFactory: fix createFont()

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


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Nov 23 14:05:52 2014 +0200| [dce8a8d568dfb5b9f27a9866ca303e81e79b8827] | committer: hpi1

FontFactory: fix createFont()

Factory created for URL font returns only that font.
Font style must match.

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

 src/libbluray/bdj/java-j2se/org/dvb/ui/FontFactory.java |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/java-j2se/org/dvb/ui/FontFactory.java b/src/libbluray/bdj/java-j2se/org/dvb/ui/FontFactory.java
index 230debd..e8afeb7 100644
--- a/src/libbluray/bdj/java-j2se/org/dvb/ui/FontFactory.java
+++ b/src/libbluray/bdj/java-j2se/org/dvb/ui/FontFactory.java
@@ -135,18 +135,23 @@ public class FontFactory {
             throws FontNotAvailableException, FontFormatException, IOException {
         logger.info("Creating font: " + name + " " + style + " " + size);
 
-        if (urlFont != null && name.equals(urlFont.getName()))
-        {
-            return urlFont.deriveFont(style, size);
+        /* Factory created only for single font ? */
+        if (urlFont != null) {
+            if (name.equals(urlFont.getName()) && style == urlFont.getStyle()) {
+                return urlFont.deriveFont(style, size);
+            }
+            logger.info("createFont(URL): request " + name + "." + style + " does not match with " + urlFont.getName() + "." + urlFont.getStyle());
+            throw new FontNotAvailableException();
         }
 
+        /* Factory created for fonts in dvb.fontindex */
         Font font = null;
         synchronized (FontFactory.class) {
             font = (Font)fonts.get(name + "." + style);
         }
 
         if (font == null) {
-            logger.info("Failed creating font: " + name + " " + style + " " + size);
+            logger.info("Font " + name + "." + style + " not found");
             throw new FontNotAvailableException();
         }
 



More information about the libbluray-devel mailing list