Skip to content

TextBox caret skips over "ti" in Calibri #19684

@lindexi

Description

@lindexi

Describe the bug

I found that Avalonia's TextBox caret and hit-testing behave incorrectly for certain fonts. When using Calibri and typing "ti", the caret movements and mouse hit-testing treat "ti" (as the Standard Ligatures ‘liga’ words) like a single character (the caret jumps over the "ti" pair and you cannot place the caret between them). The same font behaves correctly in WPF.

To Reproduce

Steps to reproduce

  1. Create an Avalonia window with a TextBox.
  2. Set the FontFamily to "Calibri".
  3. Type the text: ti
  4. Press the left/right arrow keys or try to click between the characters with the mouse.

The main code is:

      <TextBox Margin="10,10,10,10" FontSize="30" FontFamily="Calibri" Text="tia"></TextBox>

You can find all code in https://github.com/lindexi/lindexi_gd/tree/7c3c7e35c93f7a0dd3ae8f08a04257f20ecaf8c2/AvaloniaIDemo/JeheryucereceruNejukicairloru

The current behavior is:

Image

Expected behavior

Work as WPF:

Image

Avalonia version

Any

OS

No response

Additional context

Reference: https://stackoverflow.com/questions/62552451/why-harfbuzz-shape-2-single-char-into-one-glyph

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions