summaryrefslogtreecommitdiff
path: root/pkg/macos/text/frame.zig
blob: 979134a122e89e172c6c757c71f74d111833785d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const std = @import("std");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const foundation = @import("../foundation.zig");
const graphics = @import("../graphics.zig");
const text = @import("../text.zig");
const c = @import("c.zig").c;

pub const Frame = opaque {
    pub fn release(self: *Frame) void {
        foundation.CFRelease(self);
    }

    pub fn getLineOrigins(
        self: *Frame,
        range: foundation.Range,
        points: []graphics.Point,
    ) void {
        c.CTFrameGetLineOrigins(
            @ptrCast(self),
            @bitCast(range),
            @ptrCast(points.ptr),
        );
    }

    pub fn getLines(self: *Frame) *foundation.Array {
        return @ptrFromInt(@intFromPtr(c.CTFrameGetLines(@ptrCast(self))));
    }
};

test {
    // See framesetter tests...
}