Skip to content

Document.fonts misses fonts nested in Type 3 and Pattern resources #234

Description

@lin-string

Summary

Document.fonts only discovers fonts directly listed in each page's Font resources. Fonts reachable through nested resource dictionaries are omitted, including fonts inside Type 3 fonts and Pattern resources.

Versions tested

Test files

Reproduction

import playa

for path in (
    "FontinsideType3insideType3.pdf",
    "PatternTextInsideText.pdf",
):
    with playa.open(path) as document:
        print(path, list(document.fonts))

Actual behavior

The nested Type 3 fixture reports only ['FType3A']; it omits FType3B and Helvetica. The Pattern fixture reports only ['Helvetica']; it omits Times-Italic.

Expected behavior

Document-wide font discovery should recursively traverse reachable resource dictionaries. The nested Type 3 fixture should report FType3A, FType3B, and Helvetica, while the Pattern fixture should report Helvetica and Times-Italic.

Relevant implementation

document.FontMapping._iteritems() builds its mapping exclusively from page.fonts.values(). It does not traverse resource dictionaries reachable through Type 3 fonts, Patterns, or other nested resources.

Disclosure

This issue was prepared by an AI coding agent on behalf of @lin-string. The reproduction and results were verified against the current default branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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