• Dominik Röttsches's avatar
    Add locale to cache key for set of fallback fonts · 42e9af1a
    Dominik Röttsches authored
    The fallback cache was originally introduced in issue 603314 to avoid
    extra IPC overhead when finding fallback fonts for an identical base
    family. It needs to be investigated in how much this cache actually
    helps, but for now, avoid CJK fallback cache priming inconsistencies by
    adding the locale to the cache key.
    
    When an ideograph character was requested with a Chinese locale before
    requesting it with a Japanese locale, the Japanese request would
    retrieve a Chinese font and vice versa. Add the locale to the key to
    avoid ignoring the locale, which is very relevant for CJK fallback.
    
    I was not able to add a test with reasonable effort: as the current code
    tries the user preferences fonts first for CJK characters and does not
    necessarily reach fallback. On the other hand, testing this is in a more
    localized unittest is not possible at it requires a Mojo IPC connection
    to the browser process and DWriteFontProxy to be running on the other
    side. In the existing FontFallback unittests, a DWriteFakeSender is
    initialized which simulates a font collection with only one font and
    does not allow access to system fonts.
    
    Bug: 992936
    Change-Id: I4635bf2d3f7d598e89357dbd3269510667e2f961
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1751246
    Commit-Queue: Emil A Eklund <eae@chromium.org>
    Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#686405}
    42e9af1a
font_fallback_win.cc 8.53 KB