mirror of
https://github.com/astefanutti/decktape.git
synced 2024-11-25 20:11:22 +03:00
Compare commits
2 Commits
22326d4bfe
...
0e0a75bcf0
Author | SHA1 | Date | |
---|---|---|---|
|
0e0a75bcf0 | ||
|
659d10dee9 |
12
decktape.js
12
decktape.js
@ -497,7 +497,7 @@ async function printSlide(pdf, slide, context) {
|
||||
// Some fonts written in the PDF may be ill-formed. Let's skip font compression in that case,
|
||||
// until it's fixed in Puppeteer > Chromium > Skia.
|
||||
// This happens for system fonts like Helvetica Neue for which cmap table is missing.
|
||||
font = Font.create(Buffer.from(bytes), { type: 'ttf', hinting: true });
|
||||
font = Font.create(Buffer.from(bytes), { type: fontType(bytes), hinting: true });
|
||||
} catch (e) {
|
||||
console.log(chalk.yellow('\nSkipping font compression: %s'), e.message);
|
||||
return;
|
||||
@ -534,6 +534,16 @@ async function printSlide(pdf, slide, context) {
|
||||
}
|
||||
};
|
||||
|
||||
function fontType(bytes) {
|
||||
const buffer = Buffer.from(bytes);
|
||||
if (buffer.readInt32BE() === 0x10000) {
|
||||
return 'ttf';
|
||||
}
|
||||
if (buffer.toString('utf8', 0, 4) === 'OTTO') {
|
||||
return 'otf';
|
||||
}
|
||||
}
|
||||
|
||||
function mergeGlyph(font, index, glyf) {
|
||||
if (font.data.glyf.length <= index) {
|
||||
for (let i = font.data.glyf.length; i < index; i++) {
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "decktape",
|
||||
"version": "3.13.0",
|
||||
"version": "3.14.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "decktape",
|
||||
"version": "3.13.0",
|
||||
"version": "3.14.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "5.3.0",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "decktape",
|
||||
"description": "High-quality PDF exporter for HTML presentation frameworks",
|
||||
"author": "Antonin Stefanutti",
|
||||
"version": "3.13.0",
|
||||
"version": "3.14.0",
|
||||
"homepage": "https://github.com/astefanutti/decktape",
|
||||
"license": "MIT",
|
||||
"main": "decktape.js",
|
||||
|
Loading…
Reference in New Issue
Block a user