Skip to content

Not able to add fontFamily with font #318

Open
@piyushsinghdev

Description

@piyushsinghdev

I am trying to add diffrent fontFamily Conditionally but not able to add it this is my code can you tell me what is the issue
const handleCanvas = async (canvas: any, fontFamily: string) => {
const FONT_SIZE = 200;
if (canvas) {
canvas.width = 1000;
canvas.height =200;
const ctx = canvas.getContext('2d');
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
// ctx.font = ${FONT_SIZE}px "${font}"
ctx.font = ${FONT_SIZE}px "${fontFamily}";

  ctx.fillStyle = penColor;
  ctx.fillText(txtInputSignPickState, 550,1);
  canvas.toDataURL().then(async (data: any) => {
    setpickSignListState(data);
  });
}

};

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