File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 11const root = @import ("root" );
22
33pub const display = @import ("phantom/display.zig" );
4+ pub const fonts = @import ("phantom/fonts.zig" );
45pub const gpu = @import ("phantom/gpu.zig" );
56pub const math = @import ("phantom/math.zig" );
67pub const painting = @import ("phantom/painting.zig" );
Original file line number Diff line number Diff line change 1+ pub const Font = @import ("fonts/font.zig" );
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+ const painting = @import ("../painting.zig" );
3+ const vizops = @import ("vizops" );
4+ const Self = @This ();
5+
6+ pub const Glyph = struct {
7+ index : u32 ,
8+ fb : * painting.fb.Base ,
9+ size : vizops.vector.Uint8Vector ,
10+ bearing : vizops.vector.Int8Vector ,
11+ advance : vizops.vector.Int8Vector ,
12+ };
13+
14+ pub const VTable = struct {
15+ lookupGlyph : * const fn (* anyopaque , u21 ) anyerror ! Glyph = null ,
16+ getSize : * const fn (* anyopaque ) vizops.vector.UsizeVector2 ,
17+ deinit : ? * const fn (* anyopaque ) void = null ,
18+ };
19+
20+ vtable : * const VTable ,
21+ ptr : * anyopaque ,
22+
23+ pub inline fn lookupGlyph (self : * Self , codepoint : u21 ) ! Glyph {
24+ return self .vtable .lookupGlyph (self .ptr , codepoint );
25+ }
26+
27+ pub inline fn getSize (self : * Self ) vizops.vector.UsizeVector2 {
28+ return self .vtable .getSize (self .ptr );
29+ }
30+
31+ pub inline fn deinit (self : * Self ) void {
32+ return if (self .vtable .deinit ) | f | f (self .ptr ) else {};
33+ }
You can’t perform that action at this time.
0 commit comments