    width: charWidth,
        height: FONT_SIZE
      });
    }

    editContext.addEventListener("characterboundsupdate", e => {
      const rangeStart = e.rangeStart;
      const rangeEnd = e.rangeEnd;

      // Calculate bounds for each character in the range.
      if (rangeEnd > rangeStart) {
        const charBounds = [];
        for (offset = rangeStart; offset < rangeEnd; offset++) {
          const bound = computeCharacterBound(offset);
          charBounds.push(bound);
        }
        editContex