Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: support CanvasRenderingContext2D.fontVariantCaps #804

Open
luludotdev opened this issue Mar 21, 2024 · 0 comments
Open
Assignees

Comments

@luludotdev
Copy link

Currently setting ctx.fontVariantCaps has no effect (and is not reflected in TypeScript types), and using the ctx.font property to set a font variant is also ignored.

Code

import { writeFile } from "fs/promises";
import { Canvas } from "@napi-rs/canvas";

const canvas = new Canvas(400, 400);
const ctx = canvas.getContext("2d");

ctx.fillStyle = "white";
ctx.fillRect(0, 0, canvas.width, canvas.height);

ctx.fillStyle = "black";
ctx.font = "small-caps 48px sans-serif"; // This works in the browser
ctx.fillText("Test", 10, 50);

await writeFile("./out.png", canvas.toBuffer("image/png"));

Expected

image

Actual

out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants