[OpenJDK 2D-Dev] Internal API usage: sun.font.FontUtilities

Phil Race philip.race at oracle.com
Tue Jul 28 21:23:29 UTC 2015

I suspected as much but it is nice to get it confirmed.
See https://bugs.openjdk.java.net/browse/JDK-6407157
I've added a link there to this discussion so we can consider it.
Most likely a public API would work only with a java.awt.Font
and you would have to wrap it in a FontUIResource yourself.


On 07/28/2015 01:16 PM, Andrej Golovnin wrote:
> Hi Phil,
> we use it precisely for the purpose for which it was invented and
> is now used in JDK’s WindowsLookAndFeel (see lines 2294-2301).
> The only difference is that we use it in JGoodies Windows L&F.
> Here you can find our usage (lines 338-376):
> https://java.net/projects/looks/sources/svn/content/trunk/src/main/java/com/jgoodies/looks/FontPolicies.java?rev=948
> It would be really nice if you could add this methods to the Public API.
> Best regards,
> Andrej Golovnin
>> On 28.07.2015, at 19:24, Phil Race <philip.race at oracle.com> wrote:
>>> sun.font.FontUtilities.getCompositeFontUIResource(Font)
>> The first line of the javadoc comment in the source code says :
>>      * This method is provided for internal and exclusive use by Swing.
>> And previous refactoring has moved it so that it's no longer even
>> on the same class as when it was first created.
>> Generally speaking it is helpful to provide the reason, ie the use
>> case as to the how and why they use this API.
>> In some cases people asking for a new API have simply overlooked
>> an existing solution. I do not necessarily think that is the case here
>> but it it would be nice to have that additional information.
>> -phil.
>> On 07/28/2015 08:38 AM, Alexander Scherbatiy wrote:
>>> Resending the question about sun.font.FontUtilities to 2d-dev alias.
>>> Thanks,
>>> Alexandr.
>>> On 7/27/2015 4:24 PM, Andrej Golovnin wrote:
>>>> Hi Alexander,
>>>> in our application we make use of
>>>> sun.font.FontUtilities.fontSupportsDefaultEncoding(Font)
>>>> sun.font.FontUtilities.getCompositeFontUIResource(Font)
>>>> to obtain an instance of CompositeFont.
>>>> Best regards,
>>>> Andrej Golovnin
>>>> On Mon, Jul 27, 2015 at 2:30 PM, Alexander Scherbatiy
>>>> <alexandr.scherbatiy at oracle.com> wrote:
>>>>> According to the JEP 200: The Modular JDK (see
>>>>> http://openjdk.java.net/jeps/200)
>>>>> we expect that the standard Java SE modules will not export any internal
>>>>> packages.
>>>>> It means that classes from internal packages (like sun.swing) will not be
>>>>> accessible.
>>>>> For example:
>>>>>    sun.swing.FilePane
>>>>>    sun.swing.SwingUtilities2
>>>>>    sun.swing.sun.swing.plaf.synth.SynthIcon
>>>>> and others.
>>>>> Please, let us known if you are using the internal Swing API and it is not
>>>>> possible to replace it by public API.
>>>>> There are some known requests:
>>>>>    JDK-8132119 Provide public API for text related methods in SwingUtilities2
>>>>>      https://bugs.openjdk.java.net/browse/JDK-8132119
>>>>>    JDK-8132120 Provide public API for screen menu bar support on MacOS
>>>>>      https://bugs.openjdk.java.net/browse/JDK-8132120
>>>>>    JDK-6274842 RFE: Provide a means for a custom look and feel to use desktop
>>>>> font antialiasing settings.
>>>>>      https://bugs.openjdk.java.net/browse/JDK-6274842
>>>>> If you don't know if you use these types (because you use 3rd party jars)
>>>>> you can use the JDK 8 "jdeps" tool to find such dependencies :-
>>>>> ~/jdk1.8/bin/jdeps
>>>>> Usage: jdeps <options> <classes...>
>>>>> where <classes> can be a pathname to a .class file, a directory, a JAR
>>>>> file, or a fully-qualified class name
>>>>> Thanks,
>>>>> Alexandr.

More information about the 2d-dev mailing list