MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / _drawMultilineText

Function _drawMultilineText

apps/OpenSign/src/constant/Utils.js:3950–3975  ·  view source on GitHub ↗
(page, text, rect, font)

Source from the content-addressed store, hash-verified

3948}
3949
3950function _drawMultilineText(page, text, rect, font) {
3951 const lines = String(text).replace(/\r/g, "").split("\n");
3952 const fontSize = Math.max(
3953 8,
3954 Math.min(11, rect.height / Math.max(lines.length + 0.5, 2))
3955 );
3956 const lineHeight = fontSize + 1.5;
3957
3958 let y = rect.y + rect.height - fontSize - 2;
3959
3960 for (const line of lines) {
3961 if (y < rect.y + 1) break;
3962
3963 page.drawText(line, {
3964 x: rect.x + 2,
3965 y,
3966 size: fontSize,
3967 font,
3968 color: rgb(0, 0, 0),
3969 maxWidth: Math.max(1, rect.width - 4),
3970 lineHeight
3971 });
3972
3973 y -= lineHeight;
3974 }
3975}
3976
3977function _drawCombText(page, text, rect, font) {
3978 const chars = String(text).split("");

Callers 1

_drawTextFieldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected