[11] Review request : JDK-8195806 : Eliminate dependency on sun.font.lookup in javafx.graphics
Ajit Ghaisas
ajit.ghaisas at oracle.com
Tue Feb 27 12:23:06 UTC 2018
Hi Phil,
All my webrev does is to replace the way of obtaining name of JDK font directory – and as rightly pointed by you below (first two lines of your last reply) – it is what is needed to get rid of dependency on sun.font.lookup.
I have tested it by running an OpenJDK build that doesn't contain a lib/fonts directory using Ensemble8 sample.
I got your point about Lucida Sans fonts being pointless with openJDK & the font finding fallback code is being little dubious.
I would like to address that separately. I have filed bug HYPERLINK "https://bugs.openjdk.java.net/browse/JDK-8198752"JDK-8198752 to handle that.
Regards,
Ajit
From: Phil Race
Sent: Thursday, February 15, 2018 10:44 PM
To: Ajit Ghaisas
Cc: Kevin Rushforth; openjfx-dev at openjdk.java.net
Subject: Re: [11] Review request : JDK-8195806 : Eliminate dependency on sun.font.lookup in javafx.graphics
This part is probably as good as you can do
+ return System.getProperty("java.home","") + File.separator +
+ "lib" + File.separator + "fonts";
but if we want to support running against OpenJDK which does not have Lucida Sans
then we need to look at the caller of getJDKFontDir()
So going forward all of this ..
private static final String jreDefaultFont = "Lucida Sans Regular";
private static final String jreDefaultFontLC = "lucida sans regular";
private static final String jreDefaultFontFile = "LucidaSansRegular.ttf";
.. is probably pointless.
And if we can't find it then the first layer of fall back code is a bit dubious
// Normally use the JRE default font as the last fallback.
// If we can't find even that, use any platform font;
for (String font : fontToFileMap.keySet()) {
String file = findFile(font); // gets full path
fontResource = createFontResource(jreDefaultFontLC, file);
if (fontResource != null) {
break;
}
It did not really matter in the past .. it was just to prevent NPE in an unlikely scenario ..
But if it is to be the first class way of finding this font it probably should be using
"System" instead ? But then you need to make sure we don't have a circularity in the case
that we are using this in initialiasing System.
-phil.
On 02/14/2018 09:39 PM, Ajit Ghaisas wrote:
Hi Phil,
Thanks for having a look at the changes.
I have little difficulty in understanding your question.
Are you referring to the sun.font.SunFontManager initialization?
I am asking as it is not evident from the code changes that I have done as part of this webrev.
Request your guidance in this regard.
Regards,
Ajit
-----Original Message-----
From: Philip Race
Sent: Wednesday, February 14, 2018 12:52 PM
To: Ajit Ghaisas
Cc: Kevin Rushforth; HYPERLINK "mailto:openjfx-dev at openjdk.java.net"openjfx-dev at openjdk.java.net
Subject: Re: [11] Review request : JDK-8195806 : Eliminate dependency on sun.font.lookup in javafx.graphics
Well that removes the dependency but how are you fixing the problem of how else to find the font ?
There needs to be alternate code or you need to go back to see what would happen if some code tried to locate that font and how it would fail.
-phil.
On 2/13/18, 11:11 PM, Ajit Ghaisas wrote:
Hi Kevin, Phil,
Request you to review following fix :
Issue : https://bugs.openjdk.java.net/browse/JDK-8195806
Fix :
http://cr.openjdk.java.net/~aghaisas/fx/8195806/webrev.0/
Regards,
Ajit
More information about the openjfx-dev
mailing list