smalot / smalot/pdfparser

DescendantFonts will never be used in Font::decodeContent()

Open
#503 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug de-/encoding issue
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
1

Description

https://github.com/smalot/pdfparser/blob/e056671d50b31d6320a26aa8fbfafd2c02e6bff1/src/Smalot/PdfParser/Font.php#L393-L395

Because Font::translateChar() will never return false:

https://github.com/smalot/pdfparser/blob/e056671d50b31d6320a26aa8fbfafd2c02e6bff1/src/Smalot/PdfParser/Font.php#L92-L118

Seems that translateChar() must not return self::MISSING and possible $fallbackDecoded if char not fount in $this->table map.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Smalot/PdfParser/Font.php at decodeContent() around lines 393-395, then trace translateChar() around lines 92-118 and its handling of missing characters. Check the existing test suite for font decoding behavior. Done means the DescendantFonts path is reachable when the character is absent from the table, with tests confirming the resulting decoding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.