Java font fallback handling - Java 8 vs. 14

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Java font fallback handling - Java 8 vs. 14

kiwiwings
Hi Devs,

I have a problem with Java 8 vs. 14 regarding the font fallback handling.
In the bug #64716, there are some asian glyphs to be rendered.
If the .ttf is available, it works in any JDK.
But if the fallback handling is to be used, e.g. the requested font is not registered, the glyphs render correct in my Oracle/OpenJDK 8 environments, but in Oracle/OpenJDK 14 the rendering fails with the typical placeholder rectangles.

On Jenkins, I've created a multi-config job (https://ci-builds.apache.org/job/POI/job/POI-Kiwi-Test/), which displays the glyphs correctly on the selected JDKs.

So I guess, I have a local problem. I've just installed the latest OpenJDK 14 release in case I would have had modifications in my Oracle 14 environment.

So before I go to stackoverflow, here comes my request:
please execute the below code, check the bla.png and answer me via PM the following questions:
- which OS/system do you use?
- which Java distribution (Oracle / OpenJDK / ...) have you used?
- placeholder or rendered glyphs?
- any ideas?

Thank you!

Andi

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class FontTest {
     public static void main(String[] args) throws IOException {
         BufferedImage bi = new BufferedImage(250, 80, BufferedImage.TYPE_INT_ARGB);
         Graphics2D g = bi.createGraphics();
         g.setColor(Color.BLACK);
         g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 10));
         g.drawString(System.getProperty("java.runtime.version"), 5, 10);
         g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 40));
         g.drawString("\u5DE5\u5546\u4EBA\u58EB", 10, 70);
         g.dispose();
         ImageIO.write(bi, "PNG", new File("bla.png"));
     }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Java font fallback handling - Java 8 vs. 14

fanningpj@apache.org
Hi Andi,
I ran FontTest with some JDKs on my Macbook.
All ran ok, with the fonts rendering alright in all cases.
Oracle JDKs 8.0.252, 11.0.4.
Zulu JDKs 11.0.7, 14.0.1, 15.0.0.




On Sunday 15 November 2020, 18:50:10 GMT, Andreas Beeker <[hidden email]> wrote:





Hi Devs,

I have a problem with Java 8 vs. 14 regarding the font fallback handling.
In the bug #64716, there are some asian glyphs to be rendered.
If the .ttf is available, it works in any JDK.
But if the fallback handling is to be used, e.g. the requested font is not registered, the glyphs render correct in my Oracle/OpenJDK 8 environments, but in Oracle/OpenJDK 14 the rendering fails with the typical placeholder rectangles.

On Jenkins, I've created a multi-config job (https://ci-builds.apache.org/job/POI/job/POI-Kiwi-Test/), which displays the glyphs correctly on the selected JDKs.

So I guess, I have a local problem. I've just installed the latest OpenJDK 14 release in case I would have had modifications in my Oracle 14 environment.

So before I go to stackoverflow, here comes my request:
please execute the below code, check the bla.png and answer me via PM the following questions:
- which OS/system do you use?
- which Java distribution (Oracle / OpenJDK / ...) have you used?
- placeholder or rendered glyphs?
- any ideas?

Thank you!

Andi

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class FontTest {
    public static void main(String[] args) throws IOException {
        BufferedImage bi = new BufferedImage(250, 80, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g = bi.createGraphics();
        g.setColor(Color.BLACK);
        g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 10));
        g.drawString(System.getProperty("java.runtime.version"), 5, 10);
        g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 40));
        g.drawString("\u5DE5\u5546\u4EBA\u58EB", 10, 70);
        g.dispose();
        ImageIO.write(bi, "PNG", new File("bla.png"));
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]