update lock clucknut
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s
Build, Push and Deploy / build-and-push (push) Successful in 3m14s
Build, Push and Deploy / deploy-staging (push) Successful in 25s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-18 20:32:18 +07:00
parent 4554035227
commit dcaf267458
3359 changed files with 153185 additions and 205489 deletions

View File

@@ -1 +1 @@
3.1.4
3.1.5

View File

@@ -1185,10 +1185,10 @@ private function processFont(int $fontObjId, array $object_info)
}
// also need to adjust the widths for the differences array
if (isset($object['differences'])) {
foreach ($object['differences'] as $charNum => $charName) {
if (isset($object_info['differences'])) {
foreach ($object_info['differences'] as $charNum => $charName) {
if ($charNum > $lastChar) {
if (!$object['isUnicode']) {
if (!$object_info['isUnicode']) {
// With Unicode, widths array isn't used
for ($i = $lastChar + 1; $i <= $charNum; $i++) {
$widths[] = 0;
@@ -3758,7 +3758,7 @@ private function openFont($font)
$c = (int)$dtmp['U'];
$n = $dtmp['N'];
$glyph = $dtmp['G'];
$glyph = (int)$dtmp['G'];
$width = floatval($dtmp['WX']);
if ($c >= 0) {
@@ -3810,7 +3810,7 @@ private function openFont($font)
}
if (!isset($this->fonts[$font])) {
$this->addMessage("openFont: no font file found for $font. Do you need to run load_font.php?");
$this->addMessage("openFont: no font file found for $font.");
}
}
@@ -4831,6 +4831,25 @@ public function clippingPolygon(array $p): void
$this->addContent("W n");
}
/**
* saves the graphics state prior to manually drawing shapes to be used for clipping
*
* after drawing a shape use the clip() function to use the shape for clipping,
* and then use clippingEnd() to end the clipping region and restore the graphics state
*/
function clippingStart()
{
$this->save();
}
/**
* uses the previously drawn path for clipping, all the elements added after this will be clipped
*/
function clip()
{
$this->addContent("\nW n");
}
/**
* ends the last clipping shape
*/
@@ -6294,6 +6313,9 @@ function addPngFromFile($file, $x, $y, $w = 0, $h = 0)
function addSvgFromFile($file, $x, $y, $w = 0, $h = 0)
{
$doc = new \Svg\Document();
if (property_exists($doc, 'allowExternalReferences')) {
$doc->allowExternalReferences = true;
}
$doc->loadFile($file);
$dimensions = $doc->getDimensions();
@@ -6375,7 +6397,6 @@ function addPngFromBuf(&$data, $file, $x, $y, $w = 0.0, $h = 0.0, $is_mask = fal
$info['filterMethod'] = ord($data[$p + 19]);
$info['interlaceMethod'] = ord($data[$p + 20]);
//print_r($info);
$haveHeader = 1;
if ($info['compressionMethod'] != 0) {
$error = 1;
@@ -6549,14 +6570,12 @@ function addPngFromBuf(&$data, $file, $x, $y, $w = 0.0, $h = 0.0, $is_mask = fal
return;
}
//print_r($info);
// so this image is ok... add it in.
$this->numImages++;
$im = $this->numImages;
$label = "I$im";
$this->numObj++;
// $this->o_image($this->numObj,'new',array('label' => $label,'data' => $idata,'iw' => $w,'ih' => $h,'type' => 'png','ic' => $info['width']));
$options = [
'label' => $label,
'data' => $idata,

View File

@@ -1311,6 +1311,7 @@ private function _parse_css($str, $media_queries = [])
switch ($prev) {
case "'":
$pattern = "/(?<!\\\\)'/";
break;
case "\"":
$pattern = "/(?<!\\\\)\"/";
break;
@@ -1493,7 +1494,7 @@ public function resolve_url($val, $resolve_blobs = false): string
break;
}
if ($resolve_blobs === true && strpos($url, "blob://") !== false) {
$url = $this->_blobs[substr($url, 7)];
$url = $this->_blobs[substr($url, 7)] ?? "";
}
$path = Helpers::build_url(
$this->_protocol,

View File

@@ -772,6 +772,8 @@ public function render()
$canvas = $this->canvas;
LineBox::reset_float_reflow_limit(); // FIXME smelly hack
$root_frame = $this->tree->get_root();
$root = Factory::decorate_root($root_frame, $this);
foreach ($this->tree as $frame) {
@@ -1402,7 +1404,7 @@ public function setOptions(Options $options)
if (isset($this->canvas)) {
$this->canvas = CanvasFactory::get_instance($this, $this->paperSize, $this->paperOrientation);
if (isset($fontMetrics)) {
$this->fontMetrics = new FontMetrics($this->canvas, $this->options);
$this->fontMetrics->setCanvas($this->canvas)->setOptions($options);
}
}

View File

@@ -22,13 +22,10 @@
class FontMetrics
{
/**
* Name of the user font families file
* Name of the user font families lookup cache file
*
* This file must be writable by the webserver process only to update it
* with save_font_families() after adding the .afm file references of a new font family
* with FontMetrics::saveFontFamilies().
* This is typically done only from command line with load_font.php on converting
* ttf fonts to ufm with php-font-lib.
* This file must be readable and writable by the executing (webserver)
* process in order to cache user installed font information.
*/
const USER_FONTS_FILE = "installed-fonts.json";

View File

@@ -677,9 +677,12 @@ public function set_decorator(FrameDecorator\AbstractFrameDecorator $decorator)
public function set_containing_block($x = null, $y = null, $w = null, $h = null)
{
if (is_array($x)) {
foreach ($x as $key => $val) {
$$key = $val;
}
list($x, $y, $w, $h) = [
$x["x"] ?? null,
$x["y"] ?? null,
$x["w"] ?? null,
$x["h"] ?? null
];
}
if (is_numeric($x)) {

View File

@@ -837,6 +837,9 @@ public static function dompdf_getimagesize($filename, $context = null)
$type = "bmp";
} elseif (strpos($data, "<svg") !== false) {
$doc = new \Svg\Document();
if (property_exists($doc, 'allowExternalReferences')) {
$doc->allowExternalReferences = true;
}
$doc->loadFile($filename);
[$width, $height] = $doc->getDimensions();

View File

@@ -91,6 +91,18 @@ class LineBox
*/
public $inline = false;
/**
* @var int
*/
public static $max_float_reflows = 10000;
/**
* FIXME smelly hack, used by the get_float_offsets method.
*
* @var int
*/
private static $float_offset_anti_infinite_loop = 10000;
/**
* @param Block $frame the Block containing this line
* @param float $y
@@ -152,10 +164,16 @@ public function get_floats_inside(Page $root): array
return $childs;
}
/**
* Resets the anti-infinite-loop counter for the get_float_offsets method.
*/
public static function reset_float_reflow_limit(): void
{
self::$float_offset_anti_infinite_loop = self::$max_float_reflows;
}
public function get_float_offsets(): void
{
static $anti_infinite_loop = 10000; // FIXME smelly hack
$reflower = $this->_block_frame->get_reflower();
if (!$reflower) {
@@ -201,7 +219,7 @@ public function get_float_offsets(): void
}
// If the child is still shifted by the floating element
if ($anti_infinite_loop-- > 0 &&
if (self::$float_offset_anti_infinite_loop-- > 0 &&
$floating_frame->get_position("y") + $floating_frame->get_margin_height() >= $this->y &&
$block->get_position("x") + $block->get_margin_width() >= $floating_frame->get_position("x")
) {

View File

@@ -356,7 +356,7 @@ public function __construct(?array $attributes = null)
$ver = "";
$versionFile = realpath(__DIR__ . '/../VERSION');
if (($version = file_get_contents($versionFile)) !== false) {
if (file_exists($versionFile) && ($version = file_get_contents($versionFile)) !== false) {
$version = trim($version);
if ($version !== '$Format:<%h>$') {
$ver = "/$version";

View File

@@ -1,17 +0,0 @@
FontLib was designed and developed by Fabien Ménager.
### Current Team
* **Brian Sweeney** (maintainer)
### Alumni
* **Fabien Ménager** (creator)
### Contributors
* **mondrake**
* [and many more...](https://github.com/dompdf/php-font-lib/graphs/contributors)
### Thanks
FontLib would not have been possible without strong community support.

View File

@@ -20,14 +20,14 @@
"FontLib\\Tests\\": "tests/FontLib"
}
},
"config": {
"bin-dir": "bin"
},
"require": {
"php": "^7.1 || ^8.0",
"ext-mbstring": "*"
},
"require-dev": {
"symfony/phpunit-bridge" : "^3 || ^4 || ^5 || ^6"
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11 || ^12"
},
"scripts": {
"test": "phpunit"
}
}

View File

@@ -120,7 +120,7 @@ public static function getTempFile($allow_memory = true) {
* @return bool True if the $offset position exists in the file
*/
public function seek($offset) {
return fseek($this->f, $offset, SEEK_SET) == 0;
return fseek($this->f, (int)$offset, SEEK_SET) == 0;
}
/**
@@ -158,7 +158,11 @@ public function write($data, $length = null) {
}
public function readUInt8() {
return ord($this->read(1));
$byte = $this->read(1);
if ($byte === '') {
return 0;
}
return ord($byte);
}
public function readUInt8Many($count) {

View File

@@ -69,28 +69,34 @@ function getFont($fontId) {
return $this->collection[$fontId] = $font;
}
#[\ReturnTypeWillChange]
function current() {
return $this->getFont($this->position);
}
#[\ReturnTypeWillChange]
function key() {
return $this->position;
}
#[\ReturnTypeWillChange]
function next() {
return ++$this->position;
}
#[\ReturnTypeWillChange]
function rewind() {
$this->position = 0;
}
#[\ReturnTypeWillChange]
function valid() {
$this->parse();
return isset($this->collectionOffsets[$this->position]);
}
#[\ReturnTypeWillChange]
function count() {
$this->parse();