gofpdf icon indicating copy to clipboard operation
gofpdf copied to clipboard

Add Chinese support

Open dongweigogo opened this issue 7 years ago • 3 comments

I've seen some suggestions for adding Chinese support, but all have been closed. So, I raise it once again because that will benefit a lot of people! And I found that another package (https://github.com/signintech/gopdf) has supported some utf-8 languages. Does that help in fixing this issue here?

dongweigogo avatar Jun 26 '17 12:06 dongweigogo

Does that help in fixing this issue here?

It may. But since font management touches so much of gofpdf, it may be more beneficial to consider a new branch that carries over features from gofpdf and lays them on top of gopdf.

jung-kurt avatar Jun 27 '17 11:06 jung-kurt

	pdf := gofpdf.New("P", "mm", "A4", "")
	pdf.AddUTF8Font("NotoSansSC-Regular", "", "NotoSansSC-Regular.ttf")
	pdf.SetFont("NotoSansSC-Regular", "", 16)
	pdf.Cell(49, 10, "中文,你好!")

You can download the NotoSansSC-Regular.ttf file from https://github.com/jsntn/webfonts/, put it under your current directory.

nanjj avatar Jun 10 '19 07:06 nanjj

Just ran into this problem, thanks the hints from @nanjj.

I would like to provide another open source family "Source Han Sans" font for Japanese, Korean, Simplified Chinese, and Traditional Chinese.

Note for Traditional Chinese and Japanese developers, there is a TTF converted version base on Source Han Sans. Download .ttf from here https://github.com/ButTaiwan/gensen-font

chy168 avatar Jun 11 '19 08:06 chy168