freetype/harfbuzz: fix invalid getGlyphInfos return
Co-authored-by: ab55al <abdullah5590x@gmail.com>
This commit is contained in:
parent
2388eb1c3a
commit
83f051fb58
1 changed files with 8 additions and 3 deletions
|
|
@ -26,7 +26,10 @@ pub const SerializeFormat = enum(u31) {
|
||||||
|
|
||||||
pub const GlyphInfo = extern struct {
|
pub const GlyphInfo = extern struct {
|
||||||
codepoint: u32,
|
codepoint: u32,
|
||||||
|
mask: u32,
|
||||||
cluster: u32,
|
cluster: u32,
|
||||||
|
var1: u32,
|
||||||
|
var2: u32,
|
||||||
|
|
||||||
pub fn getFlags(self: GlyphInfo) GlyphFlags {
|
pub fn getFlags(self: GlyphInfo) GlyphFlags {
|
||||||
return GlyphFlags.from(@intCast(u2, hb_glyph_info_get_glyph_flags(&self)));
|
return GlyphFlags.from(@intCast(u2, hb_glyph_info_get_glyph_flags(&self)));
|
||||||
|
|
@ -328,12 +331,14 @@ pub const Buffer = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getGlyphInfos(self: Buffer) []GlyphInfo {
|
pub fn getGlyphInfos(self: Buffer) []GlyphInfo {
|
||||||
return hb_buffer_get_glyph_infos(self.handle, null)[0..self.getLength()];
|
var length: u32 = 0;
|
||||||
|
return hb_buffer_get_glyph_infos(self.handle, &length)[0..length];
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getGlyphPositions(self: Buffer) ?[]Position {
|
pub fn getGlyphPositions(self: Buffer) ?[]Position {
|
||||||
return if (hb_buffer_get_glyph_positions(self.handle, null)) |positions|
|
var length: u32 = 0;
|
||||||
@ptrCast([*]Position, positions)[0..self.getLength()]
|
return if (hb_buffer_get_glyph_positions(self.handle, &length)) |positions|
|
||||||
|
@ptrCast([*]Position, positions)[0..length]
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue