Change types where possible to the correct ones

This commit is contained in:
gingerBill
2025-06-20 09:29:41 +01:00
parent a449ad8ed8
commit 9d15170928
2 changed files with 42 additions and 34 deletions
+9 -2
View File
@@ -52,14 +52,21 @@ PlaceShapeState :: proc "c" (Memory: []byte) -> ^shape_state {
} }
@(require_results) @(require_results)
DecodeUtf8 :: proc "contextless" (String: string) -> (Codepoint: rune, SourceCharactersConsumed: u32, Valid: b32) { DecodeUtf8 :: proc "contextless" (String: string) -> (Codepoint: rune, SourceCharactersConsumed: u32, Valid: bool) {
decode :: struct {
Codepoint: rune,
SourceCharactersConsumed: u32,
Valid: b32,
}
@(default_calling_convention="c", require_results) @(default_calling_convention="c", require_results)
foreign lib { foreign lib {
kbts_DecodeUtf8 :: proc(Utf8: [^]byte, Length: uint) -> decode --- kbts_DecodeUtf8 :: proc(Utf8: [^]byte, Length: uint) -> decode ---
} }
Decode := kbts_DecodeUtf8(raw_data(String), len(String)) Decode := kbts_DecodeUtf8(raw_data(String), len(String))
return Decode.Codepoint, Decode.SourceCharactersConsumed, Decode.Valid return Decode.Codepoint, Decode.SourceCharactersConsumed, bool(Decode.Valid)
} }
+17 -16
View File
@@ -1541,6 +1541,7 @@ font :: struct {
GlyphLookupSubtableMatrix: [^]u32, // [LookupSubtableCount * GlyphCount] bitmap GlyphLookupSubtableMatrix: [^]u32, // [LookupSubtableCount * GlyphCount] bitmap
LookupSubtableIndexOffsets: [^]u32, // [LookupCount] LookupSubtableIndexOffsets: [^]u32, // [LookupCount]
SubtableInfos: [^]lookup_subtable_info, // [LookupSubtableCount] SubtableInfos: [^]lookup_subtable_info, // [LookupSubtableCount]
GposLookupIndexOffset: u32, GposLookupIndexOffset: u32,
Error: c.int, Error: c.int,
@@ -1600,7 +1601,7 @@ glyph :: struct {
// Unicode properties filled in by CodepointToGlyph. // Unicode properties filled in by CodepointToGlyph.
JoiningType: unicode_joining_type, JoiningType: unicode_joining_type,
Script: u8, Script: u8,
UnicodeFlags: u8, UnicodeFlags: unicode_flags,
SyllabicClass: u8, SyllabicClass: u8,
SyllabicPosition: u8, SyllabicPosition: u8,
UseClass: u8, UseClass: u8,
@@ -1622,10 +1623,17 @@ op_state_normalize :: struct {
AboveBaseGlyphCount: un, AboveBaseGlyphCount: un,
} }
skip_flags :: distinct bit_set[skip_flag; u32]
skip_flag :: enum {
ZWNJ = 0,
ZWJ = 1,
}
op_state_gsub :: struct { op_state_gsub :: struct {
LookupIndex: un, LookupIndex: un,
GlyphFilter: u32, GlyphFilter: glyph_flags,
SkipFlags: u32, SkipFlags: skip_flags,
} }
op_state_normalize_hangul :: struct { op_state_normalize_hangul :: struct {
@@ -1640,9 +1648,9 @@ op_state_op_specific :: struct #raw_union {
} }
lookup_indices :: struct { lookup_indices :: struct {
FeatureId: u32, FeatureId: feature_id,
SkipFlags: u32, SkipFlags: skip_flags,
GlyphFilter: u32, GlyphFilter: glyph_flags,
Count: u32, Count: u32,
Indices: [^]u16 `fmt:"v,Count"`, Indices: [^]u16 `fmt:"v,Count"`,
} }
@@ -1673,14 +1681,14 @@ op_state :: struct {
// LeftoverMemory: [LeftoverMemorySize]u8, // LeftoverMemory: [LeftoverMemorySize]u8,
} }
op_list :: struct { op_list :: struct { // TODO(bill): is this actually a slice? e.g. `op_list :: []op_kind`
Ops: [^]u8, Ops: [^]op_kind,
Length: un, Length: un,
} }
indic_script_properties :: struct { indic_script_properties :: struct {
ViramaCodepoint: rune, ViramaCodepoint: rune,
BlwfPostOnly: u8, BlwfPostOnly: b8,
RephPosition: reph_position, RephPosition: reph_position,
RephEncoding: reph_encoding, RephEncoding: reph_encoding,
RightSideMatraPosition: syllabic_position, RightSideMatraPosition: syllabic_position,
@@ -1833,10 +1841,3 @@ break_state :: struct {
LastWordBreakClass: u8, LastWordBreakClass: u8,
LastWordBreakClassIncludingIgnored: u8, LastWordBreakClassIncludingIgnored: u8,
} }
decode :: struct {
Codepoint: rune,
SourceCharactersConsumed: u32,
Valid: b32,
}