• Robert Knight's avatar
    Break words in text layer when adjacent chars do not overlap vertically · 265e59fc
    Robert Knight authored
    For text selection to work well it is important that `<hypothesis-text-word>`
    elements do not span multiple lines. Previously the layout analysis only created
    new words after a space. Since most lines end with a whole word, this was
    sufficient in most cases. However this doesn't work if a word is broken across
    multiple lines (eg. with a hyphen). To handle this case, also create a word
    break if the current character does not vertically overlap the previous
    character. This may create some false positives (ie. unnecessary word breaks),
    but that doesn't harm text selection.
    
    Fixes #5066
    265e59fc
image-text-layer.ts 12 KB