Skip to content

Commit

Permalink
tme
Browse files Browse the repository at this point in the history
  • Loading branch information
chearon committed Nov 16, 2017
1 parent bc1a1f1 commit 1091a23
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion examples/font.js
Expand Up @@ -15,20 +15,39 @@ Canvas.registerFont(fontFile('PfennigBold.ttf'), {family: 'pfennigFont', weight:
Canvas.registerFont(fontFile('PfennigItalic.ttf'), {family: 'pfennigFont', style: 'italic'})
Canvas.registerFont(fontFile('PfennigBoldItalic.ttf'), {family: 'pfennigFont', weight: 'bold', style: 'italic'})

var canvas = Canvas.createCanvas(320, 320)
var canvas = Canvas.createCanvas(1320, 1320)
var ctx = canvas.getContext('2d')

ctx.font = 'normal normal 50px Helvetica'

ctx.translate(1320, 0);
ctx.scale(3, 3);
ctx.rotate(Math.PI/2);

ctx.textBaseline = "middle";
ctx.strokeStyle = "red";

ctx.fillText('Quo Vaids?', 0, 70)
ctx.moveTo(0, 70);
ctx.lineTo(200, 70);
ctx.stroke();

ctx.font = 'bold 50px pfennigFont'
ctx.fillText('Quo Vaids?', 0, 140, 100)
ctx.moveTo(0, 140);
ctx.lineTo(200, 140);
ctx.stroke();

ctx.font = 'italic 50px pfennigFont'
ctx.fillText('Quo Vaids?', 0, 210)
ctx.moveTo(0, 210);
ctx.lineTo(200, 210);
ctx.stroke();

ctx.font = 'bold italic 50px pfennigFont'
ctx.fillText('Quo Vaids?', 0, 280)
ctx.moveTo(0, 280);
ctx.lineTo(200, 280);
ctx.stroke();

canvas.createPNGStream().pipe(fs.createWriteStream(path.join(__dirname, 'font.png')))

0 comments on commit 1091a23

Please sign in to comment.