canvas icon indicating copy to clipboard operation
canvas copied to clipboard

feature request: support CanvasRenderingContext2D.fontVariantCaps

Open luludotdev opened this issue 1 year ago • 0 comments

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

luludotdev avatar Mar 21 '24 09:03 luludotdev