You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
letter-spacing: normal on an inline element is ignored at the start of a block #684
An inline element that sets letter-spacing: normal inside a block with letter spacing is drawn with the block's spacing when its text is the first thing in the block. The same element later in the block is drawn without spacing, as it should be.
BT 42.520 776.346 Td 2.000 Tc [(x) ] TJ ET <- should have no Tc
BT 56.360 776.346 Td 2.000 Tc [(b) ] TJ ET
BT 42.520 727.407 Td 2.000 Tc [(c) ] TJ ET
BT 55.520 727.407 Td (y) Tj ET <- correct
A browser draws x and y both without spacing.
Where
Both CSS modes give the same output, on gravitypdf before and after #683.
In Mpdf::printbuffer(), a chunk that carries a letter-spacing sets lSpacingCSS from it, but only converts it into fixedlSpacing when it is a length. A chunk carrying normal leaves fixedlSpacing as it was. For the first chunk of a block that is the block's own spacing, which the standard mode now puts back before the buffer is drawn (TextSpacing::setFromBlock()), and which the legacy mode had left there from the block's saved text state. Later chunks are not affected because the spacing is reset to none after each chunk is written. word-spacing: normal has the same shape, through minwSpacing.
setCSS() behaves the same way at write time: LETTER-SPACING: normal sets lSpacingCSS without resetting fixedlSpacing.
Fix
Resetting fixedlSpacing to false and minwSpacing to 0 when a chunk's spacing is normal would fix it. That changes the legacy mode's output too, so the fix should decide whether legacy keeps the old drawing or takes the correction, and say so in the changelog.
Activity