Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF: math glyphs going out of bounds from table rows (works in HTML and Word) #1071

Open
ronaldtse opened this issue Dec 22, 2023 · 2 comments
Assignees
Labels

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Dec 22, 2023

The font being used is "STIX Two Math" or "Cambria Math" -- both will cause the same out of bounds issue.

Word (works):
Screenshot 2023-12-22 at 9 25 11 AM

HTML (works):
Screenshot 2023-12-22 at 9 21 35 AM

PDF (out of bounds):
Screenshot 2023-12-22 at 9 17 24 AM

Please see this ticket for details:

@ronaldtse ronaldtse added the bug label Dec 22, 2023
@ronaldtse ronaldtse moved this to 🌋 Urgent in Metanorma Dec 22, 2023
@Intelligent2013 Intelligent2013 moved this from 🌋 Urgent to 🏗 In progress in Metanorma Dec 22, 2023
@Intelligent2013
Copy link
Contributor

Source document from https://github.com/metanorma/pdfa-iso-32000-2/pull/31

  1. HTML doesn't work ok for:
    image
    image

image

  1. DOC doesn't work ok too, for instance:
    image

Word doesn't render overflowed glyph, just cuts it.

If manually set 5pt font size, then renders fully:
image

  1. The table row height in the XSL-FO/PDF is 5mm vs. 6.5mm for DOC.
    The table cell vertical alignment in the PDF is 'top' vs. 'bottom' DOC (I didn't find how Word sets/calculate this property).
    I've tried to set row height and vertical alignment manually in XSL-FO similar to DOC - PDF renders OK:
    image
    image
    image

But in any case, 'braceleftmid' and 'bracerightmid' don't fit properly, and need to decrease the font-size:
image
Apache FOP can't increase the table row height automatically, just it doesn't catch the max glyph height (Word too, for braceleftmid and bracerightmid).

@ronaldtse
Copy link
Contributor Author

ronaldtse commented Dec 23, 2023

@Intelligent2013 I looked into this carefully, and you are absolutely right...

Because these particular glyphs are designed to go out of glyph bounds! I've checked "STIX Two Math" below. Originally it looks like it worked for HTML but it's just because HTML row has extra padding on top/bottom (see the first image to view actual bounding box)

HTML:
Screenshot 2023-12-23 at 12 15 14 PM

Word:
Screenshot 2023-12-23 at 12 13 45 PM

In BirdFont (free font glyph viewer), you can see that they extend out of the glyph area:
Screenshot 2023-12-23 at 6 03 07 PM

Screenshot 2023-12-23 at 6 03 45 PM

So... maybe the only way is to shrink their height? Sad but true...

We only have two choices:

  • only use [css font-family:STIX Two Math;font-size: Npt]
  • create new syntax that allows [custom-charset: math] with font-size...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants