diff --git a/vendor/kb_text_shape/kb_text_shape_procs.odin b/vendor/kb_text_shape/kb_text_shape_procs.odin index 8880aeccf..83c5a9d6f 100644 --- a/vendor/kb_text_shape/kb_text_shape_procs.odin +++ b/vendor/kb_text_shape/kb_text_shape_procs.odin @@ -52,14 +52,21 @@ PlaceShapeState :: proc "c" (Memory: []byte) -> ^shape_state { } @(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) foreign lib { kbts_DecodeUtf8 :: proc(Utf8: [^]byte, Length: uint) -> decode --- } Decode := kbts_DecodeUtf8(raw_data(String), len(String)) - return Decode.Codepoint, Decode.SourceCharactersConsumed, Decode.Valid + return Decode.Codepoint, Decode.SourceCharactersConsumed, bool(Decode.Valid) } diff --git a/vendor/kb_text_shape/kb_text_shape_types.odin b/vendor/kb_text_shape/kb_text_shape_types.odin index d25d826d1..eab25ae67 100644 --- a/vendor/kb_text_shape/kb_text_shape_types.odin +++ b/vendor/kb_text_shape/kb_text_shape_types.odin @@ -1519,14 +1519,14 @@ lookup_subtable_info :: struct { } font :: struct { - FileBase: [^]byte, - Head: ^head, - Cmap: ^u16, - Gdef: ^gdef, - Cmap14: ^cmap_14, + FileBase: [^]byte, + Head: ^head, + Cmap: ^u16, + Gdef: ^gdef, + Cmap14: ^cmap_14, ShapingTables: [shaping_table]^gsub_gpos, - Fvar: rawptr, - Maxp: ^maxp, + Fvar: rawptr, + Maxp: ^maxp, Hea: [orientation]^hea, Mtx: [orientation]^u16, @@ -1537,10 +1537,11 @@ font :: struct { LookupCount: u32, SubtableCount: u32, - GlyphLookupMatrix: [^]u32, // [LookupCount * GlyphCount] bitmap - GlyphLookupSubtableMatrix: [^]u32, // [LookupSubtableCount * GlyphCount] bitmap - LookupSubtableIndexOffsets: [^]u32, // [LookupCount] + GlyphLookupMatrix: [^]u32, // [LookupCount * GlyphCount] bitmap + GlyphLookupSubtableMatrix: [^]u32, // [LookupSubtableCount * GlyphCount] bitmap + LookupSubtableIndexOffsets: [^]u32, // [LookupCount] SubtableInfos: [^]lookup_subtable_info, // [LookupSubtableCount] + GposLookupIndexOffset: u32, Error: c.int, @@ -1600,7 +1601,7 @@ glyph :: struct { // Unicode properties filled in by CodepointToGlyph. JoiningType: unicode_joining_type, Script: u8, - UnicodeFlags: u8, + UnicodeFlags: unicode_flags, SyllabicClass: u8, SyllabicPosition: u8, UseClass: u8, @@ -1622,10 +1623,17 @@ op_state_normalize :: struct { AboveBaseGlyphCount: un, } + +skip_flags :: distinct bit_set[skip_flag; u32] +skip_flag :: enum { + ZWNJ = 0, + ZWJ = 1, +} + op_state_gsub :: struct { LookupIndex: un, - GlyphFilter: u32, - SkipFlags: u32, + GlyphFilter: glyph_flags, + SkipFlags: skip_flags, } op_state_normalize_hangul :: struct { @@ -1640,9 +1648,9 @@ op_state_op_specific :: struct #raw_union { } lookup_indices :: struct { - FeatureId: u32, - SkipFlags: u32, - GlyphFilter: u32, + FeatureId: feature_id, + SkipFlags: skip_flags, + GlyphFilter: glyph_flags, Count: u32, Indices: [^]u16 `fmt:"v,Count"`, } @@ -1673,14 +1681,14 @@ op_state :: struct { // LeftoverMemory: [LeftoverMemorySize]u8, } -op_list :: struct { - Ops: [^]u8, +op_list :: struct { // TODO(bill): is this actually a slice? e.g. `op_list :: []op_kind` + Ops: [^]op_kind, Length: un, } indic_script_properties :: struct { ViramaCodepoint: rune, - BlwfPostOnly: u8, + BlwfPostOnly: b8, RephPosition: reph_position, RephEncoding: reph_encoding, RightSideMatraPosition: syllabic_position, @@ -1691,13 +1699,13 @@ indic_script_properties :: struct { langsys :: struct {} shape_config :: struct { - Font: ^font, - Script: script, + Font: ^font, + Script: script, Language: language, - Langsys: [shaping_table]^langsys, - OpLists: [4]op_list, + Langsys: [shaping_table]^langsys, + OpLists: [4]op_list, - Shaper: shaper, + Shaper: shaper, ShaperProperties: ^shaper_properties, IndicScriptProperties: indic_script_properties, @@ -1729,7 +1737,7 @@ shape_state :: struct { GlyphArray: glyph_array, ClusterGlyphArray: glyph_array, - DottedCircleInsertIndex: u32, + DottedCircleInsertIndex: u32, GlyphCountStartingFromCurrentCluster: u32, @@ -1833,10 +1841,3 @@ break_state :: struct { LastWordBreakClass: u8, LastWordBreakClassIncludingIgnored: u8, } - -decode :: struct { - Codepoint: rune, - - SourceCharactersConsumed: u32, - Valid: b32, -} \ No newline at end of file