I’m trying to draw a face with such unicodes:
ಠ_ಠ
However, it produces rectangles instead.
I tried the following:
<code>BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
Font font = new Font("Arial", Font.BOLD, FACE_SIZE);
g.setColor(FACE_COLOR);
g.setFont(font);
g.drawString("ಠ_ಠ", x, y);
</code>
<code>BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
Font font = new Font("Arial", Font.BOLD, FACE_SIZE);
g.setColor(FACE_COLOR);
g.setFont(font);
g.drawString("ಠ_ಠ", x, y);
</code>
BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
Font font = new Font("Arial", Font.BOLD, FACE_SIZE);
g.setColor(FACE_COLOR);
g.setFont(font);
g.drawString("ಠ_ಠ", x, y);
I also tried the following methods:
<code>g.drawString(new String("ಠ_ಠ".getBytes("UTF-8"), "UTF-8"), x, y);
</code>
<code>g.drawString(new String("ಠ_ಠ".getBytes("UTF-8"), "UTF-8"), x, y);
</code>
g.drawString(new String("ಠ_ಠ".getBytes("UTF-8"), "UTF-8"), x, y);
<code>g.drawString(StringEscapeUtils.unescapeJava("\u0ca0\u005f\u0ca0"), x, y);
</code>
<code>g.drawString(StringEscapeUtils.unescapeJava("\u0ca0\u005f\u0ca0"), x, y);
</code>
g.drawString(StringEscapeUtils.unescapeJava("\u0ca0\u005f\u0ca0"), x, y);
But everything produced the following result:
Image of the result of the previous methods
I also tried on Linux, Windows, and same result. Changing font doesn’t help.
In my gradle settings I made sure to have the following:
<code>compileJava.options.encoding = 'UTF-8'
tasks.withType( JavaCompile ) {
options.encoding = 'UTF-8'
}
</code>
<code>compileJava.options.encoding = 'UTF-8'
tasks.withType( JavaCompile ) {
options.encoding = 'UTF-8'
}
</code>
compileJava.options.encoding = 'UTF-8'
tasks.withType( JavaCompile ) {
options.encoding = 'UTF-8'
}
I know Arial supports the characters because I can draw them in an image editing software.
If that may help this is in a Spring Boot project.