This file lists what the gravitypdf branch (8.x-dev) changes compared with upstream mPDF. It covers everything since the branch left upstream development at 389e19e7. CHANGELOG.md is kept identical to upstream's and only lists upstream's releases.
How to read the references:
#Nis a GravityPDF/mpdf pull request, or the issue it fixed.mpdf/mpdf#Nis the upstream issue or pull request a change mirrors or fixes.
Read this section before upgrading from upstream mPDF. Each entry says what changed and what to do about it.
- Fonts are no longer shipped with mPDF. The
ttfonts/directory is gone. Each font family is now a Composer package that registers itself throughMpdf\Fonts\FontRegistryandFontRegistrationInterface. mpdf/mpdf#2161 #2 #4 #7 #36 #45- The packages, such as
mpdf/font-bundle-lite,mpdf/font-bundle-allandmpdf/font-dejavu-family, are not published yet. They live in this repository'spackages/directory. - To install them, add
packages/as a Composerpathrepository in your project.
- The packages, such as
- Encryption uses AES-256 instead of RC4.
SetProtection()writes the V5/R6 security handler from ISO 32000-2. #329- You need
ext-openssl. - Passwords are read as UTF-8 and prepared with SASLprep. A password that is not UTF-8, or that holds a prohibited character, throws
MpdfException. - Every string in the document is now encrypted. Before, some were left in the clear, including form
/DAstrings,/Langand attachment names.
- You need
PDFAversiondefaults to2-Binstead of1-B. Set'PDFAversion' => '1-B'to keep PDF/A-1b. #330PDFXis an on/off switch. The newPDFXversionoption picks the version:4(the default) or1a. Set'PDFXversion' => '1a'to keep PDF/X-1a. #324percentSubsetdefaults to100instead of30. Upstream ignores bothpercentSubsetandmaxTTFFilesize. A font is now subset when the document draws at most that share of its glyphs, or when the font is larger thanmaxTTFFilesize. With the defaults, output does not change. #148 #159<annotation file="...">is off by default. SetallowHtmlAnnotationFilestotrueto read thefileattribute. #375- A
<select>withoutsizeis written as a combo box, as browsers draw it. #419 - A
<select multiple>withoutsizeis four rows tall instead of one, as in browsers. Content after it on the page moves down. Addsize="1"to keep the old height. #437 - The
borderandbackgroundshorthands reset the longhands they do not name, as in a browser, in standard mode. #552 #614border, or one side such asborder-top, sets the width, style and colour of each side it covers.p { border-top-color: red } p { border: 1px solid blue }used to draw a red top and now draws a blue one.backgroundsets the colour, image, repeat, position, size, origin and clip. Abackground-position,-repeator-sizegiven before abackgroundno longer applies to its image.- To keep the old look, restate the longhand after the shorthand, in the same rule or a later one.
borderkeepsborder-radius.backgroundkeeps mPDF's ownbackground-image-resize,-opacityand-resolution, which it cannot set, in the same way thatbackgroundleavesbackground-blend-modealone in CSS.background-size: autono longer stopsbackground-image-resizefrom sizing the image.- A property declared twice in one block is read at its last place, so
border-top-color: green; border: 1px solid blue; border-top-color: reddraws a red top.
- Dependencies changed.
ext-jsonis now required andsymfony/polyfill-intl-normalizeris a new dependency.myclabs/deep-copyis no longer used. #13 #329 outline-widthandoutline-colorno longer stroke the text. mPDF read them astext-outline-widthandtext-outline-color, but in CSS they belong to the line around the box, which mPDF does not draw.outline-widthon its own also raised an undefined-key warning. Writetext-outline-widthandtext-outline-color, ortext-outline, to keep stroking the text. #578- CSS rules apply by specificity, then in the order they are written, as in a browser. mPDF applied them in a fixed order of selector groups, so
div pbeat#id,p.cbeat#i,body pbeat.lead, the rule from the nearest ancestor beat a heavier descendant rule, and classes applied in alphabetical order. Now the more specific selector wins each of those, and of.a { } .b { } .a { }the second.awins. Set'cssMode' => \Mpdf\CssMode::LEGACYto parse and apply CSS as mPDF v7 did. #535 #631- Each element takes, in order: the values it inherits; the built-in defaults and the rules of the default stylesheet (
defaultCssFile), which any author rule beats; HTML attributes such as<hr color>,widthandvspace, as author rules of no specificity; the stylesheets; thenstyle="". - Class and id names still match whatever their case.
- An author's
a { }rule now reaches the links of the table of contents and the index too. Stylea.mpdf_toc_aanda.mpdf_index_linkto keep them plain. - In legacy mode, a rule whose selector mPDF v7 could not read is dropped: child and sibling combinators, structural pseudo-classes outside tables, attribute selectors other than
[lang],:lang()through an ancestor, descendant rules through inline ancestors, and:not(),:is()and:where(). Thefont,borderandbackgroundshorthands leave the longhands they do not name, as mPDF v7 did. Fixes to how values and selectors are read apply in both modes. #633
- Each element takes, in order: the values it inherits; the built-in defaults and the rules of the default stylesheet (
!importantis honoured, as in a browser, in standard mode. mPDF read a declaration marked!importantas any other, sop { color: green !important } #i { color: red }drew<p id="i">red, and so didstyle="color: red"on a<p>. Now an important declaration beats every declaration that is not, the inline style included. Set'cssMode' => \Mpdf\CssMode::LEGACYto read the flag as nothing, as mPDF v7 did. mpdf/mpdf#1010 mpdf/mpdf#1707 #532 #638- Important declarations apply after the inline style: those of the stylesheets by specificity and then order, then those of
style="", then those of the default stylesheet (defaultCssFile), as a browser's own important declarations beat a page's. - A shorthand marked
!importantmakes every longhand it sets important, soborder: 1mm solid green !importantbeats aborder-top-colorof a more specific rule or of a later declaration in the same block. @pagerules,bodyrules and the class rules SVG text looks up take an important declaration over a later one of the same selector that is not. An important declaration of abodyrule beats<body style>.
- Important declarations apply after the inline style: those of the stylesheets by specificity and then order, then those of
- HTML attributes that style an element are read only where HTML defines them, as a browser reads them, in standard mode. Set
'cssMode' => \Mpdf\CssMode::LEGACYto keep the old reading. #531 #641colorapplies tofontandhronly,widthto images, tables, cells,hr,meterandprogress,heightto images, tables, rows, row groups, cells,meterandprogress,valignto rows, row groups and cells,vspaceandhspaceto images, andaligntodiv,p, headings, table parts,caption,hrandimg. So<a color>,<span color>,<p color>,<td color>,<div width>,<img valign>and<blockquote align>no longer do anything. mPDF's own tags, such as<barcode color>, keep every attribute.- A stylesheet rule beats the attribute everywhere. Before,
alignon a paragraph, div or table cell,nowrapon a cell,borderon a table,<caption align>,<hr width>in a table cell andalignon a text field beat any rule for the same property. <div align>passes its alignment on to what it holds, and<li type>beats the marker the item inherits from its list.- Attributes mPDF ignored now take effect:
<hr align>,<hr size>,<img align>(float left or right, or vertical alignment),<img border>,<thead align>, and<table border>wider than 1. - A table's
bordergives each cell a 1px border of its own, which a rule for the table's border leaves alone. Before, the cells copied the table's border.
line-heighton an inline element sets the height of its line, as in a browser. mPDF ignored it, so<span style="line-height: 30mm">left its line as it was. Now each inline element's box is as tall as its line-height, and a line grows to hold the tallest box on it, text or image, in blocks and table cells alike. The block's own line height is the least a line can be, so a smaller inline line-height, or0, does not shrink it. A percentage invertical-alignis taken of the element's own line-height.line-heighton a<p>or<div>inside a table cell, which mPDF lays out as inline content, can now make its lines taller than the cell's. Set'cssMode' => \Mpdf\CssMode::LEGACYto ignore it as before. #548 #646remis read against the font size ofhtml, in standard mode, as in a browser. It was read against the font size ofbody, and inside a table against the table's. Now1remis the default font size, from thedefault_font_sizeconfiguration orSetDefaultFontSize(), unless anhtmlor:rootrule sizeshtml: withhtml { font-size: 62.5% },1.6remis the default size again. Abody { font-size }rule no longer changes it. To keep the old sizes, give them inemor points, or set'cssMode' => \Mpdf\CssMode::LEGACY. #529 #642- A border,
box-shadowortext-shadowthat names no colour is drawn in the element's colour, which iscurrentColor, as in a browser. A border was drawn black and a shadow grey (#888888).div { color: #c00; border: 1px solid; box-shadow: 2mm 2mm }now draws a red border and a red shadow. This applies to thebordershorthands and to a border built fromborder-styleorborder-widthalone. Name the colour, as inborder: 1px solid #000, or set'cssMode' => \Mpdf\CssMode::LEGACY, to keep black borders and grey shadows. #540 #651currentColorwritten inbackground-color, a gradient stop,box-shadow,text-shadow,topntailorthead-underlineis read as the element's colour too, andcolor: currentColoras the colour it inherits. Before, the background was not painted, the gradient lost the stop, the shadows were grey, the table lines black, andcolor: currentColoron a block drew black. Legacy mode ignorescurrentColorthere as before.
- The CSS-wide keywords
inherit,initial,unset,revertandrevert-layerare applied, as in a browser. mPDF read most of them as a value it did not know:color: inheriton a block or a cell drew black,font-size: inheritthe default size, andborder: inheritno border. Set'cssMode' => \Mpdf\CssMode::LEGACYto read them as before. #546 #652inherittakes the parent element's value, for properties that are not inherited too, such asborder,paddingandbackground. A cell takes those from its row.initialgives the property's initial value, such ascurrentColorfor a border's colour, and the document's default font and size forfont-familyandfont-size.unsetisinheritfor an inherited property andinitialfor any other.revertandrevert-layergive the value of the built-in defaults and the default stylesheet, such as a heading's size, a list's margin or a cell's padding, and areunsetwhere those give none. An HTML attribute such ascellpaddingcounts as an author rule, sorevertgoes past it too.- A shorthand passes the keyword to each of its longhands, so
border: inherittakes every side's width, style and colour, andfont: initialresets the size, family, style, weight, line height and variants.
- A table inherits from the block around it, as in a browser, under the standard
cssMode. It used to start from the document's defaults, so<div style="color: red; font-family: monospace">around a table left its cells black and in the body's font. Now a table takes every inherited property from the block, list item, header or positioned block it is in, and a nested table takes its cell'stext-alignandline-heighttoo. #543 #656- A table inside an inline element, as in
<span class="note">…<table>…</table>…</span>, takes the element's style, as a block does since #653. The text after the table, up to the element's end tag, is drawn in that style again. Before, it lost it, and in a table cell the style ran on past the end tag. table { font-size: 80% }is taken of the block's size, not the document's.- The built-in default style no longer gives a table
line-height: 1.2,hyphens: manualandfont-kerning: auto, which a browser's does not, so a table inherits them. A table in a block with noline-heightof its own now takesnormal, and its rows are drawn as far apart as a paragraph's lines, atnormalLineheight, instead of at 1.2. To keep the old spacing, addtable { line-height: 1.2; }to the stylesheet. - A
thin a table in a right-aligned block is aligned right, since it inherits an alignment. - Set
'cssMode' => \Mpdf\CssMode::LEGACYto keep tables starting from the document's defaults.
- A table inside an inline element, as in
- Text decorations propagate to descendants instead of being inherited, as in a browser. A link styled
a { text-decoration: none }inside an underlined paragraph now has the paragraph's underline drawn under it. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep the old output, or move thetext-decorationfrom the paragraph to the parts of it you want decorated. #544 #654- An underline, overline or line-through is drawn over the text of every descendant in the flow, in the colour and at the size of the element that set it. A child block used to redraw it in its own colour and size, and lost an overline.
text-decoration: noneon a descendant removes only a decoration of its own. A descendant's own decoration is added to its ancestors':line-throughinside an underlined block is drawn with both lines.- An element whose
coloristransparent, set or inherited, adds no decoration of its own, since it would be drawn in that colour. - A block inside an underlined inline element, as in
<span style="text-decoration: underline">…<div>…</div>…</span>, is underlined too, as is the text after it up to the element's end tag. - Floats, positioned blocks and inline blocks no longer take the decorations of the element they are in. Tables never did.
- A child block no longer takes its parent's
vertical-align, which is not inherited.
- Every element inherits its parent's computed values, as in a browser, under the standard
cssMode. The separate ways mPDF handed styles from a block to its children, from an inline element to a block in it, from a table to its cells and from a positioned block to its content each carried their own set of properties and values. They are replaced by one: each open element keeps the computed values of the inherited properties, and its children start from them. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep the old output. #547 #683- A length given in
em,ex,chorremis inherited as the length it came to, not as the unit read again at the child's size.letter-spacing: 0.1emon a 20pt block spaces the letters of a 10pt paragraph in it 2pt apart, not 1pt.inheriton a length that is not inherited, such aspadding-left: inherit, takes it in the same way. - The content of a positioned block draws
line-height: normalas the rest of the document does. It used to be drawn at a fixed 1.33, which with DejaVu Sans or Times sets the lines a little further apart. To keep the old spacing, addline-height: 1.33to the positioned block. - A bidirectional embedding, as in
<span dir="rtl">…<div>…</div>…</span>, is opened again for the inline element's text after the block.
- A length given in
- Stylesheet rules that name
sup,suborcenterapply, in both CSS modes. mPDF left the three tags out ofallowedCSStags, sosup { color: red },p sub { … }andcenter { … }did nothing while a class rule on the same element worked. A rule'sfont-sizeandvertical-aligntake the place of the 55% size and the raise or drop mPDF gives the tags by default, rather than adding to them, so normalize.css'ssub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline }now draws them at 75% on the baseline. To keep ignoring such rules, pass anallowedCSStagswithoutSUP,SUBandCENTER. #649 #680 min-widthandmax-widthhold the width of a block, as in a browser, in standard mode. mPDF never read them on a block, somax-width: 100mm; margin: 0 auto, the usual centred container, filled the page,width: 150mm; max-width: 100mmwas 150mm wide, andwidth: 50mm; min-width: 80mmwas 50mm. Now the width is held within the two,max-widthfirst, thenmin-width, a percentage taken of the container's inner width aswidthis, and the block's auto margins, direction or float place the narrowed box. Floats and positioned blocks take the same limits. Set'cssMode' => \Mpdf\CssMode::LEGACYto ignore the two properties as before. #588 #691box-sizingis not read, so the limits measure the content, and a block with padding and borders is wider by them.min-widthandmax-widthon a table or cell are still not read.
- A block wider than its container sticks out of it, as in a browser, in standard mode. mPDF cut a block's
widthormin-widthdown to the space its container left, so<div style="width: 50mm"><div style="min-width: 80mm">drew a 50mm box, and so didwidth: 50mm; padding: 0 5mmin a 50mm container less its padding. Now the box keeps its width and sticks out on the right, or on the left wheredirectionisrtl. Auto margins count as 0 when the box does not fit. A left float sticks out on the right; a right float already stuck out on the left. A block wider than the page area runs into the page margin. Text inside wraps at the block's width. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep holding blocks within their container. #552 #701 - An image with
display: blockhas a line of its own and is placed by its margins, as in a browser, in standard mode. mPDF kept the image inline and read anautomargin as 0, soimg { display: block; margin: 0 auto }, the usual way to centre an image, did nothing. Now the line ends before and after the image,margin: 0 autocentres it,margin-left: autopushes it to the right edge, and in a right-to-left block an image with no auto margin sits at the right.text-aligndoes not move a block-level image, andjustifyleaves the line before it unstretched. Text that followed such an image on its line moves down a line. Floats, images in table cells and images inside<columns>are placed as before. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep the image inline with margins of 0. #589 #693- A paragraph's
text-indentdoes not move a block-level image on its first line, as the image is not part of a line of text; before, the image was shifted by the indent, and one as wide as the line ran past the page area. An image too wide for the room beside a float is narrowed in proportion, its margins kept; mPDF took the margins out of its width only, so it was drawn too tall. As mPDF narrows any image to fit, a block-level image wider than its line is narrowed rather than overflowing as in a browser. #703
- A paragraph's
- A stream wrapper is checked for every asset fetcher, not only
AssetFetcher. A fetcher from the container, or a subclass ofAssetFetcherthat replacedfetchDataFromPath(), could be handedphar://and other stream wrappers from the document's HTML and CSS. mPDF now refuses them before the call, asAssetFetcherdoes. A scheme not registered with PHP still reaches the fetcher. If yours serves a registered wrapper such ass3://, add it towhitelistStreamWrappers.pharcannot be allowed. #864 - Invalid UTF-8 in HTML or text no longer stops the document. The bad bytes are logged and replaced, with
?unlessmb_substitute_character()says otherwise, and the document carries on. Set'debug' => trueto throwMpdfExceptioninstead. Text means what is passed to calls such asWriteText(),WriteCell(),MultiCell()andBookmark(), and SVG text. #873
- PDF/X-4 (ISO 15930-7). Unlike PDF/X-1a, it keeps transparency, layers,
rgba()colours and PNG alpha. #324- With no
ICCProfile, the bundledSWOP2006_Coated3v2.iccis embedded as the output intent. - An imported page's device colours get a default colour space where PDF/X requires one.
- Black converts to the black ink alone, not to all four inks.
- With no
- PDF/A-2b, PDF/A-2u and PDF/A-3u. PDF/A-2 and PDF/A-3 documents keep opacity, alpha, soft masks, watermarks, transparency groups, layers and hidden content. CI checks every PDF/A level mPDF writes with veraPDF. #330 #357 #359 #386
- Factur-X and ZUGFeRD.
SetEmbeddedInvoice(new Mpdf\Invoice\FacturX($xml))embeds the invoice XML in a PDF/A-3 document with the right file name and relationship, and writes thefxXMP schema. The conformance level is read from the XML's guideline ID, or you can pass it. #368 #512- mPDF does not write or validate the XML.
composer.jsonsuggestshorstoeko/zugferdandeasybill/e-invoicingfor writing it.
- mPDF does not write or validate the XML.
- Printing invoice XML as HTML.
Mpdf\Invoice\HtmlInvoiceWriterturns Cross Industry Invoice or UBL 2.1 XML into HTML forWriteHTML(). #514 #515CiiInvoiceReader,UblInvoiceReaderandInvoiceReaderread the XML into a plain array if you want your own layout.Formatterwrites amounts, dates and addresses the way a country does. It has 21 country presets.
- Object streams. Set
useObjectStreamsto pack objects into compressed object streams with a cross-reference stream, for smaller files. It is off by default. It never applies to encrypted, PDF/A-1 or PDF/X-1a documents. #337 - Importing PDF 1.5 files. Imported PDFs can use cross-reference streams, object streams and hybrid cross-references. The new
Mpdf\Import\PdfParserreads them. #337 - Imported links keep their look. Links on an imported page keep their border, colour, flags and
QuadPoints. mpdf/mpdf#2154 #12 - Opening on the attachments pane.
SetDisplayPreferences('UseAttachments')opens the reader with its attachments pane showing. mpdf/mpdf#2142 #17 - Safer annotation files. Annotation files are loaded through the asset fetcher, like images and stylesheets. #375
- Only file types listed in
annotationFileAllowListare embedded, and only up toannotationFileMaxSize. - A file that cannot be embedded becomes a text note and a logged warning. With
debugon, it throwsMpdfAnnotationExceptioninstead.
- Only file types listed in
- A fixed creation date. The
creationDateconfig option sets the document's creation date, for reproducible output. #72
- Colour fonts are drawn in colour. Supported formats:
- Emoji. Emoji are found by the rules of UTS #51 (ZWJ sequences, flags, keycaps, skin tones and tag sequences) and drawn in a font that has them. #290
- Fonts without a GDEF table can be used with
useOTL. Most emoji fonts are like this. #290 - More OpenType lookups. Four contextual lookup formats that mPDF used to refuse are now applied, including coverage-based GSUB context substitution. #79 #82
- Unicode 18.0.0. The character, script, joining and emoji tables are generated from Unicode 18.0.0. Upstream's tables date from Unicode 6.1 and 6.2. The OpenType language system table is generated from HarfBuzz's. #103 #227 #261 #265 #273
- Rounded images. Images take CSS
border-radius, including per-corner, elliptical and percentage radii. The picture, its background and its border all follow the curve. #70 - Exif orientation. Set
useImageExifOrientationto turn JPEGs the way their ExifOrientationtag says, as browsers do. It is off by default.imageJpegQualitysets the quality of the re-encoded image. #35 #51
- Appearance streams. Every active form widget has its own appearance stream, so viewers draw the field as mPDF laid it out. #387
- CSS styling. Form fields take their CSS colour, background and border. Static fields draw them, and active fields use the border's width and style. #442 #469
- Static list boxes. A static list box is drawn as rows of options, with the selected rows highlighted. #446
break-before,break-afterandbreak-inside. They are read as theirpage-break-*equivalents:pageasalways,rectoandversoasrightandleft, andavoid-pageasavoid. Column and region breaks are not page breaks, so they are read asauto. #552 #569- Side margins on
:first,:leftand:rightpages. The:first,:leftand:rightpages of an@pagerule, named or not, can setmargin-leftandmargin-right. Text flowing from page to page is set in the page area of each page, and columns are laid out across it. A side margin on a pseudo page belongs to that side of the physical page, so it is not mirrored. #476 #510- Text beside a float, and the blocks around it, keep to the page area of each page the float runs over. #549
- A block with a set width keeps its place in each page area: a centred block stays centred, and a block pushed right by
margin-left: autoor set right to left stays against the right margin. #550 #551 #553
- An id written with classes. Selectors such as
p#note.warning,p.warning#note,#note.warningandp.a.b#notematch, on their own and as parts of descendant rules, in any order of id and classes. They are applied afterp#note. A selector with a class or id followed by something mPDF cannot match, such as.a:hoveror#note::before, is dropped like any other selector mPDF cannot match. #527 #568 - Child and sibling combinators, and structural pseudo-classes.
div > p,h1 + p,h1 ~ p, and:first-child,:nth-child(),:first-of-typeand:nth-of-type()on any element, are matched against the elements open around the one being styled. Rules using them were dropped before, so a document that has them changes. They are applied with the descendant rules, after them, in order of specificity and then of source order. mpdf/mpdf#7 mpdf/mpdf#318 #538 #620 - Descendant rules through inline elements. A descendant rule whose ancestor is an inline element, a block inside a table cell, or the
tbodya table leaves out, such asspan em, or.note bfor a<span class="note">, applies. mpdf/mpdf#830 #538 #621 - Attribute selectors and
:lang().[a],[a=v],[a~=v],[a|=v],[a^=v],[a$=v]and[a*=v], with theiandsflags, match as in HTML: case-insensitively for the attributes HTML lists as such, and case-sensitively for the rest.:lang()matches the language an element inherits, from an ancestor or from the<html>or<body>tag. mpdf/mpdf#134 mpdf/mpdf#1838 #538 #627 :not(),:is()and:where(). Each takes a selector list whose selectors may have combinators, such asp:not(.note, div > p)or:is(h2, h3) + p.:is()and:where()leave out a selector they cannot read, as browsers do.:not()and:is()weigh as their most specific argument, and:where()as nothing. Rules using them were dropped before. #538 #628- Pseudo-classes that look at what follows an element.
:last-child,:nth-last-child(),:only-child,:last-of-type,:nth-last-of-type(),:only-of-typeand:emptymatch in the flow, in tables, headers and footers, and positioned blocks. Rules using them were dropped before, so a document that has them changes. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep dropping them. #537 #634WriteHTML()reads ahead through the HTML it is given to count each element's children. An element still open at the end of a call that leaves it open is not known in full, so these do not match its children in that call, and nor does:not()of them.:emptymatches as in browsers: an element holding white space is not empty, and one holding only a comment is. A table cell holding only white space is empty, as mPDF strips it.
:root,html,:linkand:any-link, in standard mode.a:linkand:any-linkmatch a link with anhref. mPDF has nohtmlelement, sohtmland:rootmatch it as the parent ofbody: their rules reach the text as a parent's would, and rules forbodywin over them.:visited,:hover,:focus,:active,:focus-within,:focus-visibleand:targetnever match, as a PDF is never visited or hovered, so:not(:hover)always does. Rules using them were dropped before, so a document that has them changes. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep dropping them. #529 #642- The universal selector.
*matches every element: alone, with a class, an id, an attribute or a pseudo-class, on either side of a combinator, and inside:is(),:where()and:not(). It weighs nothing, so any rule naming a tag, class, id, attribute or pseudo-class beats it. It reacheshtmlandbodytoo, so* { color: … }colours text written straight into the body, and* { font-size: … }sets the sizeremis read against. Rules using it were dropped before, so a document that has them changes. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep dropping them. mpdf/mpdf#312 mpdf/mpdf#1168 mpdf/mpdf#1838 #530 #644- A reset such as
* { margin: 0; padding: 0 }now takes away the default margins of paragraphs, headings and lists, a list's indent and a cell's padding, as in a browser. It reaches the lines of the table of contents and the index as well, which are the document's elements, so their levels are no longer indented. Stylediv.mpdf_toc_level_1and the like to indent them again. - mPDF's own
<barcode>,<dottab>and<textcircle>are not HTML elements. A rule reaches them only by naming their tag, or an id or class they carry, so*, and:empty,[attr]or:not()alone, leave them as they are::empty { display: none }does not hide a barcode.
- A reset such as
- Font weights as numbers,
bolderandlighter, andfont-size: largerandsmaller. In the standard CSS mode,font-weighttakes a number from 1 to 1000, andbolderandlighterstep from the parent's weight by the table in CSS Fonts. The weight is inherited as a number, sobolderinsideboldergives 900 andlighterinside 700 gives 400, andh1 { font-weight: lighter }is regular, one step down from its parent's 400. A weight above 500 is drawn with the family's bold face and any other with its regular face.largerandsmallermultiply and divide the parent's size by 1.2. A form field reads them against the document's size, as it reads its other font sizes. Thefontshorthand's weight is read the same way. All of these were ignored before, so a document that has them changes. Set'cssMode' => \Mpdf\CssMode::LEGACYto read onlynormalandbold, as before. #545 #647
- Long documents of floats. Floats the layout has already passed are dropped, so each new row no longer rescans every earlier float. A 250-row grid of floats renders about four times faster. #9
- Chaining context fonts. A font with thousands of chaining context subtables shapes in a fraction of a second. Before, it never finished. #98
- OpenType subtables are decoded once per document instead of on every glyph they are offered, including GPOS context positioning and mark-to-base. #314 #323
- Ligatures and marks. Ligature and mark records are renumbered by walking the records instead of the whole run. #313
- Line measuring. Each character of a flowing block is measured once instead of being decoded again for its width. Each chunk of a line is measured once, and
count()calls are taken out of the layout loops. #312 #345 - Font substitution. A text token is split into all of its font substitution runs in one pass instead of one run per pass. #336
- CJK output. The subset fonts of a CJK document are written without rereading the font for each one. #311
- Image metadata. JPEG and PNG metadata is read from the file's structure instead of by scanning the whole file, and PNG chunks are read from a chunk index. #47 #48
- GD memory. GD asks for less memory when it re-encodes an image. #49
- nth-child rules in tables. Each row and cell looks up the nth-child rules the stylesheet uses by their keys, instead of running a regex over every rule. A 2,000-cell table under 1,000 rules is written in about 540 ms instead of 745 ms. Class combinations are built only up to the most classes one compound selector names, not one whole selector. #526 #580
- Selector matching. A chain of descendant combinators stops trying ancestors once none left can match, instead of trying every combination of them, and a general sibling combinator skips a tag the parent has no child of and looks from the first sibling.
.x div div div div div pis matched on a path 50 deep in well under a millisecond instead of 4 seconds, andh2 ~ pagainst 5,000 paragraphs after an<h2>in 20 ms instead of 5 seconds. #535 #631 - Finding
<style>and<link>. The stylesheets in the HTML are found in two passes, one before HTML comments are removed and one after, instead of up to six. The search for a tag also steps over up to 16 other tags in one attempt instead of starting again after each. On a 1 MB table with one<style>and one<link>, reading the stylesheets takes about 2.5 ms instead of 7.7 ms with PCRE's JIT, and 30 ms instead of 80 ms without it. #781 #800 - Line breaking and colours. A flowing block works out the width a line may take, after its text-indent, a dot tab's outdent and the floats beside it, once per line instead of once per character.
SetColor()keeps the operator it builds for each colour instead of formatting it each time a colour is set. A 57-page document of justified paragraphs renders about 10% faster, and pages of bordered boxes about 7%. #843 - Character ranges. Substitution reads which characters a backup font has from a small file instead of the font, so only the font it uses is loaded. Every font package ships them beside its fonts, mPDF writes one into the font cache for any other font the first time it builds its metrics, and
vendor/bin/mpdf-font-rangeswrites one for a font package of your own to ship. #827 - Packaged fonts. TrueType hinting is removed from the 51 packaged fonts whose licences allow it: Aboriginal Sans, Ayar, DejaVu, GNU FreeFont, Garuda, Khmer OS, Lohit Kannada, MPH 2B Damase, Pothana 2000, UnBatang and XB Riyaz. Those files are 10.94 MB (24.3%) smaller, and PDFs embedding them about 24% smaller, with the same outlines and metrics.
utils/dehint_fonts.pyholds the list. [#850] [#853]
page-break-inside: avoidnow moves the whole block to the next page when it does not fit. Its text, list numbers, floats, links, bookmarks, index and contents entries, form fields and annotations each appear once, on the page the block ends up on. A block that fits is laid out only once. #38 #43 #60 #63- A table with no background left the next table painted twice. #43
@page { size: A4 }, or asizeof two lengths with nomargin, gave 63 pages with one character on each. A page-size name such asA4,letterorA5 landscapenow sets the sheet, as a browser sets the paper, and the space around a page box given as two lengths is no longer counted twice. mpdf/mpdf#1220 #552 #562@page { size: landscape }, or a page box wider than it is tall, left the first page portrait, andsize: portraitleft a landscape document landscape. The first page now turns. A page box and percentage margins are measured on the turned sheet, sosize: 250mm 150mmon A4 is no longer cut to 210 mm wide. #552 #562page-break-before: autooravoidon a block inside another block closed the outer block and opened it again, so its border was drawn around each part.page-break-after: autooravoidon a table started a new page. #552 #569page-break-beforeon a table was ignored. On a top-level table,always,leftandrightnow start it on a new page, inside the blocks around it. #552 #622page-break-before: alwaysandpage-break-after: alwayson a table row were ignored; onlyavoidwas read. A row of a top-level table now starts a new page, with the header and footer rows repeated. A break before the first body row, on a header or footer row, or in a nested table is left to the table around it. A<tfoot>written before the<tbody>moved the rows' break markers onto the wrong rows. #552 #591 #690page-break-before: leftorrighton a table row started the next page, whatever its side. With mirrored margins the row now goes on to the next left or right page, leaving a blank page between where needed, with the header and footer rows on the page the row lands on.page-break-after: alwayson the last body row did nothing; it now starts a new page after the table, as the table's ownpage-break-afterdoes. #552 #700- A table with a
font-sizeand a row withtext-rotatethrew aTypeErroron PHP 8, and raised a warning before it. A cell whose font size was already in force saved its text with an empty size. #632 #631 - A border colour mPDF cannot read, such as
border-color: initialin the legacy CSS mode, raised "Trying to access array offset" warnings when the border was drawn. #546 #652 - An image with a
vertical-alignmPDF does not read, such as a length or, in the legacy CSS mode,inherit, raised undefined-key warnings. It now sits as if none were given. #546 #652 background-size: coverscaled by the wrong ratio when the image came out shorter than the area. mpdf/mpdf#833 #22- Only double-quoted attributes were read. Single-quoted, unquoted and bare attributes are now read as well. mpdf/mpdf#2030 #24
- A
>inside a quoted attribute value, such asstyle="font-family: 'a>b'",title="1 > 0"or a link to…?q=a>b, left the whole page blank withautoScriptToLangon, and was deleted from the value otherwise, along with any<. A quoted value is now read whole, as a browser reads it, and reaches the tag unchanged in eithercssMode, including in a tag that closes itself, where<input value="a > b">showeda /band a bookmark titleda > breada / b. A stray quote in an unquoted value, as in<img src=a.jpg" width="84">, no longer swallows the tags after it up to the next quote. #552 #745 #761 - A quoted attribute value holding
name=valuewas cut at the=:<bookmark content="Set x=1 first" />was titledSet x=, a text field showed the same, and a link whosetitleheldhref=lost its link. An apostrophe in an unquoted value, as intitle=don't, also ended it. Attribute values are now read as written, in eithercssMode. #771 #773 - An attribute ending in the name mPDF looked for was read in its place:
<htmlpageheader data-name="x" name="main">was registered asx, and a<body>took its style,dirorlangfromdata-style,data-dirordata-lang. A<meta>keywords, author or description holdingx=1was cut at the=, one single-quoted was not read, and a<title>holdinga=1gained quotes. These tags now read their attributes by name, quoted or not. #772 #774 - A
>inside a quoted attribute value still ended a tag that mPDF reads before drawing. A table whosesummaryheld one lost its caption and raised three warnings, and withuse_kwta heading whose title held one was not kept with its table. Text after atitle="draw <svg>"disappeared up to the next inline SVG, as did that SVG. An SVG in astyleattribute's data URI left')">drawn as text. The newlines of an annotation were joined after the>. An SVG text element with one in an attribute was drawn blank undersvgAutoFont. An index entry was split at a:inside a tag. A<pre>or<style>written inside another tag's value was taken for one, so a real<pre>after it lost its line breaks and an HTML comment after it was drawn. A custom element such as<svg-icon>was taken for an<svg>, and a<title>with attributes was not read. A<base>,<link>or<style>with one in an attribute was not read. The<base>,<html>,<link>and<style>tags now read their attributes by name, quoted or not, so adata-href,data-lang,data-dirordata-mediais no longer taken forhref,lang,dirormedia. #768 #776 - A
<title>in the<body>, in a table cell, in an HTML header, or in the<head>of HTML with no<body>tag was drawn as text where it stood. It is no longer drawn, as in a browser, and the first one still gives the document its title. #782 #787 - The caption of a table with another table in a cell was drawn inside that cell, after the inner table, under
caption-side: bottom. It is now drawn below the whole table. #780 #784 - A
<!--or<script>inside a quoted attribute value, such as atitle, hid everything after it up to the next real comment or script. A text field whose value held a comment,<br>,<wbr>,<dottab>, an empty<tr></tr>, a<table>with a<caption>or</tts><tts>showed it changed or emptied, and the caption was drawn as text after the field. Comments, scripts and the tags mPDF rewrites before reading the document are now found only outside tags. #777 #789 - A run of spaces inside a quoted attribute value was collapsed to one:
<bookmark content="Total: 42" />was titledTotal: 42, and a text field, index entry, annotation, watermark or title written with several spaces lost them. Spaces are now collapsed only between tags, so a value keeps them as written. #788 #797 - An end tag with a space, a newline or an attribute before its
>, such as</style >, did not end its element, though a browser reads it as</style>. The stylesheet was not applied and the text up to the next</style>was lost. An inline SVG was not drawn, or swallowed the content up to the next</svg>. A<title>was not read, or took in the markup up to the next</title>. A<pre>or<textarea>lost its line breaks, an empty<textarea>was not drawn, a table's<caption>was not drawn and raised three warnings, and an<htmlpageheader>or<htmlpagefooter>was drawn in the body and raised a warning. Withuse_kwt, a heading was not kept with its table, and withallow_charset_conversionthe charset of the<head>was not read. An SVG file ending</svg >was not recognised as an image, a gradient that borrowed the stops of one ending</linearGradient >was not drawn, and withlist_auto_modeset tompdfa nested list ending</ol >left room for its markers as if the items after it were its own. #802 #805 - A shadow colour written without spaces, such as
rgba(255,0,0,0.5), fell back to grey. Whitespace in shadows is now parsed as CSS writes it too. #25 - A border that draws nothing was described with fewer keys than one that draws, and the border code read the missing keys anyway. mpdf/mpdf#1892 #29
- A
<tr>border was read for sides the row did not set. mpdf/mpdf#1893 #30 - A
<li>with no list around it raised undefined-key warnings. It now gets the styles a list would have set. mpdf/mpdf#1890 #31 - A font size of zero divided by zero in the letter- and word-spacing calculations. mpdf/mpdf#1888 #32
- An empty
<textarea>lost the placeholder space it needs to be drawn. mpdf/mpdf#1735 #33 - A fixed-position block that shrinks to fit was drawn in the font the previous fixed-position block left behind. mpdf/mpdf#2174 #11
- Descendant rules such as
.box pdid not reach the content of an absolutely or fixed positioned.box. #474 #493 - Descendant rules naming a table, row or cell, such as
td imgortd span, matched nothing inside the cell. #223 #507 - A descendant rule with a part mPDF cannot parse was cut short at that part and applied to the element before it. Such rules are now dropped. #519
- An inline
stylewith!importantdrew no border for abordershorthand, dropped the bottom padding of a two-valuepadding, drew text at 0pt for afont-size, and ignored an image'sheightwith a warning. The flag is now removed, as it is from a stylesheet. mpdf/mpdf#1010 mpdf/mpdf#1707 #523 #561 - A declaration whose flag had a space after the bang, such as
margin: 5mm ! important, kept the flag in its value: that margin set the right and left margins to!and the bottom one toimportant, afont-sizewas lost, and aborderdrew nothing. The flag is now found whatever its spacing and case, in stylesheets and inline styles, in eithercssMode. #532 #638 - With
cssModestandard, an!importantdeclaration in a plain@pagerule lost to a plain one in a@page :first,:left,:rightor named page rule, so@page { margin-top: 30mm !important } @page :first { margin-top: 10mm }gave the first page a 10mm top margin. The important declaration now wins, as a named page's does over its own:first,:leftand:rightpages. Of two important declarations, the one in the rule applied later wins, as before, and the default stylesheet's (defaultCssFile) beats the document's. A plain@pageside margin is still mirrored, so on a left page an importantmargin-leftis the right margin, and beats themargin-rightof a:leftrule. Legacy mode is unchanged. #532 #640 #679 - Text styled with the
fontshorthand or<font face>came out as empty boxes when the family was not installed or had a space in its name, such asfont: 12pt Robotoorfont: 16px "DejaVu Sans Mono". It was drawn in the first registered font, which is the emoji font in a full install. The family is now read asfont-familyreads it: a name is kept whole, the list is tried in order, and when mPDF knows none of it the text keeps the family it inherits.font-familyitself also reads an unquoted name with spaces whole. #552 #560 - A descendant rule ending in
:lang()or[lang], such asdiv :lang(fr),div p:lang(fr)ortable [lang=fr], never applied. It now applies in block content and in tables, and a regional language such asfr-CAfalls back to the rule forfr, as the simple lang rules do. #525 #559 - A rule such as
td:nth-child(2):not(.x)ortd:nth-child(2 of .x)was applied to the second cell of every row, as if it weretd:nth-child(2). A rule with anything after an nth-child argument, or with an argument that is not a formula, is now dropped. mpdf/mpdf#83 #522 #564 rgb()andhsl()written with spaces, such ascolor: rgb(255 0 0), threw aTypeErrorout ofWriteHTML(), or drew the wrong colour with warnings. They are now read, with a slash before the alpha (rgb(255 0 0 / 50%)) and with the hue indeg,grad,radorturn. #552 #563- A percentage alpha, as in
rgba(255, 0, 0, 50%), gave an opacity above 1, which viewers draw opaque. - A fourth argument to
rgb()orhsl()is read as the alpha instead of being dropped. border-color: rgb(255, 0, 0)orcmyk(0, 100, 0, 0), with spaces after the commas, drew black.
- A percentage alpha, as in
- A declaration mPDF cannot read replaced the value before it. A
calc(),min(),max(),clamp()orvar()length became 0, somargin: calc(…)removed the default margins, and a colour mPDF does not know, or one written withvar(), drew the text black. Such a declaration is now dropped, as a browser drops it, so the earlier declaration, the default or the inherited value applies. #552 #565 vw,vh,vmin,vmax,Qandchwere read as pixels,+5mmand1e+1mmas 0, and1,5mmas 1mm. The units are now resolved against the page and the font size, the numbers are read, and1,5mmis dropped. #552 #565line-height: 0gave lines a normal height. Lines now have no height, as in a browser. A line height well below the font size, such as0.5or1mm, was stretched down to the baseline; it is now kept. A negativeline-height, which shrank lines to odd heights, is now ignored. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep the old reading of all three. #552 #567 #643- The rule after an
@supports,@layer,@keyframes,@containeror other block at-rule was lost, and so were the rules inside@supportsand@layer. The rule after@charset,@namespaceor@importwas lost too.@supportsand@layerblocks are now unwrapped as@mediablocks are, except@supports not, and other at-rules are removed whole. #524 #566 @mediawas matched by looking for the wordprint, so@media not printapplied,orientationwas ignored andmin-widthnever matched. Media queries are now evaluated for the print medium against the page current when the stylesheet is read: media types withnotandonly;and,orandnotconditions; andwidth,heightandorientation, withmin-/max-prefixes and range syntax such as(width >= 600px). An A4 page is about 794px wide, so@media (min-width: 768px)rules now apply to it. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep matching by the wordprintorall. #552 #575 #643@importignored its media list, and did not load a URL that does not end in.css, such as a Google Fonts stylesheet. Legacy mode loads them as before, except that in either mode an@importis read only from<style>blocks and stylesheets, not from the body text. #552 #575 #643- A brace, semicolon or comment marker inside a quoted string, an unquoted
url()or an escape broke the stylesheet around it.q { quotes: "}" }lost the rule after it,font-family: 'a;color:red'set the colour, a/*in one string and a*/in a later one removed every rule between them, and@import url(…?family=Inter:wght@300;400)lost the rule after it. A rule or at-rule nested in a block, as CSS nesting writes them, lost the rest of the block and the rule after it. Stylesheets are now split by a tokenizer that reads strings,url(), escapes and comments as CSS does, in eithercssMode. A rule or at-rule nested in a block is left out, and the declarations after it apply. #536 #635- A string left open ends at the line break, as in CSS. A block or comment left open ends with its
<style>or stylesheet file instead of running into the next one. - A byte order mark at the start of a stylesheet, as
WriteHTML(file_get_contents('style.css'), HTMLParserMode::HEADER_CSS)passes one on, no longer spoils the first rule. - An
@importis loaded only from the stylesheet's own rules, not from a comment, a string or a block. - A
styleattribute is split the same way, sostyle="font-family: 'a;b', serif; color: red"applies both, and a value may run over several lines.
- A string left open ends at the line break, as in CSS. A block or comment left open ends with its
- An HTML comment between two words drew a space:
Book<!-- x -->keeperread "Book keeper", and<p><!-- x --></p>held a space. A comment now leaves nothing in its place, as in a browser and asHTMLParserMode::HTML_BODYalready had it, in eithercssMode. A document that relied on the space can put one next to the comment. #636 #637- In the default parser mode, a
<!--inside a<script>, as invar s = "<!--", drew part of the script and lost the text up to the end of the next comment. - In
HTMLParserMode::HTML_BODY, a<script>tag inside a comment lost the text up to the next script's end.
- In the default parser mode, a
td:nth-child()andth:nth-child()counted grid columns, so acolspanorrowspanbefore a cell made the rule miss it and reach the cell after. They now count the cells of the row.:first-childon atr,tdorthnow works, as:nth-child(1). #528 #572- Some colour values were read wrongly. #552 #570
#rgbawas read from the wrong digits:#f008drewrgb(240, 8, 0).#rrggbbaadropped its alpha. Both are now read with their alpha.- A channel outside its range wrapped instead of being clamped:
rgb(255.5, 0, 0)drew black andrgb(300, 0, 0)dark red. Channels, alphas, andhsl()saturation and lightness are now clamped, as CSS does. rebeccapurplewas missing. mPDF'svioletred, which is not a CSS colour, is kept.
- A
list-style-imagewhose URL had capitals, such asurl(img/List-Bullet.png), drew no marker on a case-sensitive disk or server, because the URL was lowercased before the image was fetched. The URL now keeps its case. #552 #623 - The
bordershorthand drew nothing when its parts came in some orders, such asborder: solid #c00 2mm,2mm #c00 solidorred 2mm solid. The width, style and colour ofborderand of each side are now read in any order. #552 #583- A lone colour, as in
border-top: #f00, was read as the width.
- A lone colour, as in
- The
backgroundshorthand lost a colour written afterurl()and misplaced the image, and lost a size after the position (center / cover). Its colour, image, position and size, repeat, attachment, and origin and clip boxes are now read in any order. #552 #583- With several layers, mPDF still draws only the first, now over the colour given in the last.
- A
borderorbackgroundshorthand with a part that is none of its parts, such asborder: 1px solid bogus, is dropped, as a browser drops it, so the value it would have replaced still applies.border: 1px solid bogusused to draw a black border. #552 #583 tr:nth-child()counted the rows of the whole table less its header and footer rows, so a second<tbody>carried on the count of the first, andtr:first-childmissed the first footer row when<tfoot>came after the body. Rows are now counted within their<thead>,<tbody>or<tfoot>, or within the run of rows written straight into the table. #528 #582- Under the legacy
cssMode, a table cell, row or row group whose end tag was left out passed the descendant rules it matched on to the parts after it. Withtr:nth-child(2) td { color: red }, every row after the second of<tr><td>A<tr><td>B<tr><td>Cwas red too, and a.totals tdrule for a<tbody class="totals">with no</tbody>coloured the next row group's cells. A<td>or<tr>now closes the open cell and row, and a<thead>,<tbody>or<tfoot>the open row group, whether the table is written straight into the body or into a block, and whether or not the cell holds a block such as a<p>. A</table>closes a row group left open too, which in a nested table let its rules reach the outer table's rows. In both modes, the rows after the first of a<thead>written without end tags inside a block were left out of the header that repeats on each page. #630 #682 currentColorin a border raised two "Uninitialized string offset" warnings for each side and drew it black, and intext-outlineit raised an undefined-key warning and drew black. Both are now drawn in the element's colour, set or inherited. #540 #651- Colours that convert to nothing were drawn black or grey instead of drawing nothing. #552 #540 #651
- A
transparentside of a border, as in Bootstrap'sborder: 1px solid transparent, was drawn black, with warnings on a block. It now takes its width and draws nothing, on blocks, inline elements, table cells and images. border-style: hiddenon a block or an image drew a black hairline, with warnings.color: transparentdrew black text. The text is now laid out and written in the invisible text rendering mode, so it takes its place and can be selected but is not seen. Itstext-shadowis still drawn.- A
box-shadowortext-shadowintransparentwas grey. It is no longer drawn.
- A
font: small-caps 14pt serifdrew the text in full-size capitals, astext-transform: uppercasedoes. It is now drawn in small capitals, asfont-variant: small-capsdraws it. Thefontshorthand also kept aline-heightand afont-variantit inherited; like the style and weight, in standard mode they are now reset tonormalwhen the shorthand does not name them, as in a browser. To keep a line height, give it in the shorthand, as infont: 14pt/1.5 serif, or declareline-heightafter it. Afontshorthand with a negative line height, such asfont: 12pt/-1 serif, is dropped whole.font-variant: normalnow resetsfont-variant-positionas well. #552 #581- A percentage
width,min-widthormax-widthon an image in a table cell was resolved against the block around the table, not the cell. In a 60mm cell,max-width: 20%came out as 36mm. #223 #505 - An
@page :leftor@page :rightrule was ignored unless the style sheet also had a plain@pagerule. With one, the margins of a:rightrule were applied to left pages too. #555 #556 - When a later
WriteHTML()call turned the document right to left, the text on the page already started was set between the swapped side margins. That page now keeps its margins, and the swap starts with the next page. #554 #558 - Balancing columns raised a warning and drew a block's closing background past the last column. #475 #488
- Inside
<columns>, a block with anrgba()orcmyka()background was painted fully opaque. #482 #498 - A table with a background on the table, a row or a cell, drawn first in a
<columns>column, raised an "Undefined array key" warning. #552 #743 - Inside
<columns>, a block with a border and no background raisedUndefined array key "bgcolorarray"warnings when it held a table, one for each row and repeated header, or a block with anrgba()background, one for each line. A block whose background sets no colour, such asbackground-color: transparentorbackground: none, raised one inside any block with no background. #552 #748 - In a UTF-8 document, CSS naming
chelvetica,ctimesorccourierdid not draw in the core font. #467 #468 - The U+200B the line breaker inserts was drawn. #28
- A zero-width space was drawn, and gave no line break, in core fonts and in text written outside
WriteHTML(). #463 #503 - When a hyphenation hyphen moved to the next line, its record stayed on the line before. In a bidi paragraph that drew a hyphen in the wrong place and dropped the one that moved. mpdf/mpdf#1831 #145
- A hyphen inserted at a line break had no bidi direction. It now takes the direction of the word it breaks. #116 #137
$extgstateshad no default, socount()on it threw aTypeErroron PHP 8. mpdf/mpdf#2135 #20rotate: 90degon a positioned block turned it on PHP 5.6 to 7.4 but not on PHP 8, where"90deg" == 90is false. The angle is now read as tables read it: whole degrees, with or withoutdeg, so270degturns the block as-90does. A positioned block also takes180degas it takes180. #579background-sizelengths such as60mmor100pxdrew the image 2.83 times too small, because they were used as points. #574- A stylesheet
url()did not load its image when the path had spaces or parentheses, when there was whitespace inside the parentheses, or when it was an SVG data URI that is not base64, such as Bootstrap'sform-selectarrow. #573 linear-gradient(to bottom, …)andto topwere drawn upside down, and so was the vertical half ofto bottom rightand the other corners. Angles ran counter-clockwise from pointing right, so90degdrew bottom to top. A gradient now runs as CSS Images gives:0degpoints up and angles turn clockwise,turnis read, and a corner keyword leaves the other two corners halfway along.-moz-,-webkit-and-o-gradients keep their legacy angles, and their side keyword, such asleft, names the side the gradient starts from. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep the directions mPDF v7 drew, prefixed or not. #577 #639linear-gradient(red 0, blue),radial-gradient(red 0, blue)andrepeating-radial-gradient(red 0, blue 10px)drew solid blue. A first colour stop whose position is a unitless0was taken for the gradient's angle and dropped. The first argument is now a stop whenever it starts with a colour; a bare0is still the angle. #552 #584 #689radial-gradient(at 10px 0, red, blue)and-moz-radial-gradient(10px 0, red, blue)were centred halfway down the box instead of on its top edge, and-moz-linear-gradient(10px 0, red, blue)ran straight across from halfway down. A unitless0in a position was not read as a coordinate, and a linear gradient took it for the angle 0;radial-gradient()also tookatfor the first coordinate. A0beside another word of the position is now its coordinate, a bare0is still the angle, and the words afteratare the position, in both CSS modes. #552 #707linear-gradient(to right, red 12.5%, blue 50%)held red only to 5%, andradial-gradient(12.5% 50%, circle, red, blue)was centred 5% across. A percentage with a fraction was read from the digits after the point. A stop or position of0px, or any zero length, was dropped as if not written, soradial-gradient(0px 0px, circle, red, blue)was centred andlinear-gradient(10px 0px, red, blue)started halfway down.linear-gradient(to right, red 50%, blue 0%)drew a solid blue box, and a stop placed before an earlier one in the middle of the list was moved halfway between its neighbours. A stop placed before an earlier one now moves up to it, as CSS Images does, so the colours meet in a hard edge, in both CSS modes. A repeating gradient whose stops all sit at one position, such asrepeating-linear-gradient(red 0%, blue 0%), ran PHP out of memory; it is now a solid fill of the average colour, as in a browser. #552 #738- In a table with collapsed borders, a row with a
border-colorand no border style, or a border of no width, took the borders of its cells away. A reset such as* { border-color: #dee2e6 }or* { border: 0 solid }gives every row a border like that. A row border that draws nothing now leaves the cells' borders;hiddenstill takes them away. A row'sborder-toporborder-bottomwas drawn only when the row also setborder-left; each side is now drawn on its own. #644 - Characters mPDF moved into a substitute font (
useSubstitutions, and the fonts for supplementary planes) were wrapped in a<span>that stylesheet rules reached, sospan { border: 1px solid }drew a box around them, and the span counted among its siblings for:nth-child(). In the standard CSS mode no rule reaches that span and it is not counted, as a browser has no such element. The legacy mode styles it as before. #634 - Some inherited properties stopped short of where a browser takes them. A
text-shadowdid not reach a block's child blocks or list items.word-spacing,hyphensandtext-outlinedid not reach the content of a positioned block.text-transform,text-shadow,font-variantand the other font features did not reach a table's cells. A table nested in a cell took none of the cell's colour, font, size, weight, style, transform or shadow. Each of these channels now carries every inherited property mPDF supports, from the one list inMpdf\Css\InheritedProperties. Under the standardcssModeonly; set'cssMode' => \Mpdf\CssMode::LEGACYto keep the old output. #539 #648 text-transform: noneon an inline element, such as a<span>in an uppercase paragraph, did not undo the transform it inherits. Under the standardcssModeonly; set'cssMode' => \Mpdf\CssMode::LEGACYto keep the transform. #552 #539 #648- A block inside an inline element, such as
<span class="note">…<div>…</div>…</span>or a card written as<a href="…"><div>…</div></a>, lost the inline element's colour, font and other inherited text properties, and so did the inline element's text after the block. A link lost its colour and underline on the block's text and did not cover it. In a table cell the block kept the style, but the text after the inline element did too. A block now inherits the text properties of the inline elements it opens in, and the text after it is drawn in their style until they end. Text before the inline element, on the line before the block, is no longer drawn in the inline element's colour or covered by its link. Under the standardcssModeonly; set'cssMode' => \Mpdf\CssMode::LEGACYto keep the old output. #541 #653 - Styling a table row or row group, such as
tr.total { font-weight: bold }or<thead style="color: #fff">, did not change the text of its cells, only their background. Atr,thead,tbodyortfootnow hands every inherited property to its cells, over the table's and under the cell's own, and atbodyrule reaches the rows written straight into a table. A row'sfont-size: 80%is taken of its row group's size, and a cell's of its row's. A row'scurrentColoris its row group's colour, and a cell's is its row's. Athstays bold, and is centred only when it inherits notext-alignfrom its row, row group or table, as HTML's rendering rules have it. Under the standardcssModeonly; set'cssMode' => \Mpdf\CssMode::LEGACYto keep the old output. #542 #655 text-outline-widthwith notext-outline-colorraised an undefined-key warning (outline-COLOR) and drew the outline black. The warning is gone in eithercssMode. In standard mode the outline is now drawn in the colour of the text, astext-outline-coloriscurrentColorby default, andtext-outlinewith a width alone, such astext-outline: 0.2mm, which was ignored, outlines the text in its colour too. A text outline incurrentColor, written or by default, is passed on as the keyword, so a<span>of another colour inside the outlined text is outlined in its own colour. Set'cssMode' => \Mpdf\CssMode::LEGACYto keep black outlines and to ignore that shorthand. #552 #650 #681- A percentage
border-radiuson a block, such asborder-radius: 50%on a box 40 mm by 12 mm, drew a pill instead of an ellipse. Both radii were taken of the width of the block around it, and then shrunk to fit. A percentage is now of the block's own border box, as in CSS: a horizontal radius of its width and a vertical one of its height, so50%draws an ellipse and10%a corner a tenth of each side. A block split across pages resolves a vertical percentage against the height of the part on each page. In bothcssModes. #552 #586 list-style: U+2022, the shorthand, numbered the list wherelist-style-type: U+2022drew a bullet. The shorthand dropped theU+from the marker it set. It now keeps it, so the shorthand draws the character as the longhand does, in eithercssMode. #552 #746 #755text-decoration: overlinewas drawn heavier than an underline on the same text, 2.4 pt against 1.76 pt at 40pt in DejaVu Serif Condensed. The overline is now as thick as the font's underline, sits at the font's cap height rather than a fixed 700/1000 em, and in a table shrunk to fit is thinned and placed with its text. In eithercssMode. #741- A fixed or absolutely positioned block with a
margin-topand notop, such asbottom: 10mm; height: 30mm; margin-top: 20mm, was drawn taller by its top margin, and one with atop, aheightand amargin-topgrew by its top margin less its bottom margin. Its top margin was counted twice when the top, height or bottom was worked out from the others, and its bottom margin not at all. Each margin now counts once, somargin-topmoves the box without stretching it. In bothcssModes. #552 #737 - A positioned block with different left and right margins was placed or sized by its left margin twice.
position: absolute; left: 10mm; right: 20mm; width: 100mm; margin-left: 5mm; margin-right: 30mmdrew a box 75 mm wide, andright: 20mm; width: 100mmwith the same margins put it 25 mm too far right. The CSS 2.1 width algorithm now takes each margin on its own side. In bothcssModes. #552 #701 - With
autoPaddingon, a block with a percentageborder-radius, such as50%, got no padding, so its text ran over the curve of the corners. A percentage now adds padding as a length does. The horizontal radius is taken of the block's border-box width when the block opens, and so is the vertical one, as an estimate: the block's height is not known until it closes, and depends on the padding being set. So50%on a block 40 mm wide pads as20mmwould, whatever the block's height, and50% / 10%as20mm / 4mm. The corners are still drawn against the block's real width and height. Any rounded corner, of a length or a percentage, is now padded less: the corner of the text is put on the curve where it runs at 45 degrees, which adds the least padding. A20mmradius on every corner pads 5.86 mm on each side, where it padded 8.45 mm on the left and top, and a flat20mm / 4mmcorner pads 0.39 mm across and 3.22 mm down, where it padded 8.45 mm across. In bothcssModes. #552 #702 - An image, barcode, form input,
<dottab>,<hr>,<meter>or<textcircle>straight after a U+FEFF that left no text was not drawn, with no error. A PHP template saved as UTF-8 with a byte order mark and rendered after a<style>block hits this. A<br>in the same place was lost too, so the next text sat a line too high. #870 - A document or text starting with a byte order mark threw "HTML contains invalid UTF-8 character(s)" on newer versions of PHP (seen on 8.2 to 8.5, not 7.4). The mark is valid UTF-8 and is dropped. U+FEFF elsewhere in the text of a core font, or of a direct call such as
WriteCell()orMultiCell(), no longer draws a question mark or a missing glyph either.Write()andCell()do not validate their text and still draw it. #870 WriteHTML()never returned for HTML ending in a cut-off UTF-8 sequence, such as<p>\xE2, or holding a lead byte above\xF4at its end. With an error handler that returns true, most other invalid UTF-8 hung as well. All invalid UTF-8 now logs the bad bytes, replaces them and carries on, or withdebugon throwsMpdfExceptionwithInvalid input characters. Did you set $mpdf->charset_in properly?. The messageHTML contains invalid UTF-8 character(s). See log for further detailsis gone. #873
- A greyscale PNG read more
tRNSsamples than it has. mpdf/mpdf#1927 #27 transform: scaleX()andscaleY()flattened the image on the other axis. mpdf/mpdf#1089 #37- An SVG image resolved its variable name instead of the path it points at. mpdf/mpdf#1384 #40
- An embedded SVG lost its
class, so class rules no longer styled it. mpdf/mpdf#1405 #41 - An inline SVG the XML parser could not read, for example one with an unquoted attribute, divided by zero. It is now reported. #44
- A GD decode could run out of memory on an image whose header claims a huge size. The claimed size is now checked against
memory_limitfirst. #50 - A second transformed image with the same border drew that border in the PDF default width and colour. #75
- An image with both a
rotateattribute and a CSStransformturned about the wrong centre and sat off its own border. #70 - An SVG
rgba()orcmyka()fill, stroke orstop-colorlost its alpha. #395 #420 - SVG text lost the alpha of its
rgba()orcmyka()fill or stroke. #427 #486 - SVG text after a nested
<tspan>was not drawn. #288 - 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
/SMaskpointed 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
<textcircle>with nofont-sizefrom its tag or the CSS raised threeUndefined 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 - An inline SVG's
<title>became the PDF's title when the document had none, or when the SVG came before the document's own<title>. Only a<title>outside any<svg>now titles the document. #779 #783 - An inline SVG holding another
<svg>was cut at the inner</svg>: what followed it in the outer SVG was not drawn. #780 #784 - An SVG
<use>,<tref>or gradientxlink:hrefdrew nothing when another of its attributes held a>, as indata-note="a > b", and an element with adata-idwas taken for the one whoseidwas named. References are now found by theidattribute alone, and a<use>'sxandymove it after its owntransformrather than being added to atranslate()in it. An element named like<markers>or<patterns>, or an empty<marker/>or<pattern/>, was dropped with everything up to the next</marker>or</pattern>. An SVG that is not well-formed is still drawn as far as it can be read, but now logs a warning, or throws underdebugorshowImageErrors. #778 #791 - An SVG
<use>of a<g>holding another<g>drew only what came before the inner</g>, and left the markup after it unbalanced. The referenced element now ends at the end tag that closes it, however deeply elements of its name nest inside it. #790 #796 - An
<svg>nested in an SVG ignored itsx,y,widthandheight, and itsviewBoxrescaled the whole outer SVG, changing the picture's size. It now sets up a viewport of its own: moved byxandy, clipped to its size unlessoverflowisvisible, with itsviewBoxfitted in aspreserveAspectRatiosays. #785 #793 - An SVG whose
widthandheightwere not the shape of itsviewBoxcame out theviewBox's shape, sized fromwidthalone: a 200×100 SVG withviewBox="0 0 10 10"was drawn 200×200. It now takes itswidthandheight, with theviewBoxfitted in aspreserveAspectRatiosays. #792 #799
- A
<select>with a baredisabledattribute was not disabled. #429 font-size: largerorsmalleron an<input>,<select>,<textarea>or<textcircle>drew its text at 0pt, so it could not be seen. In the legacy CSS mode the value is now ignored and the element keeps the size around it; in the standard mode it is 1.2 times the size of the element it is in, or that divided by 1.2. #545 #647- A button with no
nameraised warnings underuseActiveForms. Unnamed buttons are now namedSubmit_<n>,Reset_<n>orButton_<n>. #438 - Text wider than its field was cut off. It is now drawn in a smaller font, both on the page and in an active field's appearance. #433 #441
- A shaped value too long for its field is cut to the longest start that fits, and only between whole clusters. #460 #492
- In an active widget's appearance, Arabic did not join, right-to-left values were in logical order and Thai and Indic marks were not positioned. The text is now shaped and ordered as page text is. #408 #448
- A list box's last row ran past its border, and a one-row box could show the top of the next option. #426 #444
- A static select's drop-down arrow is drawn as a triangle, not a ZapfDingbats glyph. #454 #490
- An active button with
value=""showed its field name as its caption. It is now blank, as it is in a browser. #459 #489 - An active field in a fixed-position block that shrinks to fit kept its unscaled appearance, so it clipped its value and changed size when clicked. #457 #487
- Push buttons that share a name are written as one field, with each widget as a kid. #447
- Each radio widget wrote
/APtwice. Radio groups and same-named push buttons are now one field that their widgets inherit from. #450 #500 - A linefeed in a text field's value was drawn as a space, so
value="x(newline)y"showedx y, and one written as was drawn as a missing-glyph box. A text, search, email, URL, tel or password field, or one of any type mPDF draws as text, now drops the linefeeds and carriage returns in its value, as a browser does, on the page and in an active field. A hidden field, checkbox, radio, button and<textarea>are unchanged. #794 #798
- A link was treated as external only if its address had a dot, so a link to
http://localhost/was not. Links are now classed by their scheme. #8 - Internal links had no usable
/Borderentry, so poppler-based viewers such as Evince and Okular drew a box around each one. #68 #69 - Annotations in an HTML header or footer were lost. They are now written on each page the header or footer is drawn on. #410 #418
- With
forcePortraitHeaders, a link in a rotated header or footer sat about 110mm away from its text. #428 - An annotation's file given as a Windows path was named after the whole path instead of the file name.
- A file attachment that is not allowed reserved more object numbers than it wrote. #343 #356
SetAssociatedFiles()raised warnings when the optionaldescription,mimeorAFRelationshipkeys were left out. #328- In an encrypted document, an imported page used on several pages had its link strings encrypted again on each use, so they read as garbage from the second page on. #335
- The table of contents look-ahead deep-cloned the whole document. It now saves and restores a state snapshot instead. mpdf/mpdf#2207 #13
- With a table of contents at the front, index page numbers were counted from before the table moved into place. #56 #64
- An index entry with a run of three or more pages followed by a later page printed only the later page: pages 1, 2, 3 and 5 came out as
5. #66 #67 - Index entries whose keys collate the same, such as
Termandterm, came out in a different order on PHP 7 and PHP 8. They now keep the order they were made in. #74 - With a
toc-page-selector, a long index and whatever followed it were laid out in the table of contents'@pagemargins, header and footer. #856 - An SVG with a gradient or opacity came out blank when first drawn in the table of contents, or in a
page-break-inside: avoidblock that moved to the next page. The same SVG drawn later in the body after an index was blank too. #857 - A spot colour first used in the table of contents, or in a
page-break-inside: avoidblock that moved to the next page, was left undefined. After an index, the contents could print in the ink of a spot colour the body went on to use. #857 - A
<style>intoc-preHTMLalso applied to whatever followed an index, as well as to the table of contents. #857 - A colour or image PDF/A or PDF/X does not allow went unreported when first used in the table of contents or in a
page-break-inside: avoidblock that moved to the next page, so the document was output instead of refused. #857
- A PDF/A-1b document could carry fonts, SVG opacity, shadow blur and annotation colours that PDF/A-1 forbids. #346 #361
- Under PDF/A-1b, SVG gradient stops are painted opaque, and only the visibility groups the catalog lists are written. #346 #351 #386
- An annotation lost its subject under PDF/A-2 and PDF/A-3. #350 #357
- A PDF/A-3 annotation's file was not written as an associated file, so veraPDF rejected it. #347 #358
PDFAautoandPDFXautonow leave out screen-only content, and hidden content that the standard cannot hold. #397 #416- A PDF/A document with
restrictColorSpace => 3and noICCProfileembedded the sRGB profile with/N 4and wrote CMYK colours, which fails PDF/A. The output intent profile is now checked against what PDF/A permits,/Nis read from the profile and a suitable bundled profile is embedded underPDFAauto. #449 #499
- The file header kept the PDF version set at the start, even when later features raised it. #339 #378
/PageModecould appear more than once in the catalog. mpdf/mpdf#2142 #17- Every CID font carried a ToUnicode CMap whose single range mapped the whole two-byte space. #344 #362
- A subset's ToUnicode map put more than 100 entries in one block. Readers that enforce the limit lost text extraction, copy and search past that point. #363 #365
- Writing an SVG background pattern read keys that only used fonts have from fonts the document loaded but never used. #19
OverWrite()returned a document it could not read unchanged. It now refuses it. mpdf/mpdf#747 #42OverWrite()assumed every content stream was compressed the way the current instance compresses. It now reads each stream's compression from the document. #52 #53- In a core-font document,
OverWrite()did not find search text with characters outside ASCII, or with(,)or\. #464 #485 - An EAN or UPC code longer than the symbol holds is refused. mpdf/mpdf#1334 #39
- A
<title>or<meta>written inside a<script>,<style>,<textarea>or HTML comment was read as the document's own: it became the PDF's title in place of the real<title>after it, or set its author, subject or keywords. These hold text, not elements, as they do in a browser. #786 #795 - Passing a class that only implements
AssetFetcherInterfacethrough the container asassetFetcherthrew aTypeErrorwhileMpdfwas constructed. OnlyAssetFetcheror a subclass of it was accepted. #858
- Two processes creating the cache directory at the same time could fail. mpdf/mpdf#1775 #224
- A cache file another process removed raised a warning. mpdf/mpdf#1368 #236
- A cache entry that expired between the check and the read was drawn with as
false. It is now regenerated. #231 #246 - The right-to-left form table was sorted differently on different PHP versions, so the same font gave different cache files. #248 #249
AddFont()read back stale metrics when it regenerated a font in the same process. #290
MarkGlyphSetswas not read from GDEF 1.3 and was read from the wrong offset, andUseMarkFilteringSetdid not follow the specification. #1 #14 #26- A subset's cmap could write a
glyphIdArraythatidRangeOffsetcannot reach, and counted its length in entries instead of bytes. #151 #158 #165 - A format 6 cmap subtable too long for its uint16 length field is left out. #164 #169
- A subset's
maxpprofile was not recalculated when it kept a simple or empty glyph. #173 #197 - A subset's
headbounds andhheaextremes came from the whole font instead of the glyphs it keeps. #179 #184 - The font file stayed open when building a subset or a repackaged font threw, or when
getCTGorgetTTCFontsreturned early. #168 #180 #182 #183 - The character count header could overflow the two bytes that hold it. #127 #134
- Font names outside ASCII were garbled because they were read one byte per character instead of as UTF-16. #238 #241
- The synthetic Myanmar font kept the Reserved name of the font it was made from. #237 #239
- Since mPDF 7.1.8, the
Ascent,DescentandLeadingoverrides infontdatahad no effect, andTTCfontIDalways picked the first font of a collection. #321 #322 - Font substitution moved characters the document font has into the backup font. A space between two emoji was drawn in the emoji font and left an emoji-sized gap. #303
- A backup font that the substitution scan tried and rejected was still added to the document, so the same document gave different bytes with a cold and a warm font cache. #315 #318 #342 #381
- Text in a core font such as
chelveticathat the core font cannot draw, like Cyrillic, came out as question marks the first time its backup font was used with nothing of that font in the font cache. With more than one backup font it went to a later one instead. Rendering again worked. #829 - A run of Plane 2 characters next to a newline was not moved into its SIP font, and text after the newline could be dropped. #411
- A CJK Extension E or later character, or a Plane 3 character in a document that also had a Plane 2 character, was moved into Sun-ExtB, which lacks it, and drawn as Sun-ExtB's missing-character box. Sun-ExtB was loaded for it, and the other backup fonts were never tried. This happened with or without
useSubstitutionsin text set in Sun-ExtA, or in any font whosesip-extfont is Sun-ExtB. Now a character above U+1FFFF goes to the SIP font only where that font has it, and is otherwise offered to the backup fonts like any other. WithuseSubstitutionson, text in such a font is substituted in one pass: the text ahead of a Plane 2 character, which used to be skipped, is substituted too, and a Plane 2 character the font has itself stays in it. #837 haskernGPOSwas read for core fonts, which have no GPOS. #141 #149- Core-font text is held in Windows-1252 but was decoded as UTF-8 when given bidi data, which dropped some bytes such as a lone
0xA0. #383 - debugfont mode read the wrong byte offsets in
hhea,postandmaxp. mpdf/mpdf#2053 #23 - Sun-ExtA and Sun-ExtB could not be loaded as web fonts: Chromium and Firefox rejected both for their malformed vertical metrics.
vhea,vmtx,VORGand Sun-ExtB's staleDSIGare removed, as are the substitutions in Sun-ExtA's GSUB that name glyphs it does not have. PDFs using them look the same. #881
- A GPOS feature with no lookups, such as Myriad Pro's old
sizefeature, raised a notice while the font cache was built. mpdf/mpdf#1967 #10 MultiCell()with a blank string raised warnings when slicing its OTL data. mpdf/mpdf#2197 #15- The first
font-variant-position: superorsubin a document raised an undefined-key warning. mpdf/mpdf#2136 #16 font-feature-settingscould not turn off the features a script's shaper applies itself, such asblwf,pref,halforrphf. It now can, at the stage the shaper applies them, as in HarfBuzz. #384- The
kernfeature was appended to a run's empty feature set instead of being set on it. #157 - Text straight after a block in a table cell lost its kerning and mark positions, and in some fonts, such as XB Riyaz, its glyphs came out in the wrong order. It now draws as it does alone in a cell. #872
- Text was kerned twice, drawing its pairs too close, when it followed text with no GPOS kerning of its own in a font that also has a
kerntable. #872 - A character added to Unicode since 6.1 was read as unassigned. #99 #101 #103
- The
langattribute now selects the language system HarfBuzz would for variant, script, region and extended language subtags. That includes ZHH, ZHS, ZHT and ZHTM for Chinese. #191 #201 #206 #218 #220 #221
- Arabic letters that a font's
ccmpsplits into a base and dots, as Noto Sans Arabic does for beh, lost their joining. Joining is now worked out from the characters as written, beforeloclandccmp. #209 #226 - A letter did not join to the base before it when more than one mark sat between them. #161
- A mark took its form from the mark after it instead of from the letters around it. #163
- A joining form the font writes as several glyphs was drawn as one. #115 #125
- A final form made of several glyphs was matched as a whole in the kashida rules instead of by its first glyph. #126 #135
- An Arabic form's plain context rule was given a backtrack or lookahead. #189 #215
- An Arabic form's context walk ran past the edge of the run. #204 #219
- Letters either side of an Arabic presentation form, U+FC5E to U+FC62, were drawn joined. #267 #276
- The Arabic End of Ayah was not read as Arabic everywhere a script is read. #277
- An Arabic presentation feature the document names was applied twice when the shaper had already asked for it. #230 #240
- Sogdian Fe now joins to the letter before it, and Low Alef joins to nothing. #94
- The Syriac Alaph took the wrong form. It now takes the form the font gives after DALATH or RISH, is chosen from the bases either side of it, and resolves
fin2,fin3andmed2from the joining state table. #132 #143 #155 #228 #244 #247 #254 - Cursive joining and Transparent-Joining now come from Unicode. A letter next to a recently added character joins, and a mark that only the font knows does not break a join. #251 #259 #261 #273
- The Khmer Coeng was read outside the cluster it belongs to. #93 #95
- A glyph of an Indic cluster the shaper did not reorder had no mask, which raised a warning per glyph per feature. #96
- The Myanmar shaper raised undefined-key warnings on every call to insert dotted circles. mpdf/mpdf#2046 #21
- A v2 Indic script tag fell back to other scripts' original tags instead of only its own. #192 #216
- An Indic run's shaper is chosen from the script chosen for the run, as in HarfBuzz. #199 #222
- Above-base forms are applied at the stage HarfBuzz applies them, in Indic and Khmer fonts. #263 #269 #270 #279
- Below-base forms are applied before the base as well as after it, as in HarfBuzz. #422
- A Sinhala repaya was not formed. It is now formed and drawn after the consonant it sits on. #287 #289
- A Sinhala font whose
pref,blwforpstfligature is written Consonant + Halant did not have its al-lakuna recognised, as the other viramas are. #435 #501
- Every feature of a language system is offered, not only the last of those that start at the same lookup. #245 #252
- A shared lookup's rules are classed under every feature of the language system that names it. #271 #284
- A GSUB lookup that two selected features name is applied once where HarfBuzz merges it, under the alternate the first feature asked for. A Khmer font reaches its merged mask. #243 #257 #258 #264 #272
- Where GSUB features are applied one at a time, each pass applied every feature. It now applies one, and each lookup of that feature runs over the whole run. #212 #229 #233 #234 #242
- A nested lookup applied what its subtable holds for the first glyph it covers to any glyph. It now applies only to a glyph the subtable covers. #102 #106
- A chained context positioning by coverage ran its nested lookups twice on the same glyph. #97
- A contextual subtable that matched but changed nothing let the next subtable of the lookup run too. #109
- A GSUB subtable over 32 KB did not resolve, because its record offsets were read as signed. #100 #107
- A class-based chained rule kept the extra backtrack and lookahead positions of the rule read before it. #170 #195
- A class 0 backtrack or lookahead position in a chained context rule never matched. #385
- An input position naming a class the ClassDef does not define matched any glyph. It now matches nothing, as in HarfBuzz. #412
- Class 0 matched glyphs of classes numbered above a gap in the ClassDef, and glyphs a ClassDef lists as class 0 were kept as a class of their own. #414 #417
- GDEF class membership was tested by searching for the glyph's hex in the class. #193 #217
- A lookup that sets
IgnoreMarksand names a mark attachment class skipped only the marks outside the class. It now skips every mark. #175 #185 - NULL offsets were read as real offsets in GSUB and GPOS headers, class-based context ClassDefs, Class Definition tables and the rule sets of context and chained context Format 1 subtables. #253 #262 #326 #331 #379 #382 #413
- A NULL anchor on a base or mark was read as an anchor. It now attaches nothing. #260 #268
- A Single Substitution warned for a glyph that text cannot reach. #307 #309
- The GSUB row was built differently depending on whether the font cache had one. #285 #286
- Four lookup keys were read by what the reader assumed instead of what the font states. #104 #105 #113 #139
MarkGlyphSetswas not read from GDEF 1.3. #34- A context rule's example string and records were reported twice. #124 #130 #144
- The rules of a nested lookup reached at a class 0 position were not reported. #123 #138
- Substitutions the parser does not keep were reported, and glyphs that GDEF does not class as marks were drawn on a dotted circle. #187 #194
These changes do not change output.
- OTL refactor.
Otl,OtlDumpandTTFontFilewere refactored. Each OTL table is read once, the parser is split from the subsetter, the table readers moved toMpdf\Fonts\Table, andOtlData,OtlTagsand thedebugOTLtrace moved out ofOtl. #84 #117 #160 #167 #171 #172 #174 #176 #177 #178 #186 #188 #190 #198 #235 #250 #275 #282 - Unicode namespace. The Unicode character data and the bidi algorithm moved under
Mpdf\Unicode. #294 - Dead code. State left by the pre-OTL Arabic shaper was deleted #88 #128, and so was the unread
Form::$form_checkboxes#471. - Annotation objects. Annotation object numbers are given once instead of being predicted in
PageWriter. #360 - ToUnicode. The byte-subset ToUnicode map is built in one place. #372
- UTF-8 decoding. A valid UTF-8 string is decoded with mbstring. #364
- Glyph outline numbers. A glyph outline's coordinates are written through
NumericString::decimal(), as the colour glyphs and SVG paths write theirs. #625 - Snapshot tests. Snapshot tests compare bytes first, then PDF objects, then pixels. Snapshot documents carry nothing of the machine that made them. #72
- Data scripts. Composer scripts regenerate the Unicode, emoji, joining, language system, font cache, subset, shaping and grey profile data, and update snapshots.
- CI. #5 #310 #317 #376 #377 #615 #674 #675
- CI runs on the
gravitypdfbranch, caches Composer downloads and uses current action versions. - It checks PDF/A and PDF/X-4 output with veraPDF, and tests e-invoices against the XML packages
composer.jsonsuggests. - The test suite runs under a 512M memory limit.
- Pull requests run 5 of the 24 PHP and OS test jobs unless labelled
full-ci, leaving out PHP 5.6 on Windows, the slowest. Pushes togravitypdf, a nightly run and a manual run get all 24. A newer push to a pull request cancels the run it replaces. - Every workflow, code coverage included, also runs nightly on
gravitypdfand can be run by hand. - The Windows test jobs no longer spend minutes on HTTP requests to localhost. A test left
$_SERVER['HTTP_HOST']set, so every later test fetched each missing stylesheet or image fromhttp://localhost, and on Windows each refused connection takes about two seconds. #674 - The coding standard and PHPStan run as one Lint workflow. The e-invoice and PDF/X-4 checks run on a pull request only when it changes the code they cover.
- CI runs on the
- Test memory. On PHP 5.6 the test suite peaks at about 330MB instead of 470MB. PHPUnit before 8.5 has every suite keep its own copy of the list of declared classes. The test listener now empties those copies before the first test runs, and the bootstrap no longer creates an Mpdf instance, which made every copy longer. #841
- PHPStan. Fixes for newer PHP versions and PHPStan 2.2.15. #6 #295 #319 #451
- Branch alias. The Composer branch alias maps
dev-gravitypdfto8.x-dev. #3 - Open elements.
WriteHTML()keeps a stack of the elements open in the HTML it reads, so that CSS rules can be matched against an element's parents, ancestors and earlier siblings rather than only the blocks mPDF lays out. Each element carries its position among its siblings and a record of the siblings before it.Mpdf::getOpenElements()reads it. #533 - Compiled selectors. A rule whose selector the legacy parser cannot read is compiled into its compound selectors, the combinators between them and its specificity, and filed under its rightmost compound for the selector matcher. A selector list is split at the commas outside parentheses, brackets and strings, so
:is(h1, h2)and[title="a,b"]stay whole. #538 #619 - Computed values on the open elements. In the standard CSS mode, each element on the stack of open elements carries the properties merged for it, with the CSS-wide keywords resolved, in the
computedslot of its frame, and the document's frame carries those of<body>.inheritreads a parent's from there. #546 #652 - nth-child in tables from the open elements.
tr,tdandth:nth-child()and:first-childtake a row's or cell's position among its siblings from the stack of open elements, as the selector matcher does, instead of from mPDF's row and column counters. An element a browser moves out of a table, such as a<bookmark>or<tocentry>written between two cells, is not counted, and withallow_html_optional_endtagsoff a cell, row or row group with no end tag is closed by the next one, as mPDF lays it out. #538 #629