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

fix(fonts): wait for fonts to be fully loaded #337

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions decktape.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ async function exportSlides(page, plugin, pdf, options) {
let hasNext = await hasNextSlide(plugin, context);
while (hasNext && context.currentSlide < maxSlide) {
await nextSlide(plugin, context);
await fontsLoaded(page);
await pause(options.pause);
if (options.slides && !options.slides[context.currentSlide]) {
process.stdout.write('\r' + await progressBar(plugin, context, { skip: true }));
Expand Down Expand Up @@ -566,6 +567,12 @@ async function nextSlide(plugin, context) {
return plugin.nextSlide();
}

async function fontsLoaded(page) {
await page.evaluate(async () => {
await document.fonts?.ready
});
}

async function writePdf(filename, pdf) {
const pdfDir = path.dirname(filename);
try {
Expand Down
Binary file modified test/snapshot/revealjs-demo.pdf
Binary file not shown.
Loading