In pdfHTML 3.0.0 (released with iText 7.1.11) support was added for the line-height property for inline-level elements as well as improved support for block-level elements.
- The line-height property defines the amount of space above and below inline elements.
- Browsers use logic to calculate the maximum line height independent of the font, and the minimum value required to place the glyph is taken as the resultant line height value.
- For some fonts, iText uses the values of WinAscender/WinDescender, but for others iText uses TypoAscender/TypoDescender and multiplies them by 1.2. This is done deliberately to avoid cases when leading is set to a multiplied value of "1" and font glyph instructions actually draw the glyph outside of the defined bounds. This is not super common, but still happens for some fonts, and this results in overlapping of glyphs from different lines.
- In pdfHTML 3.x, you will notice that the contents are properly aligned within the elements.
Below is an example demonstrating the new behavior: