Hi,
im currently playing around with the dvui gui. As a starting point I took the src/examples/app.zig file from the dvui repo as a starting point. I want to place some unicode characters in the frame. So as an example I modified the frame() function in the following way:
pub fn frame() !dvui.App.Result {
{
var hbox = dvui.box(
@src(),
.{ .dir = .horizontal },
.{
.style = .window,
.background = true,
.expand = .both,
},
);
dvui.label(
@src(),
"¯\\_(ツ)_/¯",
.{},
.{
.gravity_y = 0.5,
.gravity_x = 0.5,
},
);
std.debug.print("¯\\_(ツ)_/¯", .{});
defer hbox.deinit();
}
When compiling the frame shows the characters in the middle of the window, but the japanese katakana (tsu) character that forms the eyes and the smile is replaced by a box.
I added a print to the terminal to check whether it was a problem with unicode strings in general, but that seemed to work fine.
I guess it is a problem with the default fonts in dvui, but I cannot figure out how to properly use custom fonts.
In the AppInit function in the example file there is a comment about loading custom ttf fonts. That seems to work.
// Add your own bundled font files...:
// try dvui.addFont("NOTO", @embedFile("../src/fonts/NotoSansKR-Regular.ttf"), null);
But how do I actually use it in the label where I display text?
The last argument of the dvui.label has a .font member, but I cannot figure out how to reference the font that I loaded in the beginning.
I would appreciate any help, pointers to the relevant sources, or documentation.
Thanks