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

The button cannot display Chinese #2468

Closed
4 tasks done
lethargy123 opened this issue Jun 19, 2024 · 4 comments
Closed
4 tasks done

The button cannot display Chinese #2468

lethargy123 opened this issue Jun 19, 2024 · 4 comments
Labels
bug Something isn't working text
Milestone

Comments

@lethargy123
Copy link

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

I wrote the code normally, but the button could not display Chinese, and the problem still existed when I tried to change the Chinese font
image
image

What is the expected behavior?

The button can display Chinese

Version

master

Operating System

Windows

Do you have any log output?

no
@lethargy123 lethargy123 added the bug Something isn't working label Jun 19, 2024
@hecrj
Copy link
Member

hecrj commented Jun 19, 2024

You will need to use the text widget directly and set its shaping strategy to text::Shaping::Advanced:

use iced::widget::text;

text("你好").shaping(text::Shaping::Advanced)

@hecrj hecrj closed this as completed Jun 19, 2024
@hecrj hecrj added the text label Jun 19, 2024
@hecrj hecrj added this to the 0.13 milestone Jun 19, 2024
@lethargy123
Copy link
Author

您需要直接使用小部件并将其策略设置为:text``shaping``text::Shaping::Advanced

use iced::widget::text;

text("你好").shaping(text::Shaping::Advanced)

button does not have shaping. Do I need to customize a button?

@max397574
Copy link

haven't tried but I think you cuold put text into the button

@genusistimelord
Copy link
Contributor

Button just takes anything that turns into an Element. Strings have a preset into setup for them to turn them into a text with Basic shaping by default. If you need anything more advanced, generally anything above ASCII, then you need to use advanced shaping. If your system doesn't contain a font that has those Glyphs, you may need to add one that does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working text
Projects
None yet
Development

No branches or pull requests

4 participants