microsoft / microsoft/microsoft-ui-xaml

Text block with italic and justified text seems to be cut off

Open
#9,993 3 comments 0 reactions 0 assignees View on GitHub
area-TextBlocks bug
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

It seems that italic font is not taken into account by text blocks and as a result some characters might not be displayed fully.

### Steps to reproduce the bug

The following XAML code reproduces the issue:

```xaml


Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

```
(See https://github.com/MartyIX/WinUiDemos/tree/feature/2024-09-15-TextBlock-italic-and-justify and https://github.com/MartyIX/WinUiDemos/commit/76c0d044c756ac689996e816e445aef8c65db3c6)

It displays as follows:

![image](https://github.com/user-attachments/assets/a1461f36-9d5a-47fb-befb-e8f34c6b9d9d)

where `f` (and other characters) is not fully visible:

![image](https://github.com/user-attachments/assets/acb1892e-90f5-42e7-baa3-755bb7a5c8b7)

### Expected behavior

All characters should be fully displayed.

### Screenshots

_No response_

### NuGet package version

None

### Windows version

Windows 11 (22H2): Build 22621

### Additional context

As a workaround one can set the `Padding` attribute of `` - e.g.



Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

The result is then:

![image](https://github.com/user-attachments/assets/5ec18ea7-7f04-4fd5-b060-f242c7654957)

Contributor guide

Open the contributing guide

Research direction

Start with the linked WinUiDemos XAML reproduction and verify the clipping with italic, justified, wrapped TextBlock content. Trace the text layout and rendering path responsible for that scenario; done means all characters display fully without requiring extra Padding.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.