Text improvements

* Added clear_atlas_region_caches & clear_shape_cache to VEFontCache (Used on hot-reload by the pototype's font provider)
* Made glyph_draw's over_sample a vec2 for initialization (incase user wants to do some float value multiple of 4x4)
* ADVANCE_SNAP_SMALLFONT_SIZE made a runtime option: Shaper_Context.adv_snap_small_font_threshold
* Large imporvement to text hinting and general rendering of text
This commit is contained in:
2024-12-29 17:30:00 -05:00
parent 7eab6f9a7f
commit 7488a6828e
10 changed files with 171 additions and 69 deletions

View File

@ -43,7 +43,8 @@ font_provider_startup :: proc( ctx : ^FontProviderContext )
font_cache, error = make( HMapChained(FontDef), hmap_closest_prime(1 * Kilo), persistent_allocator(), dbg_name = "font_cache" )
verify( error == AllocatorError.None, "Failed to allocate font_cache" )
ve.startup( & ve_ctx, .STB_TrueType, allocator = persistent_slab_allocator(), use_advanced_text_shaper = true )
ve.startup( & ve_ctx, .STB_TrueType, allocator = persistent_slab_allocator() )
ve_ctx.glyph_buffer.over_sample = { 4,4 }
log("VEFontCached initialized")
// provider_data.ve_ctx.debug_print = true
// provider_data.ve_ctx.debug_print_verbose = true
@ -52,8 +53,11 @@ font_provider_startup :: proc( ctx : ^FontProviderContext )
font_provider_reload :: proc( ctx : ^FontProviderContext )
{
ctx.ve_ctx.glyph_buffer.over_sample = { 4,4 } * 1.0
hmap_chained_reload( ctx.font_cache, persistent_allocator())
ve.hot_reload( & ctx.ve_ctx, persistent_slab_allocator() )
ve.clear_atlas_region_caches(& ctx.ve_ctx)
ve.clear_shape_cache(& ctx.ve_ctx)
}
font_provider_shutdown :: proc( ctx : ^FontProviderContext )