BufferedImage drawString corrupted letters

I'm writing a program in Kotlin to run on Raspberry Pi. I'm using a small 128x64 pixel OLED display

To display a text I'm drawing it on BufferedImage and then display that image

val bufferedImage = BufferedImage(128, 64, BufferedImage.TYPE_INT_RGB)

val g = bufferedImage.createGraphics()

g.paint = Color.WHITE

g.font = Font("PixelMix", Font.BOLD, /*Font size*/8)

g.drawString("IP: 192.168.1.12", 0, 24)

g.dispose()

display.drawImage(bufferedImage, 0, 0)

link to font: https://www.dafont.com/pixelmix.font

Because screen space is very limited I use small font.

But here comes the problem - following code produces image in which the first 1 lack vertical line, while last 1 is a square.

When I do g.font...

Read More »

By: StackOverFlow - Friday, 9 November

Related Posts