Skip to content

Commit

Permalink
Use absolute path to symbols font only when possible
Browse files Browse the repository at this point in the history
In other cases try to access via relative path
  • Loading branch information
linev committed Sep 24, 2024
1 parent 3c6d68d commit e013f8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/base/BasePainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,11 @@ async function svgToPDF(args, as_buffer) {
if (need_symbols && !custom_fonts.symbol) {
if (!getCustomFont('symbol')) {
pr2 = nodejs ? import('fs').then(fs => {
let path = source_dir + 'fonts/symbol.ttf';
if (path.indexOf('file://') === 0)
path = path.slice(7);
let path = 'fonts/symbol.ttf';
if (source_dir.indexOf('file://') === 0)
path = source_dir.slice(7) + path;
else
path = '../../' + path;
const base64 = fs.readFileSync(path).toString('base64');
addCustomFont(25, 'symbol', 'ttf', base64);
}) : httpRequest(source_dir + 'fonts/symbol.ttf', 'bin').then(buf => {
Expand Down

0 comments on commit e013f8c

Please sign in to comment.