freetype: fix function namings

some functions should start with `get`
This commit is contained in:
Ali Chraghi 2022-06-11 13:54:09 +04:30 committed by Stephen Gutekanst
parent 1c0930b404
commit ffc7c3aa68
4 changed files with 43 additions and 11 deletions

View file

@ -88,7 +88,7 @@ pub fn render(self: GlyphSlot, render_mode: RenderMode) Error!void {
return intToError(c.FT_Render_Glyph(self.handle, @enumToInt(render_mode)));
}
pub fn subGlyphInfo(self: GlyphSlot, sub_index: u32) Error!SubGlyphInfo {
pub fn getSubGlyphInfo(self: GlyphSlot, sub_index: u32) Error!SubGlyphInfo {
var info: SubGlyphInfo = undefined;
try intToError(c.FT_Get_SubGlyph_Info(self.handle, sub_index, &info.index, &info.flags, &info.arg1, &info.arg2, &info.transform));
return info;

View file

@ -130,8 +130,8 @@ pub const LoadFlags = packed struct {
return utils.bitFieldsToStruct(LoadFlags, Flag, bits);
}
pub fn cast(flags: LoadFlags) u21 {
return utils.structToBitFields(u21, Flag, flags);
pub fn cast(self: LoadFlags) u21 {
return utils.structToBitFields(u21, Flag, self);
}
};
@ -208,8 +208,8 @@ pub const FSType = packed struct {
return utils.bitFieldsToStruct(FSType, Flag, bits);
}
pub fn cast(flags: FSType) u10 {
return utils.structToBitFields(u10, Flag, flags);
pub fn cast(self: FSType) u10 {
return utils.structToBitFields(u10, Flag, self);
}
};
@ -226,8 +226,8 @@ pub const StyleFlags = packed struct {
return utils.bitFieldsToStruct(StyleFlags, Flag, bits);
}
pub fn cast(flags: StyleFlags) u2 {
return utils.structToBitFields(u2, Flag, flags);
pub fn cast(self: StyleFlags) u2 {
return utils.structToBitFields(u2, Flag, self);
}
};

View file

@ -35,7 +35,7 @@ pub const Blob = struct {
};
}
pub fn getEmpty() Blob {
pub fn initEmpty() Blob {
return .{ .handle = c.hb_blob_get_empty().? };
}

View file

@ -11,6 +11,38 @@ pub const ContentType = enum(u2) {
glyphs = c.HB_BUFFER_CONTENT_TYPE_GLYPHS,
};
pub const ClusterLevel = enum(u2) {
monotone_graphemes = c.HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES,
monotone_characters = c.HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS,
characters = c.HB_BUFFER_CLUSTER_LEVEL_CHARACTERS,
};
pub const GlyphInfo = c.hb_glyph_info_t;
pub const SegmentProps = struct {
direction: Direction,
script: Script,
language: Language,
pub fn from(c_struct: c.hb_segment_properties_t) SegmentProps {
return .{
.direction = @intToEnum(Direction, c_struct.direction),
.script = @intToEnum(Script, c_struct.script),
.language = Language{ .handle = c_struct.language },
};
}
pub fn cast(self: SegmentProps) c.hb_segment_properties_t {
return .{
.reserved1 = undefined,
.reserved2 = undefined,
.direction = @enumToInt(self.direction),
.script = @enumToInt(self.script),
.language = self.language.handle,
};
}
};
pub const Buffer = struct {
pub const Flags = packed struct {
bot: bool = false,
@ -35,8 +67,8 @@ pub const Buffer = struct {
return utils.bitFieldsToStruct(Flags, Flag, bits);
}
pub fn cast(flags: Flags) u7 {
return utils.structToBitFields(u7, Flag, flags);
pub fn cast(self: Flags) u7 {
return utils.structToBitFields(u7, Flag, self);
}
};
@ -49,7 +81,7 @@ pub const Buffer = struct {
return Buffer{ .handle = b.? };
}
pub fn getEmpty() Buffer {
pub fn initEmpty() Buffer {
return .{ .handle = c.hb_buffer_get_empty().? };
}