WIP
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const drawText = (
|
||||
ctx: CanvasRenderingContext2D,
|
||||
text: string,
|
||||
font: string,
|
||||
fontSize: number,
|
||||
fontWeight: number,
|
||||
x: number,
|
||||
@@ -8,10 +9,12 @@ const drawText = (
|
||||
align: CanvasTextAlign,
|
||||
maxWidth?: number
|
||||
) => {
|
||||
ctx.font = `${fontWeight} ${fontSize}px Ubuntu`;
|
||||
ctx.font = `${fontWeight} ${fontSize}px ${font}`;
|
||||
ctx.textAlign = align;
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x, y, maxWidth);
|
||||
|
||||
return Math.ceil(ctx.measureText(text).width);
|
||||
};
|
||||
|
||||
export default drawText;
|
||||
|
||||
Reference in New Issue
Block a user