Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9997ea77 authored by Tyler Freeman's avatar Tyler Freeman
Browse files

fix(high contrast text): fix background rect overlaps other characters with multiple spans

Sometimes, when text is rendered in multiple passes, e.g. emoji, the
high-contrast background of the characters in the second pass will
overlap characters drawn in the first pass.

We alleviate this by moving the background rect drawing to the Layout
side instead of the Canvas.drawText() side. That way we can draw all the
background rects first, so they don't overdraw on the text part.

The disadvantage here is now the background rects only work if you are
using a Layout. Direct calls to Canvas.drawText() will gracefully
degrade to have a stroke border around the text (albeit a thicker one
that's easier to read than what we had before.) Compose and other UI
frameworks will have to be updated separately to apply the rectangle
background treatment.

Bug: 186567103
Fix: 335018362
Bug: 333999443

Flag: ACONFIG com.android.graphics.hwui.flags.high_contrast_text_small_text_rect TEAMFOOD
Test: atest core/tests/coretests/src/android/text/LayoutTest.java
Test: manual
1. adb shell setenforce 0 && adb shell setprop persist.device_config.aconfig_flags.accessibility.com.android.graphics.hwui.flags.high_contrast_text_small_text_rect true && adb shell stop && adb shell start
2. Settings -> Accessibility -> Display Size and Text
3. Turn on High Contrast Text
4. Background rects should be drawn behind all textviews

Change-Id: I76ff4f0f434909a5c1d2a14faeda02ae6a75256e
parent de69b4a1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment