1 type TextBox 2 let char_offsets = List<Bounds>.new 3 text_block.offsets = char_offsets 4 5 let update_offsets () = 6 char_offsets.clear 7 let advance = text_block.font.advance 8 let offset_x = text_block.offset_x 9 for i = 0 to text_block.text.length do 10 let left = i.as<f32> * advance |> round |> as<u32> + offset_x 11 let bounds = Bounds 12 left = left 13 right = left + advance.round.as<u32> 14 up = 0 15 down = 0 16 17 char_offsets.add bounds 18 19 text_block.update.subscribe { update_offsets } |> push_token 20 update_offsets 21