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

With pdf.js and disableFontFace: false, fonts do not render #3059

Open
1 task
shlyakpavel opened this issue Dec 27, 2024 · 0 comments
Open
1 task

With pdf.js and disableFontFace: false, fonts do not render #3059

shlyakpavel opened this issue Dec 27, 2024 · 0 comments
Labels
bug Something isn't working has repro We have a way to reproduce this bug. needs reduction Issue needs someone to make a minimal test case that demonstrates the problem. web compatibility

Comments

@shlyakpavel
Copy link
Contributor

Summary

When I open pdf.js in Ladybird with disableFontFace: false, fonts do not render

Operating system

macOS

Steps to reproduce

  1. Open Ladybird
  2. Navigate to a webpage like the one in the repro
  3. Observe

Expected behavior

It renders fine

Actual behavior

Fonts don't render

URL for a reduced test case

N/A

HTML/SVG/etc. source for a reduced test case

<!DOCTYPE html>
<html>
<head>
    <title>PDF.js Test</title>
    <script type="module">
        import * as pdfjsLib from './pdf.mjs';

        pdfjsLib.GlobalWorkerOptions.workerSrc = new URL('pdf.worker.mjs', import.meta.url).href;

        const url = 'what-has-government-done-to-our-money.pdf';

        const canvas = document.getElementById('pdf-canvas');
        const ctx = canvas.getContext('2d');

		pdfjsLib.getDocument({
			url,
			ignoreErrors: true, // Prevent the rendering process from stopping
			disableFontFace: false,
		}).promise.then(function (pdf) {
			pdf.getPage(2).then(function (page) {
				const viewport = page.getViewport({ scale: 1.5 });
				canvas.width = viewport.width;
				canvas.height = viewport.height;

				const renderContext = {
					canvasContext: ctx,
					viewport: viewport,
				};

				page.render(renderContext);
			});
		});
    </script>
</head>
<body>
    <canvas id="pdf-canvas"></canvas>
</body>
</html>

Log output and (if possible) backtrace

N/A

Screenshots or screen recordings

image

Build flags or config settings

No response

Contribute a patch?

  • I’ll contribute a patch for this myself.
@AtkinsSJ AtkinsSJ added bug Something isn't working has repro We have a way to reproduce this bug. web compatibility needs reduction Issue needs someone to make a minimal test case that demonstrates the problem. labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has repro We have a way to reproduce this bug. needs reduction Issue needs someone to make a minimal test case that demonstrates the problem. web compatibility
Projects
None yet
Development

No branches or pull requests

2 participants