DVUI

initNoFmt

It's expected to call this when self is undefined

Parameters

#
self:*LabelWidget
*LabelWidget
src:std.builtin.SourceLocation
std.builtin.SourceLocation
label_str:[]const u8
[]const u8
init_opts:InitOptions
InitOptions
opts:Options
Options

Source

Implementation

#
pub fn initNoFmt(self: *LabelWidget, src: std.builtin.SourceLocation, label_str: []const u8, init_opts: InitOptions, opts: Options) void {
    const arena = dvui.currentWindow().lifo();
    // If the allocation fails, the textSize will be incorrect
    // later because of invalid utf8
    const str = dvui.toUtf8(arena, label_str) catch |err| blk: {
        const newid = dvui.parentGet().extendId(src, opts.idExtra());
        dvui.logError(@src(), err, "Label {x} could not allocate valid utf8 slice", .{newid});
        break :blk label_str;
    };
    return self.initNoFmtAllocator(src, str, if (str.ptr != label_str.ptr) arena else null, init_opts, opts);
}