Skip to content

fontkit wont load fonts in Node 23 #356

@wesbos

Description

@wesbos

hello - I'm using Node 23 with next/font, and I've tracked down an issue with fonts not loading to this package.

var fontkit = require("fontkit");
var font = fontkit.openSync("Geist-Black.ttf");

Gives this error:

Error: Unknown font format

The error is "RangeError: Offset is outside the bounds of the DataView" and being thrown here:

var header = DFontHeader.decode(stream);

Which looks to be because Node 23 now throws an error when reading a buffer outside bounds:

nodejs/node#54588

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions