Summary
I noticed that some characters, such as Chinese characters, are rendered as tofu blocks. I believe this issue is probably not limited to Chinese characters.
Example
package main
import (
"fmt"
"github.com/gogpu/gogpu"
"github.com/gogpu/ui/app"
"github.com/gogpu/ui/core/button"
"github.com/gogpu/ui/desktop"
"github.com/gogpu/ui/primitives"
"github.com/gogpu/ui/widget"
)
func main() {
gogpuApp := gogpu.NewApp(gogpu.DefaultConfig().
WithTitle("Font Demo").
WithSize(600, 300))
uiApp := app.New(
app.WithWindowProvider(gogpuApp),
app.WithPlatformProvider(gogpuApp),
app.WithEventSource(gogpuApp.EventSource()),
)
uiApp.SetRoot(
primitives.Box(
primitives.Text("test: 测试").FontSize(20),
button.New(button.Text("test2: 测试2"), button.OnClick(func() {
fmt.Println("Button clicked!")
})),
primitives.Text("English text (both work)").FontSize(16).Color(widget.RGBA8(100, 100, 100, 255)),
).Padding(24).Gap(16).Background(widget.RGBA8(255, 255, 255, 255)),
)
if err := desktop.Run(gogpuApp, uiApp); err != nil {
panic(err)
}
}
Possible root cause
Using button as an example, it uses DefaultPainter, which internally calls canvas.DrawText.
However, canvas (in internal/render/canvas.go) appears to use Inter as its default font. I believe this is likely the reason why characters that are not supported by Inter cannot be rendered correctly.
To be honest, I haven't found a solution that I'm fully satisfied with for rendering characters that are not covered by Inter, so I decided to open this issue.
Environment
- gogpu/ui v0.1.51
- gogpu v0.50.2
- Go 1.26.5, Linux (Wayland)
Finally, thank you for this project. I really like the ambition behind it
Summary
I noticed that some characters, such as Chinese characters, are rendered as tofu blocks. I believe this issue is probably not limited to Chinese characters.
Example
Possible root cause
Using
buttonas an example, it usesDefaultPainter, which internally callscanvas.DrawText.However, canvas (in
internal/render/canvas.go) appears to useInteras its default font. I believe this is likely the reason why characters that are not supported byIntercannot be rendered correctly.To be honest, I haven't found a solution that I'm fully satisfied with for rendering characters that are not covered by Inter, so I decided to open this issue.
Environment
Finally, thank you for this project. I really like the ambition behind it