Manipulating the font size results in the script_cache going stale. From MSDN[1]
`The application should never pass the same handle for different fonts or different sizes.`
This is however exactly what happens when the font size changes as a result of zooming(both in and out). ScriptShape and relative functions will only inspect the hardware device context only if the required data is not cached[2] and hence the data from a previous call to these functions is retrieved even though the font size has changed hence the bug where text both doesn't wrap and doesn't paint as it should.
In patch one, I have tried to keep track of the script_cache objects alongside the relevant font.
Patch two fixes an issue where the cursor doesn't scale after zooming until after one interacts with the editor.
Signed-off-by: David Kahurani k.kahurani@gmail.com
1. https://docs.microsoft.com/en-us/windows/win32/intl/caching 2. https://docs.microsoft.com/en-us/windows/win32/intl/script-cache
-- v3: riched20: update caret on zooming riched20: Cache script_cache alongside font cache