You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/12/29 22:23:53 UTC

[GitHub] [netbeans] eirikbakke commented on a diff in pull request #5161: Linux launcher: Auto-detect subpixel text rendering mode on KDE

eirikbakke commented on code in PR #5161:
URL: https://github.com/apache/netbeans/pull/5161#discussion_r1059170513


##########
nb/ide.launcher/unix/netbeans:
##########
@@ -222,8 +222,29 @@ case "`uname`" in
         # information."
         # https://userbase.kde.org/KDE_System_Administration/Environment_Variables
         if [ ! -z "$KDE_FULL_SESSION" ] ; then
-            echo "Detected KDE; adding awt.useSystemAAFontSettings=on"
-            extra_automatic_options="-J-Dawt.useSystemAAFontSettings=on"
+            # Try to detect the correct subpixel antialiasing mode
+            # (https://github.com/apache/netbeans/issues/4228)
+
+            # See https://docs.gtk.org/gtk4/property.Settings.gtk-xft-rgba.html
+            # See https://docs.oracle.com/javase/7/docs/technotes/guides/2d/flags.html#aaFonts
+            case "`command xrdb -query 2> /dev/null | grep Xft.rgba | cut -d ':' -f2 | xargs`" in
+                rgb)
+                    extra_automatic_options="-J-Dawt.useSystemAAFontSettings=lcd_hrgb"
+                    ;;
+                bgr)
+                    extra_automatic_options="-J-Dawt.useSystemAAFontSettings=lcd_hbgr"
+                    ;;
+                vrgb)
+                    extra_automatic_options="-J-Dawt.useSystemAAFontSettings=lcd_vrgb"
+                    ;;
+                vbgr)
+                    extra_automatic_options="-J-Dawt.useSystemAAFontSettings=lcd_vbgr"
+                    ;;
+                *)
+                    extra_automatic_options="-J-Dawt.useSystemAAFontSettings=on"
+                    ;;
+            esac
+            echo "Detected KDE; use explicit setting for font antialiasing ($extra_automatic_options)"

Review Comment:
   * First bullet: Correct.
   * Second bullet: On these "other KDE systems", the JDK (reportedly) detects the subpixel antialiasing setting just fine. But the "on" option for awt.useSystemAAFontSettings actually refers specifically to the greyscale-type antialiasing. Which is a safe but not fully optimal setting.
   
   > However this probably should be upstreamed to OpenJDK if possible, looks like mode probing on KDE is lacking a bit behind.
   
   Yes, it's really an old JDK deficiency. Once NetBeans has run with this patch for a while, I can submit a JDK bug reporting our experience...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists