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

Issue with RTL language support #4

Closed
KeyMetricSoft opened this issue Jan 23, 2024 · 2 comments
Closed

Issue with RTL language support #4

KeyMetricSoft opened this issue Jan 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@KeyMetricSoft
Copy link

Hello,

I have a WPF application that uses FluentIcons, and recently came across an interesting issue. A user sent me a screenshot of my application with all the icons either missing entirely or incorrectly positioned.

I struggled to reproduce the problem at first, but eventually tracked it down to his use of Arabic as his system display language.

I believe the problem is with this line of code in the SymbolIcon class:

_formattedText = new FormattedText( Symbol.ToString(IsFilled), CultureInfo.CurrentCulture, CultureInfo.CurrentCulture.TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight, _font, FontSize, Foreground, VisualTreeHelper.GetDpi(this).PixelsPerDip);

As you can see, the FlowDirection of the FormattedText object is changed based on the current culture, but I believe WPF always defaults to FlowDirection.LeftToRight.

I pulled the code into a local repo and changed it to pass FlowDirection.LeftToRight as the third argument to the FormattedText constructor. Doing so resolved the problem, and allowed the icons to appear correctly on the user's Arabic language system.

Interestingly, even if I change the FlowDirection of my entire application the icons will only appear (on systems using Arabic language) if I use the code change described above. They never show otherwise, regardless of FlowDirection.

I'm not sure if my testing is thorough enough to warrant a permanent code change, but I wanted to share the results of my tests in case they help someone else.

  • Mark
davidxuang added a commit that referenced this issue Jan 23, 2024
@davidxuang
Copy link
Owner

davidxuang commented Jan 23, 2024

Could you test the patch (27e3d27) please?

Interestingly, even if I change the FlowDirection of my entire application the icons will only appear (on systems using Arabic language) if I use the code change described above. They never show otherwise, regardless of FlowDirection.

Maybe it's that you changed FlowDirection instead of CultureInfo.CurrentCulture. The former will defaults to the latter, but changing the former will not affect the latter (your locale).

davidxuang added a commit that referenced this issue Jan 23, 2024
@davidxuang davidxuang added the bug Something isn't working label Jan 24, 2024
@KeyMetricSoft
Copy link
Author

KeyMetricSoft commented Jan 29, 2024

Hi David,

After testing in various language environments, I can confirm that your patch corrects the issue.

Thanks for your rapid response to this problem.

  • Mark

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

No branches or pull requests

2 participants