demo · v143

EditContext Underline

A live EditContext editor below. Pick an IME-style underline; when text is composed (or when you click Simulate composition) the format update fires and the renderer reads underlineStyle and underlineThickness to draw it. Pre-v143 those fields returned bogus values.

editor

Click here, then type via an IME, or hit Simulate composition.

last textformatupdate

none yet

rendered with the v143 values

composition will appear here

every style at a glance

the call

const ctx = new EditContext();
host.editContext = ctx;
ctx.addEventListener("textformatupdate", (e) => {
  for (const f of e.getTextFormats()) {
    // v143: underlineStyle and underlineThickness are now correct
    paintUnderline(f.rangeStart, f.rangeEnd,
                   f.underlineStyle, f.underlineThickness);
  }
});

see also