< prev index next >

modules/graphics/src/main/java/javafx/scene/text/Font.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,10 +23,11 @@
  * questions.
  */
 
 package javafx.scene.text;
 
+import com.sun.javafx.text.FontHelper;
 import java.io.FilePermission;
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.List;

@@ -55,10 +56,33 @@
  * on the default coordinate system
  * @since JavaFX 2.0
  */
 public final class Font {
 
+    static {
+        // This is used by classes in different packages to get access to
+        // private and package private methods.
+        FontHelper.setFontAccessor(new FontHelper.FontAccessor() {
+
+            @Override
+            public Object getNativeFont(Font font) {
+                return font.getNativeFont();
+            }
+
+            @Override
+            public void setNativeFont(Font font, Object f, String nam, String fam, String styl) {
+                font.setNativeFont(f, nam, fam, styl);
+            }
+
+            @Override
+            public Font nativeFont(Object f, String name, String family, String style, double size) {
+                return Font.nativeFont(f, name, family, style, size);
+            }
+
+        });
+    }
+
     private static final String DEFAULT_FAMILY = "System";
     private static final String DEFAULT_FULLNAME = "System Regular";
 
     /**
      * The default font for this platform. This is used whenever a font is not

@@ -313,11 +337,11 @@
         // if a search was done based on family + style information, then the
         // native font has already been located and specified. Likewise if the
         // Font was created based on an existing native font. If however a Font
         // was created directly in FX, then we need to find the native font
         // to use. This call will also set the family and style by invoking
-        // the impl_setNativeFont callback method.
+        // the setNativeFont callback method.
         Toolkit.getToolkit().getFontLoader().loadFont(this);
     }
 
     /**
      * Private constructor for internal implementation

@@ -499,35 +523,20 @@
         return hash;
     }
 
     private Object nativeFont;
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public Object impl_getNativeFont() { return nativeFont; }
+    private Object getNativeFont() { return nativeFont; }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public void impl_setNativeFont(Object f, String nam, String fam, String styl) {
+    private void setNativeFont(Object f, String nam, String fam, String styl) {
         nativeFont = f;
         name = nam;
         family = fam;
         style = styl;
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public static Font impl_NativeFont(Object f, String name, String family,
+    private static Font nativeFont(Object f, String name, String family,
                                        String style, double size) {
         Font retFont = new Font( f, family, name, style, size);
         return retFont;
     }
 }
< prev index next >