From 50c8b313f9e84c0e6765897fdf5089c3dabc4b33 Mon Sep 17 00:00:00 2001 From: gravitypdf-bot Date: Tue, 6 Oct 2026 11:08:23 +1100 Subject: [PATCH 1/2] Draw a text circle with no font-size at the size of the text around it A that neither its tag nor the CSS gave a font-size was built without a fontsize key, so drawing it raised three undefined-key warnings. It now defaults to the current font size, as the other tags that draw text in printobjectbuffer do. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG-GRAVITYPDF.md | 2 + src/Tag/TextCircle.php | 1 + tests/Mpdf/TextCircleFontSizeTest.php | 66 +++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 tests/Mpdf/TextCircleFontSizeTest.php diff --git a/CHANGELOG-GRAVITYPDF.md b/CHANGELOG-GRAVITYPDF.md index bbfff2e9f..39cedc977 100644 --- a/CHANGELOG-GRAVITYPDF.md +++ b/CHANGELOG-GRAVITYPDF.md @@ -273,6 +273,7 @@ Bugfixes * Arabic in an SVG was not given an Arabic font. [#281] * An RGB image converted to CMYK truncated its inks, so full ink fell short of 255. [#349] [#354] * An image's `/SMask` pointed at whichever object came before it, which is only its mask if nothing was added in between. An image and its soft mask are now registered together. [#373] +* A `` with no `font-size` from its tag or the CSS raised three `Undefined array key "fontsize"` warnings. It is now drawn at the size of the text around it, as though that size were set on it. [#645] ### Forms @@ -935,3 +936,4 @@ These changes do not change output. [#543]: https://github.com/GravityPDF/mpdf/issues/543 [#656]: https://github.com/GravityPDF/mpdf/pull/656 [#654]: https://github.com/GravityPDF/mpdf/pull/654 +[#645]: https://github.com/GravityPDF/mpdf/issues/645 diff --git a/src/Tag/TextCircle.php b/src/Tag/TextCircle.php index 6e5652f57..bcef38d5a 100644 --- a/src/Tag/TextCircle.php +++ b/src/Tag/TextCircle.php @@ -74,6 +74,7 @@ public function open($attr, &$ahtml, &$ihtml) $objattr['visibility'] = $v; } } + $objattr['fontsize'] = $this->mpdf->FontSizePt; if (isset($properties['FONT-SIZE'])) { if (strtolower($properties['FONT-SIZE']) === 'auto') { if ($objattr['top-text'] && $objattr['bottom-text']) { diff --git a/tests/Mpdf/TextCircleFontSizeTest.php b/tests/Mpdf/TextCircleFontSizeTest.php new file mode 100644 index 000000000..4d0770a7c --- /dev/null +++ b/tests/Mpdf/TextCircleFontSizeTest.php @@ -0,0 +1,66 @@ +drawnPages($mode, $html, ''); + $this->assertStringContainsString(' ' . $size . ' Tf', $pages[0]); + $this->assertSame($this->drawnPages($mode, $html, ' style="font-size: ' . $size . 'pt"'), $pages); + } + + /** + * Draw the document, asserting it raises nothing, and hand back its page content streams + * + * @param string $mode A CssMode constant + * @param string $html The document, with {style} where the text circle's style attribute goes + * @param string $style What goes in place of {style} + * + * @return string[] + */ + private function drawnPages($mode, $html, $style) + { + $pdf = $this->assertDrawsSilently(function (Mpdf $mpdf) use ($html, $style) { + $mpdf->WriteHTML(str_replace('{style}', $style, $html)); + }, ['cssMode' => $mode]); + + return $this->pages($pdf); + } + + /** + * @return array[] Each CSS mode with a text circle at the top of the document, in a paragraph and in a table cell + */ + public function providerContexts() + { + $contexts = [ + 'document' => ['', '11.000'], + 'paragraph' => ['

', '14.000'], + 'table cell' => ['
', '9.000'], + ]; + + $cases = []; + foreach ([CssMode::STANDARD, CssMode::LEGACY] as $mode) { + foreach ($contexts as $name => $context) { + $cases[$mode . ', ' . $name] = array_merge([$mode], $context); + } + } + + return $cases; + } +} From ee6ba6a40be4c25292f324d489709d0a3ec25fe1 Mon Sep 17 00:00:00 2001 From: gravitypdf-bot Date: Tue, 6 Oct 2026 11:08:45 +1100 Subject: [PATCH 2/2] Link the text circle font-size changelog entry to its pull request Co-Authored-By: Claude Opus 5.5 --- CHANGELOG-GRAVITYPDF.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-GRAVITYPDF.md b/CHANGELOG-GRAVITYPDF.md index 39cedc977..d4b40a2a9 100644 --- a/CHANGELOG-GRAVITYPDF.md +++ b/CHANGELOG-GRAVITYPDF.md @@ -273,7 +273,7 @@ Bugfixes * Arabic in an SVG was not given an Arabic font. [#281] * An RGB image converted to CMYK truncated its inks, so full ink fell short of 255. [#349] [#354] * An image's `/SMask` pointed at whichever object came before it, which is only its mask if nothing was added in between. An image and its soft mask are now registered together. [#373] -* A `` with no `font-size` from its tag or the CSS raised three `Undefined array key "fontsize"` warnings. It is now drawn at the size of the text around it, as though that size were set on it. [#645] +* A `` with no `font-size` from its tag or the CSS raised three `Undefined array key "fontsize"` warnings. It is now drawn at the size of the text around it, as though that size were set on it. [#645] [#678] ### Forms @@ -937,3 +937,4 @@ These changes do not change output. [#656]: https://github.com/GravityPDF/mpdf/pull/656 [#654]: https://github.com/GravityPDF/mpdf/pull/654 [#645]: https://github.com/GravityPDF/mpdf/issues/645 +[#678]: https://github.com/GravityPDF/mpdf/pull/678