From 745ca37668eff076ae80b0343e928daf55d88515 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sun, 3 Nov 2019 16:19:02 -0800 Subject: [PATCH] Layout fill bug fix to get better item packing --- custom/4coder_layout_rule.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/custom/4coder_layout_rule.cpp b/custom/4coder_layout_rule.cpp index 053860ec..f593f664 100644 --- a/custom/4coder_layout_rule.cpp +++ b/custom/4coder_layout_rule.cpp @@ -28,7 +28,7 @@ layout_write(Arena *arena, Layout_Item_List *list, i64 index, u32 codepoint, Lay Temp_Memory restore_point = begin_temp(arena); Layout_Item *item = push_array(arena, Layout_Item, 1); - Layout_Item_Block *block = list->first; + Layout_Item_Block *block = list->last; if (block != 0){ if (block->items + block->item_count == item){ block->item_count += 1; @@ -46,8 +46,8 @@ layout_write(Arena *arena, Layout_Item_List *list, i64 index, u32 codepoint, Lay block->items = item; block->item_count = 1; } - list->item_count += 1; + list->item_count += 1; list->manifested_index_range.min = min(list->manifested_index_range.min, index); list->manifested_index_range.max = max(list->manifested_index_range.max, index); @@ -144,8 +144,7 @@ lr_tb_write_with_advance_with_flags(LefRig_TopBot_Layout_Vars *vars, f32 advance } vars->p.x = f32_ceil32(vars->p.x); f32 next_x = vars->p.x + advance; - layout_write(arena, list, index, codepoint, flags, - Rf32(vars->p, V2f32(next_x, vars->text_y))); + layout_write(arena, list, index, codepoint, flags, Rf32(vars->p, V2f32(next_x, vars->text_y))); vars->p.x = next_x; }