nucular
nucular copied to clipboard
Unicode extended characters aren't rendered
I'm not sure what I'm doing wrong here, but I'm unable to get any Unicode extended characters to render to the screen. Here's a simple test program illustrating the problem - you'll need to download Catrinity.otf from https://catrinity-font.de to run it; I'll try to provide a screenshot to illustrate too.
package main
import (
_ "embed"
"image"
"github.com/aarzilli/nucular"
"github.com/aarzilli/nucular/font"
)
//go:embed Catrinity.otf
var fontData []byte
func main() {
size := 32
catrinity, err := font.NewFace(fontData, size)
if err != nil {
catrinity = font.DefaultFont(size, 1)
}
w := nucular.NewMasterWindowSize(0, "Test", image.Point{800, 480}, func(w *nucular.Window) {
w.RowScaled(0).Dynamic(1)
bounds, out := w.Custom(0)
if out == nil {
return
}
lineWidth := w.LayoutAvailableWidth() / nucular.FontWidth(catrinity, "A")
var str []rune
// Standard alphanumeric range (displays fine)
for i := 0x41; i < 0x90; i++ {
str = append(str, rune(i))
if i%lineWidth == 0 {
str = append(str, '\n')
}
}
// Bold alphanumeric range (doesn't display)
for i := 0x1b410; i < 0x1b490; i++ {
str = append(str, rune(i))
if i%lineWidth == 0 {
str = append(str, '\n')
}
}
// Emoji range (doesn't display)
for i := 0x1f600; i < 0x1f644; i++ {
str = append(str, rune(i))
if i%lineWidth == 0 {
str = append(str, '\n')
}
}
out.DrawText(bounds,
string(str),
catrinity,
w.Master().Style().Text.Color,
)
})
w.Main()
}