• Robert Sprowson's avatar
    Edit UTF-8 text in text entry with backspace correctly · 15e2c31d
    Robert Sprowson authored
    On starting a new string using the text entry tool, cache the current alphabet, then when backspace is pressed handle deletes properly when the alphabet is UTF-8 by skipping over continuation marks until a non continuation mark is found.
    The backspace code can afford to be simplistic because any invalid UTF-8 sequences already in the file when it is opened will end up (via Ctrl-E) in a Wimp writeable, which is handled by the Wimp's robust code. Only newly created strings are able to have backspace applied, so by definition they were entered just moments earlier, and so reasonable to assume they're valid UTF-8.
    
    Having entered a string, get the bounding box right by calling Font_ScanString rather than manually walking the string with Font_CharBBox (Font_ScanString was already being used for transformed text, so rotated bounding boxes were right). Now the two are common, make a font_scanstring() function to handle both.
    
    This could be further simplified by just editing existing strings in place, see ticket #426.
    
    Version 1.30. Tagged as 'Draw-1_30'
    15e2c31d
DrawObject 67.2 KB