this repo has no description
1const std = @import("std");
2const grapheme = @import("grapheme");
3const DisplayWidth = @import("DisplayWidth");
4
5/// A thin wrapper around zg data
6const Unicode = @This();
7
8width_data: DisplayWidth.DisplayWidthData,
9
10/// initialize all unicode data vaxis may possibly need
11pub fn init(alloc: std.mem.Allocator) !Unicode {
12 return .{
13 .width_data = try DisplayWidth.DisplayWidthData.init(alloc),
14 };
15}
16
17/// free all data
18pub fn deinit(self: *const Unicode) void {
19 self.width_data.deinit();
20}
21
22/// creates a grapheme iterator based on str
23pub fn graphemeIterator(self: *const Unicode, str: []const u8) grapheme.Iterator {
24 return grapheme.Iterator.init(str, &self.width_data.g_data);
25}