jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images

Home Page:http://godoc.org/github.com/jung-kurt/gofpdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spaces in Chinese

achafer opened this issue · comments

commented

Hi, I found that when there are spaces in Chinese paragraphs, The final output style is not what I want

pdf := gofpdf.New("P", "mm", "A4", "")
pdf.AddUTF8Font("notosanssc", "", "../webfonts/NotoSansSC-Regular.ttf")
pdf.AddPage()
pdf.SetFont("notosanssc", "", 16)
str := "gofpdf支持UTF-8 TrueType字体和“right-to-left”语言。" +
	"请注意,许多通用字体中可能不包含中文、日文和 韩文字符。对于这些语言," +
	"可以使用专门的字体(例如,NotoSansSC 简体中文的字体)。"
pdf.MultiCell(0, 16, str, "", "L", false)
if err := pdf.OutputFileAndClose("hello.pdf"); err != nil {
	log.Fatal(err)
}

Output:

image

Thanks for the report, @achafer. Any insights, @DarkFreedman?

@achafer, can you confirm that this works as expected now?

This space is part of glyphs. I used another font and got normal result
anotherfont