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

It does not support Chinese and Arabic characters. #142

Closed
gonzalezlrjesus opened this issue Apr 6, 2020 · 5 comments · Fixed by #165
Closed

It does not support Chinese and Arabic characters. #142

gonzalezlrjesus opened this issue Apr 6, 2020 · 5 comments · Fixed by #165

Comments

@gonzalezlrjesus
Copy link

I needed to create a document in pdf format with texts in different languages ​​(Chinese, Arabic). Although the Text component uses func (_m *Pdf) UnicodeTranslatorFromDescriptor(cpStr string) func(string) string function, it does not support Chinese or Arabic symbols, and converts them to points in the document created.

image

image

@johnfercher
Copy link
Owner

johnfercher commented May 16, 2020

I tried to remove the UnicodeTranslatorFromDescriptor from the Text component but the chinese characters still not working. I found an issue thread on gofpdf that said that gofpdf doesn't support these languages. jung-kurt/gofpdf#59 (comment)

Code

m.Col(6, func() {
	m.Text("中文 Packages Report: Daily", props.Text{
		Top:   1,
		Align: consts.Center,
	})
	m.Text("Type: Small, Medium", props.Text{
		Top:   7,
		Align: consts.Center,
	})
})

Result

Captura de Tela 2020-05-16 às 13 54 34

I don't know another way to add support to these characters.

@Vale-sail
Copy link

I tried to remove the UnicodeTranslatorFromDescriptor from the Text component but the chinese characters still not working. I found an issue thread on gofpdf that said that gofpdf doesn't support these languages. jung-kurt/gofpdf#59 (comment)

Code

m.Col(6, func() {
	m.Text("中文 Packages Report: Daily", props.Text{
		Top:   1,
		Align: consts.Center,
	})
	m.Text("Type: Small, Medium", props.Text{
		Top:   7,
		Align: consts.Center,
	})
})

Result

Captura de Tela 2020-05-16 às 13 54 34

I don't know another way to add support to these characters.

jung-kurt/gofpdf can use special font to support chinese。

gofpdf supports UTF-8 TrueType fonts and “right-to-left” languages. Note that Chinese, Japanese, and Korean characters may not be included in many general purpose fonts. For these languages, a specialized font (for example, NotoSansSC for simplified Chinese) can be used.

I solve it. but I donot use github very well.I donot know how to use pr.
you can read me code https://github.com/Vale-sail/maroto to get idea.
if my fork has bad effect for you,please tell us. I will delete my repositories. thank you

@johnfercher
Copy link
Owner

I will open an PR to you

@hamdiBouhani
Copy link

@johnfercher is there any progress on this issue

@hamdiBouhani
Copy link

I need to handle Arabic characters in my app

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 a pull request may close this issue.

4 participants