You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
デフォルトのfont nameはRobotoになっていますが、この選択肢に他のフォントを追加したいです。
Web画面上でテンプレートファイルを作成する際に実際のフォントが問題ないか確認がしたいためです。
pdfme/packages/common/src/constants.ts
を見ると文字列でフォントデータが保存されていますが
ttfファイルで読み込みはどのように実装したらよいでしょうか?
下記の通りテストを参考に実装しようとしましたが
vitaブラウザではfsがサポートされていないようでビルドエラーとなります
import { readFileSync } from 'fs';
import * as path from 'path';
const serifData = readFileSync(path.join(__dirname, ``/assets/fonts/SauceHanSerifJP.ttf``));
export const getDefaultFont = (): Font => ({
[DEFAULT_FONT_NAME]: { data: b64toUint8Array(DEFAULT_FONT_VALUE), fallback: true },
SauceHanSerifJP: { data: serifData, fallback: true },
});
Beta Was this translation helpful? Give feedback.
All reactions