Update besar apk finance

This commit is contained in:
Wian Drs
2026-09-11 16:03:00 +07:00
parent d42483b350
commit 4ef15c22ae
897 changed files with 98056 additions and 15979 deletions
+6 -22
View File
@@ -17,19 +17,7 @@ HTML attributes.
*This document applies to the latest stable code which may not reflect the current
release. For released code please
[navigate to the appropriate tag](https://github.com/dompdf/dompdf/tags).*
----
**Check out the [demo](http://eclecticgeek.com/dompdf/debug.php) and ask any
question on [StackOverflow](https://stackoverflow.com/questions/tagged/dompdf) or
in [Discussions](https://github.com/dompdf/dompdf/discussions).**
Follow us on [![Twitter](http://twitter-badges.s3.amazonaws.com/twitter-a.png)](http://www.twitter.com/dompdf).
---
[navigate to the appropriate tag](https://github.com/dompdf/dompdf/releases).*
## Features
@@ -52,15 +40,10 @@ Follow us on [![Twitter](http://twitter-badges.s3.amazonaws.com/twitter-a.png)](
* MBString extension
* php-font-lib
* php-svg-lib
Note that some required dependencies may have further dependencies
(notably php-svg-lib requires sabberworm/php-css-parser).
### Recommendations
* GD (for image processing)
* Additionally, the IMagick or GMagick extension improves image processing performance for certain image types
* OPcache (OPcache, XCache, APC, etc.): improves performance
Note that some required dependencies may have further dependencies.
Visit the wiki for more information:
https://github.com/dompdf/dompdf/wiki/Requirements
@@ -121,8 +104,9 @@ require_once 'dompdf/autoload.inc.php';
Note: packaged releases are named according using semantic
versioning (_dompdf_MAJOR-MINOR-PATCH.zip_). So the 1.0.0
release would be dompdf_1-0-0.zip. This is the only download
that includes the autoloader for Dompdf and all its dependencies.
release would be dompdf_1-0-0.zip. Packaged releases include
the dependency releases available at the time of release
and are not necessarily updated to include updated dependencies.
### Install with git
+1 -1
View File
@@ -1 +1 @@
3.1.4
3.1.6
+27 -8
View File
@@ -1185,10 +1185,10 @@ class Cpdf
}
// 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 @@ EOT;
$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 @@ EOT;
}
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 @@ EOT;
$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 @@ EOT;
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 @@ EOT;
$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 @@ EOT;
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,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-569
View File
@@ -1,569 +0,0 @@
{
"codeToName": {
"32": "space",
"160": "space",
"33": "exclam",
"34": "quotedbl",
"35": "numbersign",
"36": "dollar",
"37": "percent",
"38": "ampersand",
"146": "quoteright",
"40": "parenleft",
"41": "parenright",
"42": "asterisk",
"43": "plus",
"44": "comma",
"45": "hyphen",
"173": "hyphen",
"46": "period",
"47": "slash",
"48": "zero",
"49": "one",
"50": "two",
"51": "three",
"52": "four",
"53": "five",
"54": "six",
"55": "seven",
"56": "eight",
"57": "nine",
"58": "colon",
"59": "semicolon",
"60": "less",
"61": "equal",
"62": "greater",
"63": "question",
"64": "at",
"65": "A",
"66": "B",
"67": "C",
"68": "D",
"69": "E",
"70": "F",
"71": "G",
"72": "H",
"73": "I",
"74": "J",
"75": "K",
"76": "L",
"77": "M",
"78": "N",
"79": "O",
"80": "P",
"81": "Q",
"82": "R",
"83": "S",
"84": "T",
"85": "U",
"86": "V",
"87": "W",
"88": "X",
"89": "Y",
"90": "Z",
"91": "bracketleft",
"92": "backslash",
"93": "bracketright",
"94": "asciicircum",
"95": "underscore",
"145": "quoteleft",
"97": "a",
"98": "b",
"99": "c",
"100": "d",
"101": "e",
"102": "f",
"103": "g",
"104": "h",
"105": "i",
"106": "j",
"107": "k",
"108": "l",
"109": "m",
"110": "n",
"111": "o",
"112": "p",
"113": "q",
"114": "r",
"115": "s",
"116": "t",
"117": "u",
"118": "v",
"119": "w",
"120": "x",
"121": "y",
"122": "z",
"123": "braceleft",
"124": "bar",
"125": "braceright",
"126": "asciitilde",
"161": "exclamdown",
"162": "cent",
"163": "sterling",
"165": "yen",
"131": "florin",
"167": "section",
"164": "currency",
"39": "quotesingle",
"147": "quotedblleft",
"171": "guillemotleft",
"139": "guilsinglleft",
"155": "guilsinglright",
"150": "endash",
"134": "dagger",
"135": "daggerdbl",
"183": "periodcentered",
"182": "paragraph",
"149": "bullet",
"130": "quotesinglbase",
"132": "quotedblbase",
"148": "quotedblright",
"187": "guillemotright",
"133": "ellipsis",
"137": "perthousand",
"191": "questiondown",
"96": "grave",
"180": "acute",
"136": "circumflex",
"152": "tilde",
"175": "macron",
"168": "dieresis",
"184": "cedilla",
"151": "emdash",
"198": "AE",
"170": "ordfeminine",
"216": "Oslash",
"140": "OE",
"186": "ordmasculine",
"230": "ae",
"248": "oslash",
"156": "oe",
"223": "germandbls",
"207": "Idieresis",
"233": "eacute",
"159": "Ydieresis",
"247": "divide",
"221": "Yacute",
"194": "Acircumflex",
"225": "aacute",
"219": "Ucircumflex",
"253": "yacute",
"234": "ecircumflex",
"220": "Udieresis",
"218": "Uacute",
"203": "Edieresis",
"169": "copyright",
"229": "aring",
"224": "agrave",
"227": "atilde",
"154": "scaron",
"237": "iacute",
"251": "ucircumflex",
"226": "acircumflex",
"231": "ccedilla",
"222": "Thorn",
"179": "threesuperior",
"210": "Ograve",
"192": "Agrave",
"215": "multiply",
"250": "uacute",
"255": "ydieresis",
"238": "icircumflex",
"202": "Ecircumflex",
"228": "adieresis",
"235": "edieresis",
"205": "Iacute",
"177": "plusminus",
"166": "brokenbar",
"174": "registered",
"200": "Egrave",
"142": "Zcaron",
"208": "Eth",
"199": "Ccedilla",
"193": "Aacute",
"196": "Adieresis",
"232": "egrave",
"211": "Oacute",
"243": "oacute",
"239": "idieresis",
"212": "Ocircumflex",
"217": "Ugrave",
"254": "thorn",
"178": "twosuperior",
"214": "Odieresis",
"181": "mu",
"236": "igrave",
"190": "threequarters",
"153": "trademark",
"204": "Igrave",
"189": "onehalf",
"244": "ocircumflex",
"241": "ntilde",
"201": "Eacute",
"188": "onequarter",
"138": "Scaron",
"176": "degree",
"242": "ograve",
"249": "ugrave",
"209": "Ntilde",
"245": "otilde",
"195": "Atilde",
"197": "Aring",
"213": "Otilde",
"206": "Icircumflex",
"172": "logicalnot",
"246": "odieresis",
"252": "udieresis",
"240": "eth",
"158": "zcaron",
"185": "onesuperior",
"128": "Euro"
},
"isUnicode": false,
"FontName": "Times-Bold",
"FullName": "Times Bold",
"FamilyName": "Times",
"Weight": "Bold",
"ItalicAngle": "0",
"IsFixedPitch": "false",
"CharacterSet": "ExtendedRoman",
"FontBBox": [
"-168",
"-218",
"1000",
"935"
],
"UnderlinePosition": "-100",
"UnderlineThickness": "50",
"Version": "002.000",
"EncodingScheme": "WinAnsiEncoding",
"CapHeight": "676",
"XHeight": "461",
"Ascender": "683",
"Descender": "-217",
"StdHW": "44",
"StdVW": "139",
"StartCharMetrics": "317",
"C": {
"32": 250,
"160": 250,
"33": 333,
"34": 555,
"35": 500,
"36": 500,
"37": 1000,
"38": 833,
"146": 333,
"40": 333,
"41": 333,
"42": 500,
"43": 570,
"44": 250,
"45": 333,
"173": 333,
"46": 250,
"47": 278,
"48": 500,
"49": 500,
"50": 500,
"51": 500,
"52": 500,
"53": 500,
"54": 500,
"55": 500,
"56": 500,
"57": 500,
"58": 333,
"59": 333,
"60": 570,
"61": 570,
"62": 570,
"63": 500,
"64": 930,
"65": 722,
"66": 667,
"67": 722,
"68": 722,
"69": 667,
"70": 611,
"71": 778,
"72": 778,
"73": 389,
"74": 500,
"75": 778,
"76": 667,
"77": 944,
"78": 722,
"79": 778,
"80": 611,
"81": 778,
"82": 722,
"83": 556,
"84": 667,
"85": 722,
"86": 722,
"87": 1000,
"88": 722,
"89": 722,
"90": 667,
"91": 333,
"92": 278,
"93": 333,
"94": 581,
"95": 500,
"145": 333,
"97": 500,
"98": 556,
"99": 444,
"100": 556,
"101": 444,
"102": 333,
"103": 500,
"104": 556,
"105": 278,
"106": 333,
"107": 556,
"108": 278,
"109": 833,
"110": 556,
"111": 500,
"112": 556,
"113": 556,
"114": 444,
"115": 389,
"116": 333,
"117": 556,
"118": 500,
"119": 722,
"120": 500,
"121": 500,
"122": 444,
"123": 394,
"124": 220,
"125": 394,
"126": 520,
"161": 333,
"162": 500,
"163": 500,
"fraction": 167,
"165": 500,
"131": 500,
"167": 500,
"164": 500,
"39": 278,
"147": 500,
"171": 500,
"139": 333,
"155": 333,
"fi": 556,
"fl": 556,
"150": 500,
"134": 500,
"135": 500,
"183": 250,
"182": 540,
"149": 350,
"130": 333,
"132": 500,
"148": 500,
"187": 500,
"133": 1000,
"137": 1000,
"191": 500,
"96": 333,
"180": 333,
"136": 333,
"152": 333,
"175": 333,
"breve": 333,
"dotaccent": 333,
"168": 333,
"ring": 333,
"184": 333,
"hungarumlaut": 333,
"ogonek": 333,
"caron": 333,
"151": 1000,
"198": 1000,
"170": 300,
"Lslash": 667,
"216": 778,
"140": 1000,
"186": 330,
"230": 722,
"dotlessi": 278,
"lslash": 278,
"248": 500,
"156": 722,
"223": 556,
"207": 389,
"233": 444,
"abreve": 500,
"uhungarumlaut": 556,
"ecaron": 444,
"159": 722,
"247": 570,
"221": 722,
"194": 722,
"225": 500,
"219": 722,
"253": 500,
"scommaaccent": 389,
"234": 444,
"Uring": 722,
"220": 722,
"aogonek": 500,
"218": 722,
"uogonek": 556,
"203": 667,
"Dcroat": 722,
"commaaccent": 250,
"169": 747,
"Emacron": 667,
"ccaron": 444,
"229": 500,
"Ncommaaccent": 722,
"lacute": 278,
"224": 500,
"Tcommaaccent": 667,
"Cacute": 722,
"227": 500,
"Edotaccent": 667,
"154": 389,
"scedilla": 389,
"237": 278,
"lozenge": 494,
"Rcaron": 722,
"Gcommaaccent": 778,
"251": 556,
"226": 500,
"Amacron": 722,
"rcaron": 444,
"231": 444,
"Zdotaccent": 667,
"222": 611,
"Omacron": 778,
"Racute": 722,
"Sacute": 556,
"dcaron": 672,
"Umacron": 722,
"uring": 556,
"179": 300,
"210": 778,
"192": 722,
"Abreve": 722,
"215": 570,
"250": 556,
"Tcaron": 667,
"partialdiff": 494,
"255": 500,
"Nacute": 722,
"238": 278,
"202": 667,
"228": 500,
"235": 444,
"cacute": 444,
"nacute": 556,
"umacron": 556,
"Ncaron": 722,
"205": 389,
"177": 570,
"166": 220,
"174": 747,
"Gbreve": 778,
"Idotaccent": 389,
"summation": 600,
"200": 667,
"racute": 444,
"omacron": 500,
"Zacute": 667,
"142": 667,
"greaterequal": 549,
"208": 722,
"199": 722,
"lcommaaccent": 278,
"tcaron": 416,
"eogonek": 444,
"Uogonek": 722,
"193": 722,
"196": 722,
"232": 444,
"zacute": 444,
"iogonek": 278,
"211": 778,
"243": 500,
"amacron": 500,
"sacute": 389,
"239": 278,
"212": 778,
"217": 722,
"Delta": 612,
"254": 556,
"178": 300,
"214": 778,
"181": 556,
"236": 278,
"ohungarumlaut": 500,
"Eogonek": 667,
"dcroat": 556,
"190": 750,
"Scedilla": 556,
"lcaron": 394,
"Kcommaaccent": 778,
"Lacute": 667,
"153": 1000,
"edotaccent": 444,
"204": 389,
"Imacron": 389,
"Lcaron": 667,
"189": 750,
"lessequal": 549,
"244": 500,
"241": 556,
"Uhungarumlaut": 722,
"201": 667,
"emacron": 444,
"gbreve": 500,
"188": 750,
"138": 556,
"Scommaaccent": 556,
"Ohungarumlaut": 778,
"176": 400,
"242": 500,
"Ccaron": 722,
"249": 556,
"radical": 549,
"Dcaron": 722,
"rcommaaccent": 444,
"209": 722,
"245": 500,
"Rcommaaccent": 722,
"Lcommaaccent": 667,
"195": 722,
"Aogonek": 722,
"197": 722,
"213": 778,
"zdotaccent": 444,
"Ecaron": 667,
"Iogonek": 389,
"kcommaaccent": 556,
"minus": 570,
"206": 389,
"ncaron": 556,
"tcommaaccent": 333,
"172": 570,
"246": 500,
"252": 556,
"notequal": 549,
"gcommaaccent": 500,
"240": 500,
"158": 444,
"ncommaaccent": 556,
"185": 300,
"imacron": 278,
"128": 500
},
"CIDtoGID_Compressed": true,
"CIDtoGID": "eJwDAAAAAAE=",
"_version_": 6
}
-569
View File
@@ -1,569 +0,0 @@
{
"codeToName": {
"32": "space",
"160": "space",
"33": "exclam",
"34": "quotedbl",
"35": "numbersign",
"36": "dollar",
"37": "percent",
"38": "ampersand",
"146": "quoteright",
"40": "parenleft",
"41": "parenright",
"42": "asterisk",
"43": "plus",
"44": "comma",
"45": "hyphen",
"173": "hyphen",
"46": "period",
"47": "slash",
"48": "zero",
"49": "one",
"50": "two",
"51": "three",
"52": "four",
"53": "five",
"54": "six",
"55": "seven",
"56": "eight",
"57": "nine",
"58": "colon",
"59": "semicolon",
"60": "less",
"61": "equal",
"62": "greater",
"63": "question",
"64": "at",
"65": "A",
"66": "B",
"67": "C",
"68": "D",
"69": "E",
"70": "F",
"71": "G",
"72": "H",
"73": "I",
"74": "J",
"75": "K",
"76": "L",
"77": "M",
"78": "N",
"79": "O",
"80": "P",
"81": "Q",
"82": "R",
"83": "S",
"84": "T",
"85": "U",
"86": "V",
"87": "W",
"88": "X",
"89": "Y",
"90": "Z",
"91": "bracketleft",
"92": "backslash",
"93": "bracketright",
"94": "asciicircum",
"95": "underscore",
"145": "quoteleft",
"97": "a",
"98": "b",
"99": "c",
"100": "d",
"101": "e",
"102": "f",
"103": "g",
"104": "h",
"105": "i",
"106": "j",
"107": "k",
"108": "l",
"109": "m",
"110": "n",
"111": "o",
"112": "p",
"113": "q",
"114": "r",
"115": "s",
"116": "t",
"117": "u",
"118": "v",
"119": "w",
"120": "x",
"121": "y",
"122": "z",
"123": "braceleft",
"124": "bar",
"125": "braceright",
"126": "asciitilde",
"161": "exclamdown",
"162": "cent",
"163": "sterling",
"165": "yen",
"131": "florin",
"167": "section",
"164": "currency",
"39": "quotesingle",
"147": "quotedblleft",
"171": "guillemotleft",
"139": "guilsinglleft",
"155": "guilsinglright",
"150": "endash",
"134": "dagger",
"135": "daggerdbl",
"183": "periodcentered",
"182": "paragraph",
"149": "bullet",
"130": "quotesinglbase",
"132": "quotedblbase",
"148": "quotedblright",
"187": "guillemotright",
"133": "ellipsis",
"137": "perthousand",
"191": "questiondown",
"96": "grave",
"180": "acute",
"136": "circumflex",
"152": "tilde",
"175": "macron",
"168": "dieresis",
"184": "cedilla",
"151": "emdash",
"198": "AE",
"170": "ordfeminine",
"216": "Oslash",
"140": "OE",
"186": "ordmasculine",
"230": "ae",
"248": "oslash",
"156": "oe",
"223": "germandbls",
"207": "Idieresis",
"233": "eacute",
"159": "Ydieresis",
"247": "divide",
"221": "Yacute",
"194": "Acircumflex",
"225": "aacute",
"219": "Ucircumflex",
"253": "yacute",
"234": "ecircumflex",
"220": "Udieresis",
"218": "Uacute",
"203": "Edieresis",
"169": "copyright",
"229": "aring",
"224": "agrave",
"227": "atilde",
"154": "scaron",
"237": "iacute",
"251": "ucircumflex",
"226": "acircumflex",
"231": "ccedilla",
"222": "Thorn",
"179": "threesuperior",
"210": "Ograve",
"192": "Agrave",
"215": "multiply",
"250": "uacute",
"255": "ydieresis",
"238": "icircumflex",
"202": "Ecircumflex",
"228": "adieresis",
"235": "edieresis",
"205": "Iacute",
"177": "plusminus",
"166": "brokenbar",
"174": "registered",
"200": "Egrave",
"142": "Zcaron",
"208": "Eth",
"199": "Ccedilla",
"193": "Aacute",
"196": "Adieresis",
"232": "egrave",
"211": "Oacute",
"243": "oacute",
"239": "idieresis",
"212": "Ocircumflex",
"217": "Ugrave",
"254": "thorn",
"178": "twosuperior",
"214": "Odieresis",
"181": "mu",
"236": "igrave",
"190": "threequarters",
"153": "trademark",
"204": "Igrave",
"189": "onehalf",
"244": "ocircumflex",
"241": "ntilde",
"201": "Eacute",
"188": "onequarter",
"138": "Scaron",
"176": "degree",
"242": "ograve",
"249": "ugrave",
"209": "Ntilde",
"245": "otilde",
"195": "Atilde",
"197": "Aring",
"213": "Otilde",
"206": "Icircumflex",
"172": "logicalnot",
"246": "odieresis",
"252": "udieresis",
"240": "eth",
"158": "zcaron",
"185": "onesuperior",
"128": "Euro"
},
"isUnicode": false,
"FontName": "Times-Roman",
"FullName": "Times Roman",
"FamilyName": "Times",
"Weight": "Roman",
"ItalicAngle": "0",
"IsFixedPitch": "false",
"CharacterSet": "ExtendedRoman",
"FontBBox": [
"-168",
"-218",
"1000",
"898"
],
"UnderlinePosition": "-100",
"UnderlineThickness": "50",
"Version": "002.00",
"EncodingScheme": "WinAnsiEncoding",
"CapHeight": "662",
"XHeight": "450",
"Ascender": "683",
"Descender": "-217",
"StdHW": "28",
"StdVW": "84",
"StartCharMetrics": "317",
"C": {
"32": 250,
"160": 250,
"33": 333,
"34": 408,
"35": 500,
"36": 500,
"37": 833,
"38": 778,
"146": 333,
"40": 333,
"41": 333,
"42": 500,
"43": 564,
"44": 250,
"45": 333,
"173": 333,
"46": 250,
"47": 278,
"48": 500,
"49": 500,
"50": 500,
"51": 500,
"52": 500,
"53": 500,
"54": 500,
"55": 500,
"56": 500,
"57": 500,
"58": 278,
"59": 278,
"60": 564,
"61": 564,
"62": 564,
"63": 444,
"64": 921,
"65": 722,
"66": 667,
"67": 667,
"68": 722,
"69": 611,
"70": 556,
"71": 722,
"72": 722,
"73": 333,
"74": 389,
"75": 722,
"76": 611,
"77": 889,
"78": 722,
"79": 722,
"80": 556,
"81": 722,
"82": 667,
"83": 556,
"84": 611,
"85": 722,
"86": 722,
"87": 944,
"88": 722,
"89": 722,
"90": 611,
"91": 333,
"92": 278,
"93": 333,
"94": 469,
"95": 500,
"145": 333,
"97": 444,
"98": 500,
"99": 444,
"100": 500,
"101": 444,
"102": 333,
"103": 500,
"104": 500,
"105": 278,
"106": 278,
"107": 500,
"108": 278,
"109": 778,
"110": 500,
"111": 500,
"112": 500,
"113": 500,
"114": 333,
"115": 389,
"116": 278,
"117": 500,
"118": 500,
"119": 722,
"120": 500,
"121": 500,
"122": 444,
"123": 480,
"124": 200,
"125": 480,
"126": 541,
"161": 333,
"162": 500,
"163": 500,
"fraction": 167,
"165": 500,
"131": 500,
"167": 500,
"164": 500,
"39": 180,
"147": 444,
"171": 500,
"139": 333,
"155": 333,
"fi": 556,
"fl": 556,
"150": 500,
"134": 500,
"135": 500,
"183": 250,
"182": 453,
"149": 350,
"130": 333,
"132": 444,
"148": 444,
"187": 500,
"133": 1000,
"137": 1000,
"191": 444,
"96": 333,
"180": 333,
"136": 333,
"152": 333,
"175": 333,
"breve": 333,
"dotaccent": 333,
"168": 333,
"ring": 333,
"184": 333,
"hungarumlaut": 333,
"ogonek": 333,
"caron": 333,
"151": 1000,
"198": 889,
"170": 276,
"Lslash": 611,
"216": 722,
"140": 889,
"186": 310,
"230": 667,
"dotlessi": 278,
"lslash": 278,
"248": 500,
"156": 722,
"223": 500,
"207": 333,
"233": 444,
"abreve": 444,
"uhungarumlaut": 500,
"ecaron": 444,
"159": 722,
"247": 564,
"221": 722,
"194": 722,
"225": 444,
"219": 722,
"253": 500,
"scommaaccent": 389,
"234": 444,
"Uring": 722,
"220": 722,
"aogonek": 444,
"218": 722,
"uogonek": 500,
"203": 611,
"Dcroat": 722,
"commaaccent": 250,
"169": 760,
"Emacron": 611,
"ccaron": 444,
"229": 444,
"Ncommaaccent": 722,
"lacute": 278,
"224": 444,
"Tcommaaccent": 611,
"Cacute": 667,
"227": 444,
"Edotaccent": 611,
"154": 389,
"scedilla": 389,
"237": 278,
"lozenge": 471,
"Rcaron": 667,
"Gcommaaccent": 722,
"251": 500,
"226": 444,
"Amacron": 722,
"rcaron": 333,
"231": 444,
"Zdotaccent": 611,
"222": 556,
"Omacron": 722,
"Racute": 667,
"Sacute": 556,
"dcaron": 588,
"Umacron": 722,
"uring": 500,
"179": 300,
"210": 722,
"192": 722,
"Abreve": 722,
"215": 564,
"250": 500,
"Tcaron": 611,
"partialdiff": 476,
"255": 500,
"Nacute": 722,
"238": 278,
"202": 611,
"228": 444,
"235": 444,
"cacute": 444,
"nacute": 500,
"umacron": 500,
"Ncaron": 722,
"205": 333,
"177": 564,
"166": 200,
"174": 760,
"Gbreve": 722,
"Idotaccent": 333,
"summation": 600,
"200": 611,
"racute": 333,
"omacron": 500,
"Zacute": 611,
"142": 611,
"greaterequal": 549,
"208": 722,
"199": 667,
"lcommaaccent": 278,
"tcaron": 326,
"eogonek": 444,
"Uogonek": 722,
"193": 722,
"196": 722,
"232": 444,
"zacute": 444,
"iogonek": 278,
"211": 722,
"243": 500,
"amacron": 444,
"sacute": 389,
"239": 278,
"212": 722,
"217": 722,
"Delta": 612,
"254": 500,
"178": 300,
"214": 722,
"181": 500,
"236": 278,
"ohungarumlaut": 500,
"Eogonek": 611,
"dcroat": 500,
"190": 750,
"Scedilla": 556,
"lcaron": 344,
"Kcommaaccent": 722,
"Lacute": 611,
"153": 980,
"edotaccent": 444,
"204": 333,
"Imacron": 333,
"Lcaron": 611,
"189": 750,
"lessequal": 549,
"244": 500,
"241": 500,
"Uhungarumlaut": 722,
"201": 611,
"emacron": 444,
"gbreve": 500,
"188": 750,
"138": 556,
"Scommaaccent": 556,
"Ohungarumlaut": 722,
"176": 400,
"242": 500,
"Ccaron": 667,
"249": 500,
"radical": 453,
"Dcaron": 722,
"rcommaaccent": 333,
"209": 722,
"245": 500,
"Rcommaaccent": 667,
"Lcommaaccent": 611,
"195": 722,
"Aogonek": 722,
"197": 722,
"213": 722,
"zdotaccent": 444,
"Ecaron": 611,
"Iogonek": 333,
"kcommaaccent": 500,
"minus": 564,
"206": 333,
"ncaron": 500,
"tcommaaccent": 278,
"172": 564,
"246": 500,
"252": 500,
"notequal": 549,
"gcommaaccent": 500,
"240": 500,
"158": 444,
"ncommaaccent": 500,
"185": 300,
"imacron": 278,
"128": 500
},
"CIDtoGID_Compressed": true,
"CIDtoGID": "eJwDAAAAAAE=",
"_version_": 6
}
+7 -9
View File
@@ -598,17 +598,15 @@ class CPDF implements Canvas
return $filename;
}
$func_name = "imagecreatefrom$type";
set_error_handler([Helpers::class, "record_warnings"]);
if (method_exists(Helpers::class, $func_name)) {
$func_name = [Helpers::class, $func_name];
} elseif (!function_exists($func_name)) {
throw new Exception("Function $func_name() not found. Cannot convert $type image: $image_url. Please install the image PHP extension.");
}
try {
$func_name = "imagecreatefrom$type";
if (method_exists(Helpers::class, $func_name)) {
$func_name = [Helpers::class, $func_name];
} elseif (!function_exists($func_name)) {
throw new Exception("Function $func_name() not found. Cannot convert $type image: $image_url. Please install the image PHP extension.");
}
$im = call_user_func($func_name, $image_url);
if ($im) {
+7 -8
View File
@@ -1078,17 +1078,16 @@ class PDFLib implements Canvas
return $filename;
}
$func_name = "imagecreatefrom$type";
set_error_handler([Helpers::class, "record_warnings"]);
if (method_exists(Helpers::class, $func_name)) {
$func_name = [Helpers::class, $func_name];
} elseif (!function_exists($func_name)) {
throw new Exception("Function $func_name() not found. Cannot convert $type image: $image_url. Please install the image PHP extension.");
}
try {
$func_name = "imagecreatefrom$type";
if (method_exists(Helpers::class, $func_name)) {
$func_name = [Helpers::class, $func_name];
} elseif (!function_exists($func_name)) {
throw new Exception("Function $func_name() not found. Cannot convert $type image: $image_url. Please install the image PHP extension.");
}
$im = call_user_func($func_name, $image_url);
if ($im) {
+25 -1
View File
@@ -1311,6 +1311,7 @@ EOL;
switch ($prev) {
case "'":
$pattern = "/(?<!\\\\)'/";
break;
case "\"":
$pattern = "/(?<!\\\\)\"/";
break;
@@ -1324,6 +1325,10 @@ EOL;
if (preg_match($pattern, $css, $matches, PREG_OFFSET_CAPTURE, $start)) {
$len = $matches[0][1] - $start;
}
if ($len <= 0) {
$offset = $start + 5;
continue;
}
$data_uri = substr($css, $start, $len);
$data_uri_hash = md5($data_uri);
$this->_blobs[$data_uri_hash] = $data_uri;
@@ -1493,7 +1498,7 @@ EOL;
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,
@@ -1502,6 +1507,25 @@ EOL;
$url,
$this->_dompdf->getOptions()->getChroot()
);
if ($path !== null && strpos($path, "blob:") !== 0) {
[$protocol] = Helpers::explode_url($path);
$options = $this->_dompdf->getOptions();
$allowed_protocols = $options->getAllowedProtocols();
if (!array_key_exists($protocol, $allowed_protocols)) {
Helpers::record_warnings(E_USER_WARNING, "Permission denied on $path. The communication protocol is not supported.", __FILE__, __LINE__);
$path = null;
}
foreach ($allowed_protocols[$protocol]["rules"] as $rule) {
[$result, $message] = $rule($path);
if ($result !== true) {
Helpers::record_warnings(E_USER_WARNING, "Error loading $path: $message", __FILE__, __LINE__);
$path = null;
}
}
}
if ($path === null) {
$path = "none";
}
+3 -1
View File
@@ -772,6 +772,8 @@ class Dompdf
$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 @@ class Dompdf
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);
}
}
+3 -6
View File
@@ -22,13 +22,10 @@ use FontLib\Font;
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";
+6 -3
View File
@@ -677,9 +677,12 @@ class Frame
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)) {
+55 -10
View File
@@ -59,7 +59,7 @@ class Helpers
public static function build_url($protocol, $host, $base_path, $url, $chrootDirs = [])
{
$protocol = mb_strtolower($protocol, "UTF-8");
if (empty($protocol)) {
if (empty($protocol) || $protocol === "data://") {
$protocol = "file://";
}
if ($url === "") {
@@ -792,12 +792,20 @@ class Helpers
}
/**
* getimagesize doesn't give a good size for 32bit BMP image v5
* Shim for PHP's getimagesize to handle formats that the function
* does not handle natively.
*
* @param string $filename
* @param resource $context
* @return array An array of three elements: width and height as
* `float|int`, and image type as `string|null`.
* @return array An array of 8 elements, by index:
* - `float|int` width
* - `float|int` height
* - `string|null` image type
* - `int|null` type constant
* - `string|null` mime type
* - `int|null` channels
* - `int|null` bits
* - `int|null` estimated memory size in bytes
*/
public static function dompdf_getimagesize($filename, $context = null)
{
@@ -820,10 +828,13 @@ class Helpers
}
$parse_result = @getimagesize($filename);
$width = $height = $type = null;
$width = $height = $type = $typeconst = $mime = $channels = $bits = $bytes = null;
if ($parse_result !== false) {
[$width, $height, $type] = $parse_result;
$type = $types[$type] ?? null;
[$width, $height, $typeconst] = $parse_result;
$type = $types[$typeconst] ?? null;
$mime = $parse_result['mime'] ?? null;
$channels = $parse_result['channels'] ?? null;
$bits = $parse_result['bits'] ?? null;
}
if ($width == null || $height == null) {
@@ -831,23 +842,57 @@ class Helpers
if ($data !== null) {
if (substr($data, 0, 2) === "BM") {
$meta = unpack("vtype/Vfilesize/Vreserved/Voffset/Vheadersize/Vwidth/Vheight", $data);
$meta = unpack("vtype/Vfilesize/Vreserved/Voffset/Vheadersize/Vwidth/Vheight/vplanes/vbits/Vcompression/Vimagesize/Vxres/Vyres/Vcolors", $data);
$width = (int) $meta["width"];
$height = (int) $meta["height"];
$type = "bmp";
$typeconst = IMAGETYPE_BMP;
$mime = "image/bmp";
$bits = (int) $meta["bits"];
$channels = $bits > 24 ? 4 : 3;
} elseif (strpos($data, "<svg") !== false) {
$doc = new \Svg\Document();
if (property_exists($doc, 'allowExternalReferences')) {
$doc->allowExternalReferences = true;
}
$doc->loadFile($filename);
[$width, $height] = $doc->getDimensions();
$width = (float) $width;
$height = (float) $height;
$type = "svg";
if (defined('IMAGETYPE_SVG')) {
$typeconst = IMAGETYPE_SVG;
}
$mime = "image/svg+xml";
$bits = 32;
$channels = 4;
$bytes = strlen($data);
}
}
}
return $cache[$filename] = [$width ?? 0, $height ?? 0, $type];
if ($width !== null && $height !== null) {
switch ($type) {
case IMAGETYPE_BMP:
$channels = $channels > 0 ? $channels : 4;
$bits = $bits > 0 ? $bits : 24;
case IMAGETYPE_PNG:
case IMAGETYPE_WEBP:
$channels = $channels > 0 ? $channels : 4;
$bits = $bits > 0 ? $bits : 8;
break;
default:
$channels = $channels > 0 ? $channels : 3;
$bits = $bits > 0 ? $bits : 8;
break;
}
// Memory in bytes
$bytes = $width * $height * $channels * ($bits / 8);
}
return $cache[$filename] = [$width ?? 0, $height ?? 0, $type, $typeconst, $mime, $channels ?? 4, $bits ?? 8, $bytes];
}
/**
@@ -862,7 +907,7 @@ class Helpers
return false;
}
if (function_exists("imagecreatefrombmp") && ($im = imagecreatefrombmp($filename)) !== false) {
if (function_exists("imagecreatefrombmp") && ($im = @imagecreatefrombmp($filename)) !== false) {
return $im;
}
+7 -2
View File
@@ -128,12 +128,17 @@ class Cache
throw new ImageException("Image not readable or empty", E_WARNING);
}
list($width, $height, $type) = Helpers::dompdf_getimagesize($resolved_url, $options->getHttpContext());
list($width, $height, $type, , , , , $imageBytes) = Helpers::dompdf_getimagesize($resolved_url, $options->getHttpContext());
if (($width && $height && in_array($type, ["gif", "png", "jpeg", "bmp", "svg","webp"], true)) === false) {
throw new ImageException("Image type unknown", E_WARNING);
}
$maxImageBytes = $options->getImageByteSizeLimit();
if ($width <= 0 || $height <= 0 || ($maxImageBytes > 0 && ($imageBytes === null || $imageBytes > $maxImageBytes))) {
throw new ImageException("Image dimensions or size exceed the configured limit", E_WARNING);
}
if ($type === "svg") {
$parser = xml_parser_create("utf-8");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
@@ -155,7 +160,7 @@ class Cache
$inner_full_url = Helpers::build_url($parsed_url["protocol"], $parsed_url["host"], $parsed_url["path"], $url, $options->getChroot());
if (empty($inner_full_url)) {
continue;
throw new ImageException("This SVG document references a resource that could not be resolved.", E_WARNING);
}
self::detectCircularRef($full_url, $inner_full_url);
+21 -3
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 @@ class LineBox
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 @@ class LineBox
}
// 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")
) {
+51 -6
View File
@@ -163,6 +163,13 @@ class Options
*/
private $fontHeightRatio = 1.1;
/**
* The maximum estimated in-memory size of an image allowed to be rendered, in bytes.
*
* @var int
*/
private $imageByteSizeLimit = -1;
/**
* Enable embedded PHP
*
@@ -356,7 +363,7 @@ class Options
$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";
@@ -373,6 +380,10 @@ class Options
$this->setArtifactPathValidation([$this, "validateArtifactPath"]);
// Get the memory limit
$memory_limit = ini_get('memory_limit');
$this->setImageByteSizeLimit($memory_limit);
if (null !== $attributes) {
$this->set($attributes);
}
@@ -887,6 +898,36 @@ class Options
return $this->fontHeightRatio;
}
/**
* @param int $imageMemoryLimit
* @return $this
*/
public function setImageByteSizeLimit($imageByteSizeLimit)
{
// Convert shorthand notation to bytes
if (preg_match('/^(\\d+)([KMG])$/i', $imageByteSizeLimit, $matches)) {
if (strtoupper($matches[2]) == 'K') {
$imageByteSizeLimit = (int)$matches[1] * 1024;
} elseif (strtoupper($matches[2]) == 'M') {
$imageByteSizeLimit = (int)$matches[1] * 1024 * 1024;
} elseif (strtoupper($matches[2]) == 'G') {
$imageByteSizeLimit = (int)$matches[1] * 1024 * 1024 * 1024;
}
}
if (is_numeric($imageByteSizeLimit)) {
$this->imageByteSizeLimit = $imageByteSizeLimit > 0 ? $imageByteSizeLimit : -1;
}
return $this;
}
/**
* @return int
*/
public function getImageByteSizeLimit()
{
return $this->imageByteSizeLimit;
}
/**
* @param boolean $isFontSubsettingEnabled
* @return $this
@@ -1175,13 +1216,21 @@ class Options
}
$realfile = realpath(str_replace("file://", "", $uri));
if ($realfile === false) {
return [false, "File not found."];
}
$dirs = $this->chroot;
$dirs[] = $this->rootDir;
$chrootValid = false;
foreach ($dirs as $chrootPath) {
$chrootPath = realpath($chrootPath);
if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) {
if ($chrootPath === false) {
continue;
}
$normalizedChrootPath = rtrim($chrootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
if ($realfile === $chrootPath || strncmp($realfile, $normalizedChrootPath, strlen($normalizedChrootPath)) === 0) {
$chrootValid = true;
break;
}
@@ -1190,10 +1239,6 @@ class Options
return [false, "Permission denied. The file could not be found under the paths specified by Options::chroot."];
}
if (!$realfile) {
return [false, "File not found."];
}
return [true, null];
}
+45 -20
View File
@@ -467,6 +467,14 @@ abstract class AbstractRenderer
|| ($tmpFile !== null && file_exists($tmpFile));
if (!$cached) {
// determmine if image is too big to be rendered
$maxImageBytes = $this->_dompdf->getOptions()->getImageByteSizeLimit();
$bgBytes = $bg_width * $bg_height * 4 * 4; // 4 channels with 4 bytes per channel (e.g. truecolor with alpha)
if ($maxImageBytes > 0 && ($bgBytes === null || $bgBytes > $maxImageBytes)) {
Helpers::record_warnings(E_USER_WARNING, "Background image dimensions are too large to be rendered (calculated size: " . round($bgBytes / 1048576, 2) . " MB).", __FILE__, __LINE__);
return;
}
// img: image url string
// img_w, img_h: original image size in px
// width, height: box size in pt
@@ -481,28 +489,30 @@ abstract class AbstractRenderer
$bg = imagecreatetruecolor($bg_width, $bg_height);
$cpdfFromGd = true;
$func_name = "imagecreatefrom$type";
if (method_exists(Helpers::class, $func_name)) {
$func_name = [Helpers::class, $func_name];
} elseif (!function_exists($func_name)) {
if (isset($bg) && PHP_MAJOR_VERSION < 8) {
imagedestroy($bg);
}
return;
}
switch (strtolower($type)) {
/** @noinspection PhpMissingBreakStatementInspection */
case "png":
$cpdfFromGd = false;
imagesavealpha($bg, true);
imagealphablending($bg, false);
$src = @imagecreatefrompng($img);
break;
/** @noinspection PhpMissingBreakStatementInspection */
case "jpeg":
$src = @imagecreatefromjpeg($img);
break;
/** @noinspection PhpMissingBreakStatementInspection */
case "webp":
$src = @imagecreatefromwebp($img);
break;
/** @noinspection PhpMissingBreakStatementInspection */
case "gif":
$src = @imagecreatefromgif($img);
break;
case "bmp":
$src = @Helpers::imagecreatefrombmp($img);
$src = @call_user_func($func_name, $img);
break;
default:
@@ -510,21 +520,36 @@ abstract class AbstractRenderer
}
if ($src == null) {
if (isset($bg) && PHP_MAJOR_VERSION < 8) {
imagedestroy($bg);
}
return;
}
if ($img_w != $org_img_w || $img_h != $org_img_h) {
$newSrc = imagecreatetruecolor($img_w, $img_h);
imagealphablending($newSrc, false);
imagesavealpha($newSrc, true);
imagecopyresampled($newSrc, $src, 0, 0, 0, 0, $img_w, $img_h, imagesx($src), imagesy($src));
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($src);
$imgBytes = $img_w * $img_h * 4 * 4; // 4 channels with 4 bytes per channel (e.g. truecolor with alpha)
if ($maxImageBytes > 0 && ($imgBytes === null || $imgBytes > $maxImageBytes)) {
Helpers::record_warnings(E_USER_WARNING, "Background image is too large to be rendered (calculated size: " . round($imgBytes / 1048576, 2) . " MB).", __FILE__, __LINE__);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($src);
}
$src = null;
} else {
$newSrc = imagecreatetruecolor($img_w, $img_h);
imagealphablending($newSrc, false);
imagesavealpha($newSrc, true);
imagecopyresampled($newSrc, $src, 0, 0, 0, 0, $img_w, $img_h, imagesx($src), imagesy($src));
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($src);
}
$src = $newSrc;
}
$src = $newSrc;
}
if ($src == null) {
if (isset($bg) && PHP_MAJOR_VERSION < 8) {
imagedestroy($bg);
}
return;
}
-17
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.
+4 -4
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"
}
}
+6 -2
View File
@@ -120,7 +120,7 @@ class BinaryStream {
* @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 @@ class BinaryStream {
}
public function readUInt8() {
return ord($this->read(1));
$byte = $this->read(1);
if ($byte === '') {
return 0;
}
return ord($byte);
}
public function readUInt8Many($count) {
@@ -69,28 +69,34 @@ class Collection extends BinaryStream implements Iterator, Countable {
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();
+2 -2
View File
@@ -23,9 +23,9 @@
"require": {
"php": "^7.1 || ^8.0",
"ext-mbstring": "*",
"sabberworm/php-css-parser": "^8.4"
"sabberworm/php-css-parser": "^8.4 || ^9.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11"
}
}
+6 -2
View File
@@ -161,7 +161,9 @@ class Document extends AbstractTag
}
xml_parse($parser, "", true);
xml_parser_free($parser);
if (PHP_MAJOR_VERSION < 8) {
xml_parser_free($parser);
}
return $this->handleSizeAttributes($rootAttributes);
}
@@ -257,7 +259,9 @@ class Document extends AbstractTag
xml_parse($parser, "", true);
xml_parser_free($parser);
if (PHP_MAJOR_VERSION < 8) {
xml_parser_free($parser);
}
}
protected function svgOffset($attributes)
+13 -2
View File
@@ -109,6 +109,7 @@ class Style
$class = isset($attributes["class"]) ? preg_split('/\s+/', trim($attributes["class"])) : null;
$stylesheets = $tag->getDocument()->getStyleSheets();
$outputFormat = \Sabberworm\CSS\OutputFormat::createCompact();
$styles = array();
@@ -127,7 +128,12 @@ class Style
if ($_selector === ".$_class") {
/** @var \Sabberworm\CSS\Rule\Rule $_rule */
foreach ($_decl->getRules() as $_rule) {
$styles[$_rule->getRule()] = $_rule->getValue() . "";
$value = $_rule->getValue();
if ($value instanceof \Sabberworm\CSS\Value\Value) {
$styles[$_rule->getRule()] = $value->render($outputFormat) . "";
} else {
$styles[$_rule->getRule()] = $value . "";
}
}
break 2;
@@ -139,7 +145,12 @@ class Style
if ($_selector === $tag->tagName) {
/** @var \Sabberworm\CSS\Rule\Rule $_rule */
foreach ($_decl->getRules() as $_rule) {
$styles[$_rule->getRule()] = $_rule->getValue() . "";
$value = $_rule->getValue();
if ($value instanceof \Sabberworm\CSS\Value\Value) {
$styles[$_rule->getRule()] = $value->render($outputFormat) . "";
} else {
$styles[$_rule->getRule()] = $value . "";
}
}
break;
+19 -7
View File
@@ -5612,7 +5612,9 @@ EOT;
// Cast to 8bit+palette
$imgalpha_ = @imagecreatefrompng($tempfile_alpha);
imagecopy($imgalpha, $imgalpha_, 0, 0, 0, 0, $wpx, $hpx);
imagedestroy($imgalpha_);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($imgalpha_);
}
imagepng($imgalpha, $tempfile_alpha);
// Make opaque image
@@ -5658,7 +5660,9 @@ EOT;
// Cast to 8bit+palette
$imgalpha_ = @imagecreatefrompng($tempfile_alpha);
imagecopy($imgalpha, $imgalpha_, 0, 0, 0, 0, $wpx, $hpx);
imagedestroy($imgalpha_);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($imgalpha_);
}
imagepng($imgalpha, $tempfile_alpha);
} else {
$tempfile_alpha = null;
@@ -5711,7 +5715,9 @@ EOT;
// extract image without alpha channel
$imgplain = imagecreatetruecolor($wpx, $hpx);
imagecopy($imgplain, $img, 0, 0, 0, 0, $wpx, $hpx);
imagedestroy($img);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($img);
}
imagepng($imgalpha, $tempfile_alpha);
imagepng($imgplain, $tempfile_plain);
@@ -5722,13 +5728,17 @@ EOT;
// embed mask image
if ($tempfile_alpha) {
$this->addImagePng($imgalpha, $tempfile_alpha, $x, $y, $w, $h, true);
imagedestroy($imgalpha);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($imgalpha);
}
$this->imageCache[] = $tempfile_alpha;
}
// embed image, masked with previously embedded mask
$this->addImagePng($imgplain, $tempfile_plain, $x, $y, $w, $h, false, ($tempfile_alpha !== null));
imagedestroy($imgplain);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($imgplain);
}
$this->imageCache[] = $tempfile_plain;
}
@@ -5813,11 +5823,13 @@ EOT;
}
imagecopy($img, $imgtmp, 0, 0, 0, 0, $sx, $sy);
imagedestroy($imgtmp);
if (PHP_MAJOR_VERSION < 8) {
imagedestroy($imgtmp);
}
}
$this->addImagePng($img, $file, $x, $y, $w, $h);
if ($img) {
if ($img && PHP_MAJOR_VERSION < 8) {
imagedestroy($img);
}
}