Layout fill bug fix to get better item packing

master
Allen Webster 2019-11-03 16:19:02 -08:00
parent 5b9a29e215
commit 745ca37668
1 changed files with 3 additions and 4 deletions

View File

@ -28,7 +28,7 @@ layout_write(Arena *arena, Layout_Item_List *list, i64 index, u32 codepoint, Lay
Temp_Memory restore_point = begin_temp(arena); Temp_Memory restore_point = begin_temp(arena);
Layout_Item *item = push_array(arena, Layout_Item, 1); 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 != 0){
if (block->items + block->item_count == item){ if (block->items + block->item_count == item){
block->item_count += 1; 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->items = item;
block->item_count = 1; 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.min = min(list->manifested_index_range.min, index);
list->manifested_index_range.max = max(list->manifested_index_range.max, 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); vars->p.x = f32_ceil32(vars->p.x);
f32 next_x = vars->p.x + advance; f32 next_x = vars->p.x + advance;
layout_write(arena, list, index, codepoint, flags, layout_write(arena, list, index, codepoint, flags, Rf32(vars->p, V2f32(next_x, vars->text_y)));
Rf32(vars->p, V2f32(next_x, vars->text_y)));
vars->p.x = next_x; vars->p.x = next_x;
} }