-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fail to identify fonts (name and size) #629 #630
Conversation
… list, as font's IDs are different
CC @GreyWyvern Just a hint, because this is related to fonts, which was the topic of one of recent your pull requests. |
My own PR that I'm working on removes these same lines from Page.php as unnecessary as well. If font can be set outside |
@mbideau-atreal I need a simple unit-test to prove the change is working and to avoid a regression in the future. Can you do that? If not, I can suggest one. |
@mbideau-atreal May we use your sample PDF 20230803-160138-lettretype-arrete.pdf in the PdfParser test suite? Then we could add to the bottom of PageTest::testGetDataTm(): // Check that BT and ET do not reset the font
$config = new Config();
$config->setDataTmFontInfoHasToBeIncluded(true);
$filename = $this->rootDir.'/samples/bugs/Issue629.pdf';
$parser = $this->getParserInstance($config);
$document = $parser->parseFile($filename);
$pages = $document->getPages();
$page = end($pages);
$dataTm = $page->getDataTm();
$this->assertCount(4, $dataTm[0]);
$this->assertEquals('F2', $dataTm[0][2]); The first test should always be true if I would also recommend removing the same lines from further down under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @GreyWyvern. I took your suggestion and added two tests. PR is ready to merge. @mbideau-atreal is there anything left to do?
Sorry for my delay. |
Nothing left to do here, on my part 😉 After the merge, if you can, I would really need some feedback on the issue #570 regarding the same PDF sample document 🙏 Thanks again. |
In order to solve #629 I identified that BT commands were resetting the font name and size previously defined by a Tf command... all the time.
So I just removed the font (over)initialization from the BT code, and all the font names and size were showing up.
The (first) initialization of
$fontId
and$fontSize
is already done before the loop starts, BTW.PS: I don't know anything about PDF standard, so please take my fix with caution.
Thanks for this great piece of code.
Best regards.