Skip to content

Can't view the corresponding text from font file #2516

@CodePythonFollow

Description

@CodePythonFollow

I extracted the fonts using the method below

fonts = page.get_fonts(full=True)

for font in fonts:
    res = file.extract_font(font[0])

I use the following method to obtain text information

blocks = page.get_text("dict", flags=11)["blocks"]
for b in blocks:  # iterate through the text blocks
    for l in b["lines"]:  # iterate through the text lines
        for s in l["spans"]:  # iterate through the text spans
            print("")
            font_properties = "Font: '%s' (%s), size %g, color #%06x" % (
                s["font"],  # font name
                flags_decomposer(s["flags"]),  # readable font flags
                s["size"],  # font size
                s["color"],  # font color
            )
            print("Text: '%s'" %  s["text"])  # simple print of text
            print(f"box: {s['bbox']}")  # simple print of text
            print(font_properties)

out:
image

I can't see the corresponding text in the extracted font. font type: cid
image

The text "重要提示" not in font file.

I wonder if something went wrong with me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions