font: rename auto-italicize to synthetic italic

This commit is contained in:
Mitchell Hashimoto
2024-08-23 20:34:19 -07:00
parent 14b04439d0
commit 74291793db
2 changed files with 6 additions and 6 deletions

View File

@ -306,19 +306,19 @@ pub fn completeStyles(self: *Collection, alloc: Allocator) CompleteError!void {
// Create an synthetic italic font face from the given entry and return it.
fn syntheticItalic(self: *Collection, entry: *Entry) !Face {
// Not all font backends support auto-italicization.
if (comptime !@hasDecl(Face, "italicize")) return error.SyntheticItalicUnavailable;
// Not all font backends support synthetic italicization.
if (comptime !@hasDecl(Face, "syntheticItalic")) return error.SyntheticItalicUnavailable;
// We require loading options to auto-italicize.
// We require loading options to create a synthetic italic face.
const opts = self.load_options orelse return error.DeferredLoadingUnavailable;
// Try to italicize it.
const regular = try self.getFaceFromEntry(entry);
const face = try regular.italicize(opts.faceOptions());
const face = try regular.syntheticItalic(opts.faceOptions());
var buf: [256]u8 = undefined;
if (face.name(&buf)) |name| {
log.info("font auto-italicized: {s}", .{name});
log.info("font synthetic italic created family={s}", .{name});
} else |_| {}
return face;

View File

@ -169,7 +169,7 @@ pub const Face = struct {
/// Return a new face that is the same as this but has a transformation
/// matrix applied to italicize it.
pub fn italicize(self: *const Face, opts: font.face.Options) !Face {
pub fn syntheticItalic(self: *const Face, opts: font.face.Options) !Face {
const ct_font = try self.font.copyWithAttributes(0.0, &italic_skew, null);
errdefer ct_font.release();
return try initFont(ct_font, opts);