coretext: implement resizing

This commit is contained in:
Mitchell Hashimoto
2022-11-15 20:29:58 -08:00
parent 7e24faac72
commit 371a7f79cb

View File

@ -65,6 +65,15 @@ pub const Face = struct {
self.* = undefined; self.* = undefined;
} }
/// Resize the font in-place. If this succeeds, the caller is responsible
/// for clearing any glyph caches, font atlas data, etc.
pub fn setSize(self: *Face, size: font.face.DesiredSize) !void {
// We just create a copy and replace ourself
const face = try initFontCopy(self.font, size);
self.deinit();
self.* = face;
}
/// Returns the glyph index for the given Unicode code point. If this /// Returns the glyph index for the given Unicode code point. If this
/// face doesn't support this glyph, null is returned. /// face doesn't support this glyph, null is returned.
pub fn glyphIndex(self: Face, cp: u32) ?u32 { pub fn glyphIndex(self: Face, cp: u32) ?u32 {