Skip to content

Font Rendering on Canvas for PSD Previews #256

@aamirsdev

Description

@aamirsdev

Font Rendering on Canvas for PSD Previews
To generate visible text pixel data for PSD previews, I render on a canvas (skia-canvas currently) setting:

ctx.font = `${canvasFontStyle} ${fontWeight} ${fontSize}px "${fontFamily}"`;

However, if the canvas cannot recognize or resolve the specified font family, it falls back to a default font, causing the PSD preview text to render incorrectly with the wrong font family.
What I tried:
Registering fonts explicitly with FontLibrary.use() by providing the path of .otf font files, e.g.,

FontLibrary.use('Amandine', ['fonts/fonnts.com-Amandine_Bold_Italic.otf']);

This approach requires having all .otf font files locally, which is not reliable or scalable in environments with many or unknown fonts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions