Skip to content

Pango-CRITICAL errors when using Canvas on Windows #2492

Description

@JanitorialMess

When using node-canvas on Windows, I consistently encounter Pango-CRITICAL errors referencing pango_font_description_get_family: assertion 'desc != NULL' failed. These errors appear immediately upon calling canvas.getContext('2d'), even in minimal code examples that don't explicitly work with text or fonts. While my code continues to function despite these errors, they flood the console output.

I've tried :

  • Following the manual windows installation instructions guide
  • Manually registering fonts
  • Using system fonts and custom fonts (I have no use for fonts whatsoever but thought it might help make the error disappear)

Nothing worked so far.

Reproduction Steps

This minimal example reproduces the issue:

import { Image, createCanvas } from 'canvas';
import * as fs from 'fs';

const imagePath = './src/images/test.jpg';
const image = new Image();
image.src = fs.readFileSync(imagePath);
const canvas = createCanvas(image.width, image.height);
// The following line triggers Pango-CRITICAL errors:
const ctx = canvas.getContext('2d');

Error Output

(process:47272): Pango-CRITICAL **: 17:39:18.415: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed
(process:47272): Pango-CRITICAL **: 17:39:18.416: pango_font_description_get_family: assertion 'desc != NULL' failed

Environment

  • Canvas: v3.1.0
  • Node.js: v23.0.0
  • OS: Windows 24H2 (OS Build 26100.3194)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions