VEFontCache: Initial hookup to sectr module & runtime bugfixes

This commit is contained in:
2024-06-06 01:07:23 -04:00
parent 38be79d7a9
commit 71e8fadcab
6 changed files with 29 additions and 13 deletions

View File

@ -226,7 +226,7 @@ InitShapeCacheParams_Default :: InitShapeCacheParams {
}
// ve_fontcache_init
init :: proc( ctx : ^Context,
init :: proc( ctx : ^Context, parser_kind : ParserKind,
allocator := context.allocator,
atlas_params := InitAtlasParams_Default,
glyph_draw_params := InitGlyphDrawParams_Default,

View File

@ -40,12 +40,13 @@ array_underlying_slice :: grime.array_underlying_slice
HMapChained :: grime.HMapChained
hmap_chained_clear :: grime.hmap_chained_clear
hmap_chained_init :: grime.hmap_chained_init
hmap_chained_get :: grime.hmap_chained_get
hmap_chained_remove :: grime.hmap_chained_remove
hmap_chained_set :: grime.hmap_chained_set
hmap_closest_prime :: grime.hmap_closest_prime
hmap_chained_clear :: grime.hmap_chained_clear
hmap_chained_destroy :: grime.hmap_chained_destroy
hmap_chained_init :: grime.hmap_chained_init
hmap_chained_get :: grime.hmap_chained_get
hmap_chained_remove :: grime.hmap_chained_remove
hmap_chained_set :: grime.hmap_chained_set
hmap_closest_prime :: grime.hmap_closest_prime
// Pool :: grime.Pool
@ -82,6 +83,7 @@ clear :: proc {
delete :: proc {
array_free,
hmap_chained_destroy,
}
get :: proc {

View File

@ -70,6 +70,11 @@ parser_init :: proc( ctx : ^ParserContext )
assert( error == .None, "VEFontCache.parser_init: Failed to allocate fonts array" )
}
parser_shutdown :: proc( ctx : ^ParserContext )
{
// TODO(Ed): Implement
}
parser_load_font :: proc( ctx : ParserContext, label : string, data : []byte ) -> (font : ^ParserFontInfo)
{
key := font_key_from_label(label)

View File

@ -27,6 +27,11 @@ ShaperInfo :: struct {
shaper_init :: proc( ctx : ^ShaperContext )
{
ctx.hb_buffer = harfbuzz.buffer_create()
assert( ctx.hb_buffer != nil, "VEFontCache.shaper_init: Failed to create harfbuzz buffer")
error : AllocatorError
ctx.infos, error = make( HMapChained(ShaperInfo), 256 )
assert( error == .None, "VEFontCache.shaper_init: Failed to create shaper infos map" )
}
shaper_shutdown :: proc( ctx : ^ShaperContext )
@ -34,6 +39,8 @@ shaper_shutdown :: proc( ctx : ^ShaperContext )
if ctx.hb_buffer != nil {
harfbuzz.buffer_destory( ctx.hb_buffer )
}
delete(& ctx.infos)
}
shaper_load_font :: proc( ctx : ^ShaperContext, label : string, data : []byte, user_data : rawptr ) -> (info : ^ShaperInfo)