Add types and procs for kb_text_shape

This commit is contained in:
gingerBill
2025-06-20 08:32:25 +01:00
parent 365d9b0a63
commit 63f1c5139a
2 changed files with 1883 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package vendor_kb_text_shape
import "core:c"
#assert(size_of(c.int) == size_of(b32))
#assert(size_of(u32) == size_of(b32))
TEXT_SHAPE_NO_CRT :: #config(KB_TEXT_SHAPE_NO_CRT, false)
@(default_calling_convention="c", link_prefix="kbts_")
foreign {
when !TEXT_SHAPE_NO_CRT {
FontFromFile :: proc(FileName: cstring) -> font ---
FreeFont :: proc(Font: ^font) ---
CreateShapeState :: proc(Font: ^font) -> ^shape_state ---
FreeShapeState :: proc(State: ^shape_state) ---
}
FontIsValid :: proc(Font: ^font) -> int ---
ReadFontHeader :: proc(Font: ^font, Data: rawptr, Size: un) -> un ---
ReadFontData :: proc(Font: ^font, Scratch: rawptr, ScratchSize: un) -> un ---
PostReadFontInitialize :: proc(Font: ^font, Memory: rawptr, MemorySize: un) -> int ---
SizeOfShapeState :: proc(Font: ^font) -> un ---
PlaceShapeState :: proc(Address: rawptr, Size: un) -> ^shape_state ---
ResetShapeState :: proc(State: ^shape_state) ---
ShapeConfig :: proc(Font: ^font, Script: u32, Language: u32) -> shape_config ---
ShaperIsComplex :: proc(Shaper: shaper) -> b32 ---
Shape :: proc(State: ^shape_state, Config: ^shape_config, MainDirection, RunDirection: direction, Glyphs: [^]glyph, GlyphCount: ^u32, GlyphCapacity: u32) -> c.int ---
Cursor :: proc(Direction: direction) -> cursor ---
PositionGlyph :: proc(Cursor: ^cursor, Glyph: ^glyph, X, Y: ^i32) ---
BeginBreak :: proc(State: ^break_state, MainDirection: direction, JapaneseLineBreakStyle: japanese_line_break_style) ---
BreakStateIsValid :: proc(State: ^break_state) -> c.int ---
BreakAddCodepoint :: proc(State: ^break_state, Codepoint: rune, PositionIncrement: u32, EndOfText: c.int) ---
BreakFlush :: proc(State: ^break_state) ---
Break :: proc(State: ^break_state, Break: ^break_type) -> c.int ---
DecodeUtf8 :: proc(Utf8: [^]byte, Length: uint) -> decode ---
CodepointToGlyph :: proc(Font: ^font, Codepoint: rune) -> glyph ---
InferScript :: proc(Direction: ^direction, Script: ^script, GlyphScript: script) ---
ScriptIsComplex :: proc(Script: script) -> b32 ---
}

File diff suppressed because it is too large Load Diff