Re: [OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
I tried that first but for whatever reason it did not toll free bridge properly, so I used this API. -phil On 6/2/2020 12:34 AM, Prasanta Sadhukhan wrote: Thanks Kevin for the clarification. Looks ok to me. Only thing that can be thought of is to use CTFontCreateUIFontForLanguage() (instead of [NSFont systemFontOfSize:1.0]) similar to JDK-8234916(which is already committed) just to have same approach, incase Apple changes anything in future. Regards Prasanta On 01-Jun-20 6:41 PM, Kevin Rushforth wrote: Hi Prasanta, No, the reason for the warning / garbled JavaFX printing in this Java2D bug (JDK-8244621) is *similar to* that of FX bug JDK-8234916, but in no way is one of them caused by the other. -- Kevin On 6/1/2020 5:21 AM, Prasanta Sadhukhan wrote: Hi Phil, I was reading somewhere that the warning is caused by JDK-8234916. Will we still get the problem if we remove 8234916? Regards Prasanta On 22-May-20 2:26 AM, Philip Race wrote: Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.
Re: [OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
Thanks Kevin for the clarification. Looks ok to me. Only thing that can be thought of is to use CTFontCreateUIFontForLanguage() (instead of [NSFont systemFontOfSize:1.0]) similar to JDK-8234916(which is already committed) just to have same approach, incase Apple changes anything in future. Regards Prasanta On 01-Jun-20 6:41 PM, Kevin Rushforth wrote: Hi Prasanta, No, the reason for the warning / garbled JavaFX printing in this Java2D bug (JDK-8244621) is *similar to* that of FX bug JDK-8234916, but in no way is one of them caused by the other. -- Kevin On 6/1/2020 5:21 AM, Prasanta Sadhukhan wrote: Hi Phil, I was reading somewhere that the warning is caused by JDK-8234916. Will we still get the problem if we remove 8234916? Regards Prasanta On 22-May-20 2:26 AM, Philip Race wrote: Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.
Re: [OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
Hi Prasanta, No, the reason for the warning / garbled JavaFX printing in this Java2D bug (JDK-8244621) is *similar to* that of FX bug JDK-8234916, but in no way is one of them caused by the other. -- Kevin On 6/1/2020 5:21 AM, Prasanta Sadhukhan wrote: Hi Phil, I was reading somewhere that the warning is caused by JDK-8234916. Will we still get the problem if we remove 8234916? Regards Prasanta On 22-May-20 2:26 AM, Philip Race wrote: Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.
Re: [OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
Hi Phil, I was reading somewhere that the warning is caused by JDK-8234916. Will we still get the problem if we remove 8234916? Regards Prasanta On 22-May-20 2:26 AM, Philip Race wrote: Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.
Re: [OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
I know about the trailing white space. Well at least I know there is some. I didn't notice if I accidentally added more. Correct jcheck won't complain and I have an open bug to clean this up across all code before the move to git. https://bugs.openjdk.java.net/browse/JDK-8240487 -phil. On 5/21/20, 2:16 PM, Kevin Rushforth wrote: +1 In case you want to fix it before you push, you have trailing whitespace in the file (jcheck won't complain since it doesn't check .m files, so no worries if you don't). -- Kevin On 5/21/2020 1:56 PM, Philip Race wrote: Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.
Re: [OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
+1 In case you want to fix it before you push, you have trailing whitespace in the file (jcheck won't complain since it doesn't check .m files, so no worries if you don't). -- Kevin On 5/21/2020 1:56 PM, Philip Race wrote: Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.
[OpenJDK 2D-Dev] RFR: 8244621: [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11
Bug: https://bugs.openjdk.java.net/browse/JDK-8244621 Webrev : http://cr.openjdk.java.net/~prr/8244621/ macOS ships some UI fonts which it does not enumerate, all having names beginning with "." It expects you to create them using APIs such as CTFontCreateUIFontForLanguage(kCTFontSystemFontType, 0, NULL); or nsFont = [NSFont systemFontOfSize:1.0]; In apps built with all SDKs to date, so long as you can get the real "." name you can still request it by name. But with the latest Xcode 11 this not only prints a warning that you should not do it, it also gives you Times New Roman instead - not a standard UI font - probably a choice so it is obvious it is not a UI font. Our problem here is that JavaFX uses the system font as its "logical" font called System and also JavaFX uses Java 2D for printing. It messages over the ".*" name to Java 2D to use as the font to print. But with the latest Xcode 2D is not allowed to create the font using that name. This fix changes the JDK code for macOS that creates the native font pointer to check if the name being requested is one of the UI fonts. If it is, then it uses the NSFont systemFontOfSize API to create the font, which fixes the problem. If someone asks for a random name such as ".foo" Note that 1) JDK only enumerates the regular and bold system font which is all FX uses. 2) The fix *could* have just tested to see if the requested name begins with "." and that worked too but it wasn't clear what would happen if there is some other font called ".Foo". We tested and names starting with "." seem to be absolutely reserved for these system fonts on macOS If you see such a font. it is a system font. We tested and if you have a random name such as ".FOO" macOS does the same thing - it assumes it is a system font and won't give it to you. So probably testing for a "." prefix would have been OK but as written it is more certain and is robust against Apple changing the nameing scheme to be (sa) a "~" prefix. No regression test as this isn't easily testable and the main place it matters is FX printing. However we've verified this on 10.13.6 with the old tool chain and 10.15.2 with the new toolchain and fixes the warnings and FX printing. The removal of adding the fixed width font is because we never needed it and it is just Monaco anyway ... -phil.