missing changes

This commit is contained in:
2024-07-01 17:43:41 -04:00
parent 6d4745700f
commit 7c64e20f9c
4 changed files with 16 additions and 7 deletions

View File

@@ -705,8 +705,8 @@ etiam dignissim diam quis enim. Convallis convallis tellus id interdum.`
cleanup :: proc "c" () { cleanup :: proc "c" () {
context = runtime.default_context() context = runtime.default_context()
// ve.shutdown( & demo_ctx.ve_ctx ) ve.shutdown( & demo_ctx.ve_ctx )
// gfx.shutdown() gfx.shutdown()
} }
main :: proc() main :: proc()

View File

@@ -476,7 +476,7 @@ draw_text_batch :: proc(ctx: ^Context, entry: ^Entry, shaped: ^ShapedText,
bounds_size := Vec2 { vbounds_1.x - vbounds_0.x, vbounds_1.y - vbounds_0.y } bounds_size := Vec2 { vbounds_1.x - vbounds_0.x, vbounds_1.y - vbounds_0.y }
shaped_position := shaped.positions[index] shaped_position := shaped.positions[index]
glyph_translate := position + shaped_position * scale glyph_translate := position + (shaped_position) * scale
if region_kind == .E if region_kind == .E
{ {

View File

@@ -106,7 +106,7 @@ shape_text_uncached :: proc( ctx : ^Context, font : FontID, text_utf8 : string,
max_line_width = max(max_line_width, position.x) max_line_width = max(max_line_width, position.x)
position.x = 0.0 position.x = 0.0
position.y -= line_height position.y -= line_height
position.y = ceil(position.y) position.y = position.y
prev_codepoint = rune(0) prev_codepoint = rune(0)
continue continue
} }
@@ -117,19 +117,22 @@ shape_text_uncached :: proc( ctx : ^Context, font : FontID, text_utf8 : string,
append( & output.glyphs, parser_find_glyph_index( & entry.parser_info, codepoint )) append( & output.glyphs, parser_find_glyph_index( & entry.parser_info, codepoint ))
advance, _ := parser_get_codepoint_horizontal_metrics( & entry.parser_info, codepoint ) advance, _ := parser_get_codepoint_horizontal_metrics( & entry.parser_info, codepoint )
if ctx.snap_shape_pos do position.x = ceil(position.x)
append( & output.positions, Vec2 { append( & output.positions, Vec2 {
ceil(position.x), position.x,
position.y position.y
}) })
position.x += ceil(f32(advance) * entry.size_scale) position.x += f32(advance) * entry.size_scale
if ctx.snap_shape_pos do position.x = ceil(position.x)
prev_codepoint = codepoint prev_codepoint = codepoint
} }
output.end_cursor_pos = position output.end_cursor_pos = position
max_line_width = max(max_line_width, position.x) max_line_width = max(max_line_width, position.x)
output.size.x = ceil(max_line_width) output.size.x = max_line_width
output.size.y = f32(line_count) * line_height output.size.y = f32(line_count) * line_height
} }
} }

View File

@@ -45,6 +45,7 @@ Context :: struct {
snap_width : f32, snap_width : f32,
snap_height : f32, snap_height : f32,
colour : Colour, colour : Colour,
cursor_pos : Vec2, cursor_pos : Vec2,
@@ -61,6 +62,7 @@ Context :: struct {
default_curve_quality : i32, default_curve_quality : i32,
text_shape_adv : b32, text_shape_adv : b32,
snap_shape_pos : b32,
debug_print : b32, debug_print : b32,
debug_print_verbose : b32, debug_print_verbose : b32,
@@ -135,6 +137,8 @@ startup :: proc( ctx : ^Context, parser_kind : ParserKind,
atlas_params := InitAtlasParams_Default, atlas_params := InitAtlasParams_Default,
glyph_draw_params := InitGlyphDrawParams_Default, glyph_draw_params := InitGlyphDrawParams_Default,
shape_cache_params := InitShapeCacheParams_Default, shape_cache_params := InitShapeCacheParams_Default,
use_advanced_text_shaper : b32 = true,
snap_shape_position : b32 = true,
default_curve_quality : u32 = 3, default_curve_quality : u32 = 3,
entires_reserve : u32 = 512, entires_reserve : u32 = 512,
temp_path_reserve : u32 = 1024, temp_path_reserve : u32 = 1024,
@@ -147,6 +151,8 @@ startup :: proc( ctx : ^Context, parser_kind : ParserKind,
ctx.backing = allocator ctx.backing = allocator
context.allocator = ctx.backing context.allocator = ctx.backing
snap_shape_pos = snap_shape_position
if default_curve_quality == 0 { if default_curve_quality == 0 {
default_curve_quality = 3 default_curve_quality = 3
} }