On Thu, 1 Jul 2021 20:53:36 GMT, Phil Race <p...@openjdk.org> wrote:

>> [Mac only] register system fonts.
>> Fix for JDK-8246104
>> 
>> The list of available fonts returned by 
>> CTFontCollectionCreateFromAvailableFonts does not contain internal fonts (at 
>> least not by default, although this is not documented). By registering 
>> font(s) (files), those fonts become available in the returned list.
>> The CT Glyph processing might assign internal fonts to a glyph, and since we 
>> lookup the requested font in this list, we fail if the list doesn't contain 
>> the font.
>> This PR registers all fonts in the system library so that they become 
>> available. This is not creating additional Java objects or overhead, as it 
>> almost directly invokes `CTFontManagerRegisterFontsForURL` via 
>> `CTFontFile.registerFont(String fontfile)`
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/font/MacFontFinder.java 
> line 83:
> 
>> 81:             Stream<Path> stream = 
>> Files.list(Paths.get("/System/Library/Fonts"));
>> 82:             stream.forEach(f -> 
>> PrismFontFactory.getFontFactory().registerEmbeddedFont(f.toString()));
>> 83:         } catch (IOException e) {
> 
> registerEmbeddedFont() is intended to be used for fonts embedded in an 
> application not for system fonts. 
> Also is there anywhere else we are hard-coding /System/Library/Fonts. Apple 
> move things around.
> Also as well as likely needing to use a different call to register, you 
> should make sure that the API
> is registering all the fonts in a collection.
> Finally (I think) what happens if you print ? The font info needs to be 
> passed over to J2D.

Another thought .. after doing this do these "." fonts appear in the list of 
fonts reported by
javafx.scene.text.Font.getFontNames() ?

I suspect they really should not ..

-------------

PR: https://git.openjdk.java.net/jfx/pull/547

Reply via email to