Skip to content

Charset weirdness despite using core PDF fonts #19

@dmoles

Description

@dmoles

Steps to reproduce:

  1. create a new *gofpdf.FPDF:

    pdf := gofpdf.New("P", "pt", "Letter", "")
  2. set the font to Courier 12:

    pdf.SetFont("courier", "", 12)
  3. write a bullet character, (U+2022):

    pdf.Write("•", 12)
  4. write the PDF to a file:

    f, err := os.Create("/tmp/output.pdf")
    if err != nil {
    	t.Fatal(err)
    }
    defer f.Close()
    
    pdf.Output(f)

Expected:

  • Bullet is written to rendered PDF

Actual:

  • Rendered PDF shows •

Discussion:

I admit, I haven't dug deep enough to quite get the state of GoFPF UTF-8 support. My first thought was that I needed to add UTF-8 font, but according to the AddUTF8Font docs,

It is not necessary to call this function for the core PDF fonts
(courier, helvetica, times, zapfdingbats).

Regardless, is that the workaround? Or is there a workaround? Are we currently limited to certain code pages?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions