-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Embedded Fonts is not working #733
Comments
if you compiled with Pango, try |
It works! Pango is the Problem. Thank you. |
No problem, you won't have to do that when I finish work on #715 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script is executed without error . Unfortunately, the command
ctx.font = 'bold 72px fontOpenSans';
is ignored and it will set the default font and size .
When Canvas is set to PDF mode , the font is also not set , nor embedded in the PDF document .
System: Ubuntu Server 14.04 / NodeJS 5.6 / node-canvas 1.3.12
Code-Snippet :
var Canvas = require('canvas')
, Font = Canvas.Font
, fs = require('fs');
if (!Font) {
throw new Error('Need to compile with font support');
}
var fontOpenSans = new Font('fontOpenSans', 'OpenSans-Regular.ttf');
fontOpenSans.addFace('OpenSans-Bold.ttf', 'bold');
var canvas = new Canvas(600,800);
var ctx = canvas.getContext('2d');
// Tell the ctx to use the font.
ctx.addFont(fontOpenSans);
ctx.font = 'bold 72px fontOpenSans';
ctx.fillText('Open Sans Dummy-Text', 50, 80);
fs.writeFile('font.png', canvas.toBuffer());
The text was updated successfully, but these errors were encountered: