athenapdf
athenapdf copied to clipboard
Problem loading fonts
Testcase to reproduce the issue:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
@import url('https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin');
body {
font-family: 'Lato', sans-serif ;
}
@media screen {
[class*="printer only"] {
display: none;
}
}
</style>
</head>
<body>
Remove this text and the text below will ALSO disappear
<div class="printer only" style="border: solid 1px red">
This is the test string that should show up when printing
</div>
</body>
</html>
If font is not used outside of printer only
block - it cannot be used from within either.
Can anyone suggest something on that matter?
Change printer only
to print-only
(sorry, I just want to isolate the problem).
I can do this in example to avoid confusion, but that doesn't fix an issue.
Interesting, can you try running it with a delay of 1s (-D 1000
) ? I was able to replicate this on the latest v3 too.
Delay (1s or bigger) doesn't affect this issue at all.
If you add a <b>test</b>
to the printer only
tag, it will also not show up, unless you also add <b>foobar</b>
into the body tag, outside of the printer only
div. Also the same with some accented characters like Ł.
The cause seems to be that Electron can only draw fonts (or variants of it) that have been "required" outside of the printer only
tag. If a bold variant of the font was not already used outside of the div, it will not be available.
Curiously enough, adding the accented character into the printer only
div will make even the text outside disappear.
Okay, this is not a problem on v3 if a delay is set (~1s).