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 in ImageSVG will not shown #2404

Open
zhiqingchen opened this issue Apr 26, 2024 · 0 comments
Open

text in ImageSVG will not shown #2404

zhiqingchen opened this issue Apr 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zhiqingchen
Copy link

Description

https://shopify.github.io/react-native-skia/docs/images-svg#font-family

The document says:
When rendering your SVG with Skia, all fonts available in your app are also available to your SVG. However, the way you can set the font-family attribute is as flexible as on the web.

But I can't use the text that uses the system font in svg.

Version

1.2.1

Steps to reproduce

  1. Use ImageSVG components
  2. Use MakeFromString
  3. Add text to svg string
  4. This svg string is displayed normally in svgo

Snack, code example, screenshot, or link to a repository

const svg = Skia.SVG.MakeFromString(
  `<svg viewBox='0 0 200 200' width="200" height="200" xmlns='http://www.w3.org/2000/svg'>
    <text font-family="sans-serif" font-size="12" x="10" y="10" fill="#fff">Hello World</text>
  </svg>`
)!;

const HelloWorld = () => {
  return (
    <Canvas style={{ flex: 1, width: 300, height: 300 }}>
      <ImageSVG
        svg={svg}
        x={110}
        y={110}
        width={290}
        height={500}
      />
    </Canvas>
  );
};
@zhiqingchen zhiqingchen added the bug Something isn't working label Apr 26, 2024
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

1 participant