Commit 791f1c19 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacViews: Only use context for text shape when using RTL languages

The call to hb_buffer_add_utf16 will read up to 5 characters adjacent
to the specified range. This context is only used in the function
arabic_joining.

We can get much better caching if we don't include this context in our
keys. Arabic is an RTL language, so we can omit this context in the key
for all non-RTL languages.

Bug: 860612, 862773
Change-Id: Icc11059886ab835032141ad25b966d358f7177b3
Reviewed-on: https://chromium-review.googlesource.com/1135723
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarSidney San Martín <sdy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574834}
parent 29cbb720
......@@ -923,9 +923,10 @@ struct ShapeRunWithFontInput {
obscured(obscured),
subpixel_rendering_suppressed(subpixel_rendering_suppressed) {
// hb_buffer_add_utf16 will read the previous and next 5 unicode characters
// (which can have a maximum length of 2 uint16_t). Read the previous and
// next 10 uint16_ts to ensure that we capture all of this context.
constexpr size_t kContextSize = 10;
// (which can have a maximum length of 2 uint16_t) as "context" that is used
// only for Arabic (which is RTL). Read the previous and next 10 uint16_ts
// to ensure that we capture all of this context if we're using RTL.
size_t kContextSize = is_rtl ? 10 : 0;
size_t context_start = full_range.start() < kContextSize
? 0
: full_range.start() - kContextSize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment