Skip to content

CBDT/CBLC font support for color emojis #224

Open
@markusnordstrom

Description

@markusnordstrom

Continued from #145

This code:

from fpdf import FPDF
pdf = FPDF()
pdf.add_font("NotoColorEmoji", fname="NotoColorEmoji.ttf", uni=True)
pdf.set_font("NotoColorEmoji")
pdf.add_page()
pdf.text(50, 50, "🐟🎧🌟")
pdf.output("emoji.pdf")

...generates an error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/fpdf/ttfonts.py", line 909, in getLOCA
    start = self.seek_table("loca")
  File "/usr/local/lib/python3.7/site-packages/fpdf/ttfonts.py", line 128, in seek_table
    tpos = self.get_table_pos(tag)
  File "/usr/local/lib/python3.7/site-packages/fpdf/ttfonts.py", line 115, in get_table_pos
    offset = self.tables[tag]["offset"]
KeyError: 'loca'

Solving this can count as part of hacktoberfest

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions