문제

I'm using jcanvas and I need to resize text by width and height. Actually the library offers an option to scale by X and Y but I need to do the same with the width and height properties.

Is it possible?

도움이 되었습니까?

해결책

The only way to resize text in jCanvas is with the scaleX, scaleY, or scale property. The width and height properties (for text drawings) are read-only, so you can't change them yourself.

$("canvas").drawText({
    fillStyle: "#000",
    x: 100, y: 100,
    fontFamily: "sans-serif",
    fontSize: 36,
    text: "This text is squished",
    scaleX: 0.5
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top