Skip to content

Fix load the font which the name contains unicode text#2146

Merged
mattleibow merged 4 commits into
mono:mainfrom
dotnet-campus:main
Aug 8, 2022
Merged

Fix load the font which the name contains unicode text#2146
mattleibow merged 4 commits into
mono:mainfrom
dotnet-campus:main

Conversation

@lindexi

@lindexi lindexi commented Jul 5, 2022

Copy link
Copy Markdown
Contributor

Description of Change

I change the string input argument from string to IntPtr. The sk_fontmgr_match_family_style should input the utf8 encoding string, but we will input the Unicode16 string to it. That is why we can not load the font which the font name contains the unicode text, such as the Chinese font.

Bugs Fixed

API Changes

None.

Behavioral Changes

Now, we can load the font which the font name contains unicode text, such as the Chinese font.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

@lindexi

lindexi commented Jul 6, 2022

Copy link
Copy Markdown
Contributor Author

@mattleibow mattleibow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR and catching those unicode issues!

The SkiaApi.generated.cs is generated by the tools, so these changes will get overwritten. You should rather edit the json file and then re-run the generator: https://github.com/mono/SkiaSharp/tree/main/utils#generate

Comment thread binding/Binding/SkiaApi.generated.cs

@mattleibow mattleibow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Ready to go!

@mattleibow
mattleibow merged commit 4e295f6 into mono:main Aug 8, 2022
mattleibow added a commit that referenced this pull request Aug 8, 2022
Co-authored-by: lindexi <lindexi_gd@163.com>
@mattleibow

Copy link
Copy Markdown
Collaborator

I absolutely butchered the merge, so the commit is not so great. Sorry about that - had to create a special merge commit on that: 6f8fc4d

@lindexi

lindexi commented Aug 9, 2022

Copy link
Copy Markdown
Contributor Author

Thank you @mattleibow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] sk_fontmgr_match_family_style must input family name argument by utf8 string

2 participants