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

Text component draws Chinese garbled characters #2695

Closed
shellyaoo opened this issue Oct 18, 2024 · 2 comments
Closed

Text component draws Chinese garbled characters #2695

shellyaoo opened this issue Oct 18, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@shellyaoo
Copy link

Description

import { Canvas, Image as SkiaIamge, useImage, Path, Skia, FontStyle, Text as SkiaText, useTexture } from '@shopify/react-native-skia';

const familyName = Platform.select({ ios: "Helvetica", default: "serif" });
const fontMgr = Skia.FontMgr.System();
const typeface = fontMgr.matchFamilyStyle(familyName, FontStyle.Bold);
const font = Skia.Font(typeface, 12);

<Canvas
style={[styles.image, { height: editImgHeight, width: editImgWidth }]}
>
<SkiaText
x={0}
y={30}
text={'你好呀,世界'}
font={font}
style="fill"
color={'#DE4188'}
/>

Text component draws Chinese garbled characters

My project needs to support both Chinese and English. English is not garbled, but Chinese is garbled. Is it because the font is not supported? My phone can support Chinese display,

The displayed Chinese effect is as follows

Image

@shellyaoo shellyaoo added the documentation Improvements or additions to documentation label Oct 18, 2024
@shellyaoo
Copy link
Author

shellyaoo commented Oct 18, 2024

"@shopify/react-native-skia": "^1.4.2",
It is in the Expo environment

The Expo framework was tested on the HarmonyOS machine

@wcandillon
Copy link
Contributor

Yes this is definitely because of the font. We test Chinese characters in our test suite. If you think there is a bug, please submit a reproduction and we will investigate it. Closing it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants