3/24/2024 0 Comments Reflow text inside rectangle skia![]() We may also be able to make these measurements off-DOM, like in an iframe or something. When typing, however, we need to measure after the update in order for the content to be on screen, then trigger another update based on our measurement. When simply moving the cursor, we can measure before the update. This was our original approach but I moved away from it because we were naively reading the DOM whenever we needed to translate positions, which was causing reflows.īut we actually can safely read this information, so long as we do so either at the start of an update before we actually update the DOM, or at the end of an update, after we are finished updating the DOM. My current thinking is that when calculating a pixel position, we need to explicitly measure the distance from the beginning of the line to the column in question rather than consulting our encyclopedia of character widths. We're going to need a different approach. What's worse, when subpixel font scaling is turned on, Chrome starts reporting different widths even for fixed width fonts. Kerning, ligatures, and other stuff the type rendering engine does can result in an a taking up different amount of space in different contexts. The problem is that for non fixed-width fonts, a given character doesn't have a single width. Then, when we calculate the pixel position for a given row and column, we just simply total up the recorded width for every character we encounter. So, for example, we can determine that the width of an a character in the. In our existing approach, we attempt to measure the width of characters in a given context. ![]() The truth is our existing approach to measuring horizontal positions on screen is somewhat ill-conceived, and it needs to be changed. ![]() We disabled subpixel scaling with a flag, but that was only a temporary stopgap measure. When Chrome 39 added support for subpixel font scaling, it broke our approach to horizontal position measurement. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |