mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-08-06 06:52:44 -07:00
measure_shape_size & get_font_vertical_metrics: Make context immutable pass
This commit is contained in:
@@ -66,4 +66,4 @@ https://github.com/user-attachments/assets/db8c7725-84dd-48df-9a3f-65605d3ab444
|
||||
|
||||
https://github.com/user-attachments/assets/40030308-37db-492d-a196-f830e8a39f3c
|
||||
|
||||
https://github.com/user-attachments/assets/0985246b-74f8-4d1c-82d8-053414c44aec
|
||||
https://github.com/user-attachments/assets/0985246b-74f8-4d1c-82d8-053414c44aec
|
||||
|
@@ -147,7 +147,7 @@ measure_text_size :: proc( text : string, font : Font_ID, font_size := Font_Use_
|
||||
get_font_vertical_metrics :: #force_inline proc ( font : Font_ID, font_size := Font_Use_Default_Size ) -> ( ascent, descent, line_gap : f32 )
|
||||
{
|
||||
def := demo_ctx.font_ids[ font.label ]
|
||||
ascent, descent, line_gap = ve.get_font_vertical_metrics( & demo_ctx.ve_ctx, def.ve_id, font_size )
|
||||
ascent, descent, line_gap = ve.get_font_vertical_metrics( demo_ctx.ve_ctx, def.ve_id, font_size )
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -1144,7 +1144,7 @@ flush_draw_list_layer :: #force_inline proc( ctx : ^Context ) {
|
||||
// Where its assumed when utilizing the draw_list generators or shaping procedures that the shape will be affected by it so it must be handled.
|
||||
// If px_scalar is 1.0 no effect is done and its just redundant ops.
|
||||
|
||||
measure_shape_size :: #force_inline proc( ctx : ^Context, shape : Shaped_Text ) -> (measured : Vec2) {
|
||||
measure_shape_size :: #force_inline proc( ctx : Context, shape : Shaped_Text ) -> (measured : Vec2) {
|
||||
measured = shape.size * (1 / ctx.px_scalar)
|
||||
return
|
||||
}
|
||||
@@ -1178,9 +1178,8 @@ measure_text_size :: #force_inline proc( ctx : ^Context, font : Font_ID, px_size
|
||||
return shaped.size * target_scale
|
||||
}
|
||||
|
||||
get_font_vertical_metrics :: #force_inline proc ( ctx : ^Context, font : Font_ID, px_size : f32 ) -> ( ascent, descent, line_gap : f32 )
|
||||
get_font_vertical_metrics :: #force_inline proc ( ctx : Context, font : Font_ID, px_size : f32 ) -> ( ascent, descent, line_gap : f32 )
|
||||
{
|
||||
assert( ctx != nil )
|
||||
assert( font >= 0 && int(font) < len(ctx.entries) )
|
||||
|
||||
entry := ctx.entries[ font ]
|
||||
|
Reference in New Issue
Block a user