Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Fonts Height is too Higher then FontSize #17805

Open
inquick opened this issue Dec 19, 2024 · 4 comments
Open

Custom Fonts Height is too Higher then FontSize #17805

inquick opened this issue Dec 19, 2024 · 4 comments
Labels
area-textprocessing by-design The behavior reported in the issue is actually correct.

Comments

@inquick
Copy link

inquick commented Dec 19, 2024

Describe the bug

I add two TextBlock in window, and use custom fonts. The Digiface FontFamily shows normally but the "思源黑体 CN Regular" shows not as what i want.
image
Is there any way to make "思源黑体 CN Regular" shows Alignment center?
The code is:
`

`

To Reproduce

Fonts.zip

  1. Copy the two ttf files to application resources under /Assets/Fonts/
  2. Add <TextBlock Background="Blue" Text="00:00" FontSize="20" FontFamily="avares://CommandCenter/Assets/Fonts/DIGITAL-REGULAR.TTF#Digiface" VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center"/> <TextBlock Background="Blue" FontSize="20" FontFamily="avares://CommandCenter/Assets/Fonts/SourceHanSansCN-Regular.ttf#思源黑体 CN Regular" VerticalAlignment="Center" >Hello</TextBlock> in any view.axaml files.
    3. Build and abserve the UI about “Hello”.

Expected behavior

No response

Avalonia version

11.2.1

OS

Windows

Additional context

No response

@inquick inquick added the bug label Dec 19, 2024
@timunie
Copy link
Contributor

timunie commented Dec 20, 2024

Please try always latest version available, best nightly. Also worth to test Font on Word or similar, could also be a font issue.

@inquick
Copy link
Author

inquick commented Dec 23, 2024

Please try always latest version available, best nightly. Also worth to test Font on Word or similar, could also be a font issue.

OK,I'll try this.

@inquick
Copy link
Author

inquick commented Dec 24, 2024

I first test four Chinese fonts in WPS Word,Only “宋体” seems good,other three all seems Higher then font size. I'm not sure if this is a common problem with Chinese fonts.
The following are the videos and pictures I tested.

Test.font.in.Word.mp4

微信截图_20241223100143
@timunie Thanks,This may be the reason for the Chinese font.

@timunie timunie added by-design The behavior reported in the issue is actually correct. area-textprocessing and removed bug labels Dec 24, 2024
@timunie
Copy link
Contributor

timunie commented Dec 24, 2024

If it's typical for the font, this is not an Avalonia bug imo, so I marked it as by design. Maybe someone has an idea how to configure it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-textprocessing by-design The behavior reported in the issue is actually correct.
Projects
None yet
Development

No branches or pull requests

2 participants