Automattic/node-canvas

Cannot Load Font

Open

#1207 aperta il 21 lug 2018

Vedi su GitHub
 (10 commenti) (6 reazioni) (0 assegnatari)JavaScript (1140 fork)batch import
Help wantedText & Fonts

Metriche repository

Star
 (9524 star)
Metriche merge PR
 (Merge medio 34g 18h) (2 PR mergiate in 30 g)

Descrizione

Issue or Feature

I've been trying to register a font but whenever I use it I get

Pango-WARNING **: couldn't load font "Avenir Not-Rotated 48px", falling back to "Sans Not-Rotated 48px", expect ugly output.

Steps to Reproduce

var Canvas = require('canvas');
Canvas.registerFont(path.join(__dirname, "fonts", "Avenir.ttf"), { family: "AvenirBook"});
var canvas = Canvas.createCanvas(200, 200);
var ctx = canvas.getContext('2d');
  ctx.font = '48px "AvenirBook"';
ctx.fillText('hello', 50, 50);
// etc.

Avenir font: http://summerfieldmattress.com/skin/frontend/default/craigs/fonts/avenir%20fonts/avenir.ttf

Your Environment

  • Version of node-canvas (e.g. 1.4.0): Latest Release
  • Environment (e.g. node 4.2.0 on Mac OS X 10.8): node v8.11.3 on Windows 10 64bit

Guida contributor