mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
Use bit_field where appropriate and improve formatting
This commit is contained in:
62
vendor/kb_text_shape/kb_text_shape_procs.odin
vendored
62
vendor/kb_text_shape/kb_text_shape_procs.odin
vendored
@@ -19,23 +19,23 @@ import "core:c"
|
||||
//
|
||||
@(default_calling_convention="c", link_prefix="kbts_", require_results)
|
||||
foreign lib {
|
||||
SizeOfShapeContext :: proc() -> c.int ---
|
||||
PlaceShapeContext :: proc(Allocator: allocator_function, AllocatorData: rawptr, Memory: rawptr) -> ^shape_context ---
|
||||
CreateShapeContext :: proc(Allocator: allocator_function, AllocatorData: rawptr) -> ^shape_context ---
|
||||
DestroyShapeContext :: proc(Context: ^shape_context) ---
|
||||
ShapePushFont :: proc(Context: ^shape_context, Font: ^font) -> ^font ---
|
||||
ShapePopFont :: proc(Context: ^shape_context) -> ^font ---
|
||||
ShapeBegin :: proc(Context: ^shape_context, ParagraphDirection: direction, Language: language) ---
|
||||
ShapeEnd :: proc(Context: ^shape_context) ---
|
||||
ShapePushFeature :: proc(Context: ^shape_context, FeatureTag: feature_tag, Value: c.int) ---
|
||||
ShapePopFeature :: proc(Context: ^shape_context, FeatureTag: feature_tag) -> b32 ---
|
||||
ShapeCodepoint :: proc(Context: ^shape_context, Codepoint: rune) ---
|
||||
ShapeCodepointWithUserId :: proc(Context: ^shape_context, Codepoint: rune, UserId: c.int) ---
|
||||
ShapeError :: proc(Context: ^shape_context) -> shape_error ---
|
||||
ShapeBeginManualRuns :: proc(Context: ^shape_context) ---
|
||||
ShapeNextManualRun :: proc(Context: ^shape_context, Direction: direction, Script: script) ---
|
||||
ShapeEndManualRuns :: proc(Context: ^shape_context) ---
|
||||
ShapeManualBreak :: proc(Context: ^shape_context) ---
|
||||
SizeOfShapeContext :: proc() -> c.int ---
|
||||
PlaceShapeContext :: proc(Allocator: allocator_function, AllocatorData: rawptr, Memory: rawptr) -> ^shape_context ---
|
||||
CreateShapeContext :: proc(Allocator: allocator_function, AllocatorData: rawptr) -> ^shape_context ---
|
||||
DestroyShapeContext :: proc(Context: ^shape_context) ---
|
||||
ShapePushFont :: proc(Context: ^shape_context, Font: ^font) -> ^font ---
|
||||
ShapePopFont :: proc(Context: ^shape_context) -> ^font ---
|
||||
ShapeBegin :: proc(Context: ^shape_context, ParagraphDirection: direction, Language: language) ---
|
||||
ShapeEnd :: proc(Context: ^shape_context) ---
|
||||
ShapePushFeature :: proc(Context: ^shape_context, FeatureTag: feature_tag, Value: c.int) ---
|
||||
ShapePopFeature :: proc(Context: ^shape_context, FeatureTag: feature_tag) -> b32 ---
|
||||
ShapeCodepoint :: proc(Context: ^shape_context, Codepoint: rune) ---
|
||||
ShapeCodepointWithUserId :: proc(Context: ^shape_context, Codepoint: rune, UserId: c.int) ---
|
||||
ShapeError :: proc(Context: ^shape_context) -> shape_error ---
|
||||
ShapeBeginManualRuns :: proc(Context: ^shape_context) ---
|
||||
ShapeNextManualRun :: proc(Context: ^shape_context, Direction: direction, Script: script) ---
|
||||
ShapeEndManualRuns :: proc(Context: ^shape_context) ---
|
||||
ShapeManualBreak :: proc(Context: ^shape_context) ---
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
@@ -120,17 +120,17 @@ ShapeCodepointIteratorNext :: proc "contextless" (It: ^shape_codepoint_iterator)
|
||||
//
|
||||
@(default_calling_convention="c", link_prefix="kbts_", require_results)
|
||||
foreign lib {
|
||||
FreeFont :: proc(Font: ^font) ---
|
||||
FontIsValid :: proc(Font: ^font) -> b32 ---
|
||||
LoadFont :: proc(Font: ^font, State: ^load_font_state, FontData: rawptr, FontDataSize: c.int, FontIndex: c.int, ScratchSize_: ^c.int, OutputSize_: ^c.int) -> load_font_error ---
|
||||
PlaceBlob :: proc(Font: ^font, State: ^load_font_state, ScratchMemory: rawptr, OutputMemory: rawptr) -> load_font_error ---
|
||||
GetFontInfo :: proc(Font: ^font, Info: ^font_info) ---
|
||||
FreeFont :: proc(Font: ^font) ---
|
||||
FontIsValid :: proc(Font: ^font) -> b32 ---
|
||||
LoadFont :: proc(Font: ^font, State: ^load_font_state, FontData: rawptr, FontDataSize: c.int, FontIndex: c.int, ScratchSize_: ^c.int, OutputSize_: ^c.int) -> load_font_error ---
|
||||
PlaceBlob :: proc(Font: ^font, State: ^load_font_state, ScratchMemory: rawptr, OutputMemory: rawptr) -> load_font_error ---
|
||||
GetFontInfo :: proc(Font: ^font, Info: ^font_info) ---
|
||||
|
||||
// A shape_config is a bag of pre-computed data for a specific shaping setup.
|
||||
SizeOfShapeConfig :: proc(Font: ^font, Script: script, Language: language) -> b32 ---
|
||||
PlaceShapeConfig :: proc(Font: ^font, Script: script, Language: language, Memory: rawptr) -> ^shape_config ---
|
||||
CreateShapeConfig :: proc(Font: ^font, Script: script, Language: language, Allocator: allocator_function, AllocatorData: rawptr) -> ^shape_config ---
|
||||
DestroyShapeConfig :: proc(Config: ^shape_config) ---
|
||||
SizeOfShapeConfig :: proc(Font: ^font, Script: script, Language: language) -> b32 ---
|
||||
PlaceShapeConfig :: proc(Font: ^font, Script: script, Language: language, Memory: rawptr) -> ^shape_config ---
|
||||
CreateShapeConfig :: proc(Font: ^font, Script: script, Language: language, Allocator: allocator_function, AllocatorData: rawptr) -> ^shape_config ---
|
||||
DestroyShapeConfig :: proc(Config: ^shape_config) ---
|
||||
|
||||
// A glyph_storage holds and recycles glyph data.
|
||||
InitializeGlyphStorage :: proc(Storage: ^glyph_storage, Allocator: allocator_function, AllocatorData: rawptr) -> b32 ---
|
||||
@@ -145,7 +145,7 @@ foreign lib {
|
||||
// A glyph_config specifies glyph-specific shaping parameters.
|
||||
// A single glyph_config can be shared by multiple glyphs.
|
||||
|
||||
DestroyGlyphConfig :: proc(Config: ^glyph_config) ---
|
||||
DestroyGlyphConfig :: proc(Config: ^glyph_config) ---
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
@@ -303,10 +303,10 @@ foreign lib {
|
||||
FontCoverageTestCodepoint :: proc(Test: ^font_coverage_test, Codepoint: rune) ---
|
||||
FontCoverageTestEnd :: proc(Test: ^font_coverage_test) -> b32 ---
|
||||
|
||||
EncodeUtf8 :: proc(Codepoint: rune) -> encode_utf8 ---
|
||||
ScriptDirection :: proc(Script: script) -> direction ---
|
||||
ScriptIsComplex :: proc(Script: script) -> b32 ---
|
||||
ScriptTagToScript :: proc(Tag: script_tag) -> script ---
|
||||
EncodeUtf8 :: proc(Codepoint: rune) -> encode_utf8 ---
|
||||
ScriptDirection :: proc(Script: script) -> direction ---
|
||||
ScriptIsComplex :: proc(Script: script) -> b32 ---
|
||||
ScriptTagToScript :: proc(Tag: script_tag) -> script ---
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
|
||||
65
vendor/kb_text_shape/kb_text_shape_types.odin
vendored
65
vendor/kb_text_shape/kb_text_shape_types.odin
vendored
@@ -1868,8 +1868,12 @@ break_type :: struct {
|
||||
bracket :: struct {
|
||||
Codepoint: rune,
|
||||
Position: u32,
|
||||
Direction: u8,
|
||||
Script: u8,
|
||||
using DirectionBitField: bit_field u8 {
|
||||
Direction: direction | 8,
|
||||
},
|
||||
using ScriptBitField: bit_field u8 {
|
||||
Script: script | 8,
|
||||
},
|
||||
}
|
||||
|
||||
// In the worst case, a single call to BreakAddCodepoint would generate 4 breaks.
|
||||
@@ -1899,26 +1903,63 @@ break_state :: struct {
|
||||
BracketCount: u32,
|
||||
Flags: break_state_flags,
|
||||
|
||||
FlagState: u32, // u8(break_flags)x4
|
||||
FlagState: bit_field u32 {
|
||||
_0: u32 | 8, // break_flags
|
||||
_1: u32 | 8, // break_flags
|
||||
_2: u32 | 8, // break_flags
|
||||
_3: u32 | 8, // break_flags
|
||||
},
|
||||
PositionOffset2: i16,
|
||||
PositionOffset3: i16,
|
||||
|
||||
WordBreakHistory: u32, // u8x4
|
||||
WordBreaks: u16, // u4x4
|
||||
WordUnbreaks: u16, // u4x4
|
||||
WordBreakHistory: bit_field u32 {
|
||||
_0: u32 | 8,
|
||||
_1: u32 | 8,
|
||||
_2: u32 | 8,
|
||||
_3: u32 | 8,
|
||||
},
|
||||
WordBreaks,
|
||||
WordUnbreaks: bit_field u16 {
|
||||
_0: u16 | 4,
|
||||
_1: u16 | 4,
|
||||
_2: u16 | 4,
|
||||
_3: u16 | 4,
|
||||
},
|
||||
WordBreak2PositionOffset: i16,
|
||||
|
||||
LineBreaks: u64, // u16x4
|
||||
LineBreaks: bit_field u64 {
|
||||
_0: u64 | 16,
|
||||
_1: u64 | 16,
|
||||
_2: u64 | 16,
|
||||
_3: u64 | 16,
|
||||
},
|
||||
// Instead of staying synchronized with LineBreaks/LineUnbreaks,
|
||||
// this advances every character always.
|
||||
// (This is only needed because ZWJ can create an unbreak while simultaneously being ignored.)
|
||||
LineUnbreaksAsync: u64, // u16x4
|
||||
LineUnbreaks: u64, // u16x4
|
||||
LineBreakHistory: u32, // u8(line_break_class)x4
|
||||
LineUnbreaksAsync: bit_field u64 {
|
||||
_0: u64 | 16,
|
||||
_1: u64 | 16,
|
||||
_2: u64 | 16,
|
||||
_3: u64 | 16,
|
||||
},
|
||||
LineUnbreaks: bit_field u64 {
|
||||
_0: u64 | 16,
|
||||
_1: u64 | 16,
|
||||
_2: u64 | 16,
|
||||
_3: u64 | 16,
|
||||
},
|
||||
LineBreakHistory: bit_field u32 {
|
||||
_0: u32 | 8,
|
||||
_1: u32 | 8,
|
||||
_2: u32 | 8,
|
||||
_3: u32 | 8,
|
||||
},
|
||||
LineBreak2PositionOffset: i16,
|
||||
LineBreak3PositionOffset: i16,
|
||||
|
||||
LastDirection: u8,
|
||||
using LastDirectionBitField: bit_field u8 {
|
||||
LastDirection: direction | 8,
|
||||
},
|
||||
BidirectionalClass2: u8,
|
||||
BidirectionalClass1: u8,
|
||||
Bidirectional1PositionOffset: i16,
|
||||
@@ -2012,7 +2053,7 @@ glyph :: struct {
|
||||
|
||||
// Unicode properties filled in by CodepointToGlyph.
|
||||
JoiningType: unicode_joining_type,
|
||||
UnicodeFlags: u8,
|
||||
UnicodeFlags: unicode_flags,
|
||||
SyllabicClass: u8,
|
||||
SyllabicPosition: u8,
|
||||
UseClass: u8,
|
||||
|
||||
Reference in New Issue
Block a user