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

Cairosvg doesn't support unicode #72

Closed
q3yi opened this issue Aug 19, 2015 · 14 comments
Closed

Cairosvg doesn't support unicode #72

q3yi opened this issue Aug 19, 2015 · 14 comments

Comments

@q3yi
Copy link

q3yi commented Aug 19, 2015

I have some Chinese characters in my svg file, just like:

screen shot 2015-08-19 at 10 34 04 am

when I use cairosvg to convert the svg to png, I got a result like bellow:

screen shot 2015-08-19 at 10 34 41 am

my svg file is encoding in utf-8 format, is there any way to make Cairosvg convert unicode characters correctlly?

@liZe
Copy link
Member

liZe commented Aug 19, 2015

It's probably a problem related to fonts, not unicode. CairoSVG doesn't automatically find fallback fonts when the default font misses some characters. Please try to set a font-family property (with a font with Chinese characters), it should work.

@q3yi
Copy link
Author

q3yi commented Aug 20, 2015

Thanks, After try on another Ubuntu system, I think it's something related to fonts too, cause the svg is rend correctly on a desktop ubuntu, but would fail when on a ubuntu server edition environment.

@q3yi q3yi closed this as completed Aug 20, 2015
@SimonSapin
Copy link
Member

Servers typically don’t have many fonts installed (if any). Try installing some Chinese fonts on that server?

@ahan-ai
Copy link

ahan-ai commented Dec 29, 2020

Got the same issue.

@liZe
Copy link
Member

liZe commented Dec 29, 2020

Got the same issue.

Installing fonts on your system should fix this issue.

@ahan-ai
Copy link

ahan-ai commented Jan 1, 2021

Got the same issue.

Installing fonts on your system should fix this issue.

How to install, is there any document?

@liZe
Copy link
Member

liZe commented Jan 1, 2021

How to install, is there any document?

It depends, what’s your OS?

@ahan-ai
Copy link

ahan-ai commented Jan 3, 2021

How to install, is there any document?

It depends, what’s your OS?

I hope to use it on both Mac and Windows.
But is ok if only one of them can work.

@liZe
Copy link
Member

liZe commented Jan 3, 2021

I hope to use it on both Mac and Windows.
But is ok if only one of them can work.

Oh, I thought that you had an obscure Linux distribution :D.

You can install a font just you would normally do. On Windows, you can right-click on the font and choose "install for all users". On macOS, you can follow the official support page.

@ahan-ai
Copy link

ahan-ai commented Jan 4, 2021

I hope to use it on both Mac and Windows.
But is ok if only one of them can work.

Oh, I thought that you had an obscure Linux distribution :D.

You can install a font just you would normally do. On Windows, you can right-click on the font and choose "install for all users". On macOS, you can follow the official support page.

I think I have installed many fonts in my Mac, here is my font book:
image

Do I need more configuration? For example, how can I set the font that cairosvg uses?

@liZe
Copy link
Member

liZe commented Jan 4, 2021

For example, how can I set the font that cairosvg uses?

You have to use the font-family property in the text tag.

@ahan-ai
Copy link

ahan-ai commented Jan 5, 2021

For example, how can I set the font that cairosvg uses?

You have to use the font-family property in the text tag.

Thank you! I solve the problem.

Before generating the .svg file, I must set the font-family to a font which supports Chinese. Now I set the font-family to "Heiti SC Medium", and it can support Chinese.

@eigen2017
Copy link

same issue,ubuntu server,how to install font?

@liZe
Copy link
Member

liZe commented Aug 3, 2024

same issue,ubuntu server,how to install font?

You can find some information on Internet about that, this is not a support forum. 😄

https://askubuntu.com/questions/3697/how-do-i-install-fonts

@Kozea Kozea locked as resolved and limited conversation to collaborators Aug 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants