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

Problem with embedded fonts and PDF/A generation #654

Open
baedorf opened this issue Feb 19, 2021 · 3 comments
Open

Problem with embedded fonts and PDF/A generation #654

baedorf opened this issue Feb 19, 2021 · 3 comments

Comments

@baedorf
Copy link

baedorf commented Feb 19, 2021

I try to embedded/use fonts using your AutoFont example with Noto Sans in scanned directory.
Times-Roman and Times-Bold are listed in font properties in Foxit Phantom PDF.
How can I find which elments in HTML causes the usage of this fonts?

In inline css I use

body {
    font-family:'Noto Sans';
}

I even try to generate a PDF/A compliant document and always get


java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:459)
	at com.openhtmltopdf.pdfboxout.PdfBoxFastOutputDevice.drawString(PdfBoxFastOutputDevice.java:393)
	at com.openhtmltopdf.pdfboxout.PdfBoxTextRenderer.drawString(PdfBoxTextRenderer.java:52)
	at com.openhtmltopdf.render.AbstractOutputDevice.drawText(AbstractOutputDevice.java:101)
	at com.openhtmltopdf.render.InlineText.paint(InlineText.java:171)
	at com.openhtmltopdf.render.InlineLayoutBox.paintInline(InlineLayoutBox.java:279)
	at com.openhtmltopdf.render.simplepainter.SimplePainter.paintInlineContent(SimplePainter.java:170)
	at com.openhtmltopdf.render.simplepainter.SimplePainter.paintLayer(SimplePainter.java:72)
	at com.openhtmltopdf.render.PageBox.paintMarginAreas(PageBox.java:430)
	at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.paintPageFast(PdfBoxRenderer.java:882)
	at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.writePDFFast(PdfBoxRenderer.java:619)

Any ideas?

Remarks:
I use stlyes shown on Page Featutes wiki page.
I suppose I have to set font-family in any matcher (@page..)
Is this correct?

@danfickle
Copy link
Owner

Yes, unfortunately that is correct. I plan to fix this with fall-back fonts (#641).

@baedorf
Copy link
Author

baedorf commented Feb 23, 2021

I think I would be an alternative or better to define a default font family and not "only" a fallback.
This default font should be used if no css defines another font family

@jochenberger
Copy link

We should at least report a more helpful error to help people find the actual problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants