RFR: 8190907: Windows 10 default Korean Font Malgun Gothic available not used by GUI elements even though available without Korean Language Pack [v4]

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu May 26 12:27:41 UTC 2022


On Fri, 13 May 2022 22:19:12 GMT, Phil Race <prr at openjdk.org> wrote:

> I still don't understand why they are the same for you .. I added korean-fallback to my local fontconfig and ran in the Korean locale (changed my windows region to Korea and rebooted) and they are different for me.
> 
> What I do seem to be seeing is that because we now have UTF-8 as the default encoding and that we have no UTF-8.ko that it goes the fallback route .. and so although you get korean by fallback it prefers Chinese and Japanese fonts which isn't right for a Korean locale
> 
> I believe we need to add a line like the ja one sequence.allfonts.UTF-8.ja=alphabetic,japanese,dingbats,symbol +sequence.allfonts.UTF-8.ko=alphabetic,korean,dingbats,symbol
> 
> [See https://git.openjdk.java.net/jdk/pull/8662 for more info and we likely need to do more of these lines and perhaps you need that PR pushed to include in your testing .. alas I don't even have a single approver yet, so nowhere near the two I need !]
> 
> .. even without that I was OK perhaps so long as the fallback seqeuence had "korean" - I'd have to re-test that
> 
> So I don't know if that will cure them all being the same for you but it might.

I tried the same way of changing region to Korean and rebooting and tried this testcase (changed keyboard IM to Korean too)
I have also added sequence.allfonts.UTF-8.ko=alphabetic,korean,dingbats,symbol


public class HelloWorld {
    private static void createAndShowGUI() {
         JFrame frame = new JFrame("테스트 Swing");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JLabel label = new JLabel("테스트");
        frame.getContentPane().add(label);

        frame.setSize(400,200);
        frame.setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.KOREAN);
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
        BufferedImage bi = new BufferedImage(600, 900, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = bi.createGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0,0,600,900);
        g.setColor(Color.BLACK);

        g.setFont(new Font("sansserif", Font.PLAIN, 20));
        g.drawString("Sansserif Plain:  테스트", 100, 40);

        g.setFont(new Font("sansserif", Font.BOLD, 20));
        g.drawString("Sansserif Bold:  테스트", 100, 80);

        g.setFont(new Font("sansserif", Font.ITALIC, 20));
        g.drawString("Sansserif Italic:  테스트", 100, 120);

        g.setFont(new Font("sansserif", Font.BOLD|Font.ITALIC, 20));
        g.drawString("Sansserif BoldItalic:  테스트", 100, 160);

        g.setFont(new Font("serif", Font.PLAIN, 20));
        g.drawString("Serif Plain:  테스트", 100, 200);

        g.setFont(new Font("serif", Font.BOLD, 20));
        g.drawString("Serif Bold:  테스트", 100, 240);

        g.setFont(new Font("serif", Font.ITALIC, 20));
        g.drawString("Serif Italic:  테스트", 100, 280);

        g.setFont(new Font("serif", Font.BOLD|Font.ITALIC, 20));
        g.drawString("Serif BoldItalic:  테스트", 100, 320);

        g.setFont(new Font("monospaced", Font.PLAIN, 20));
        g.drawString("Monospaced Plain:  테스트", 100, 360);

        g.setFont(new Font("monospaced", Font.BOLD, 20));
        g.drawString("Monospaced Bold:  테스트", 100, 400);

        g.setFont(new Font("monospaced", Font.ITALIC, 20));
        g.drawString("Monospaced Italic:  테스트", 100, 440);

        g.setFont(new Font("monospaced", Font.BOLD|Font.ITALIC, 20));
        g.drawString("Monospaced BoldItalic:  테스트", 100, 480);

        g.setFont(new Font("dialog", Font.PLAIN, 20));
        g.drawString("Dialog Plain:  테스트", 100, 520);

        g.setFont(new Font("dialog", Font.BOLD, 20));
        g.drawString("Dialog Bold:  테스트", 100, 560);

        g.setFont(new Font("dialog", Font.ITALIC, 20));
        g.drawString("Dialog Italic:  테스트", 100, 600);

        g.setFont(new Font("dialog", Font.BOLD|Font.ITALIC, 20));
        g.drawString("Dialog Bold Italic:  테스트", 100, 640);

        g.setFont(new Font("dialoginput", Font.PLAIN, 20));
        g.drawString("DialogInput Plain:  테스트", 100, 680);

        g.setFont(new Font("dialoginput", Font.BOLD, 20));
        g.drawString("DialogInput Bold:  테스트", 100, 720);

        g.setFont(new Font("dialoginput", Font.ITALIC, 20));
        g.drawString("Dialog Input Italic:  테스트", 100, 760);

        g.setFont(new Font("dialoginput", Font.BOLD|Font.ITALIC, 20));
        g.drawString("Dialog Input BoldItalic:  테스트", 100, 800);

        ImageIO.write(bi, "png", new File("image.png"));
    }
}


and I am getting this rendered fonts
![image](https://user-images.githubusercontent.com/43534309/170485724-51909f48-db09-4a4f-bec4-61c78e5baff7.png)

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

PR: https://git.openjdk.java.net/jdk/pull/7643



More information about the client-libs-dev mailing list