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

Function _fitSingleLineFontSize

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

Source from the content-addressed store, hash-verified

4012}
4013
4014function _fitSingleLineFontSize(text, rect, font) {
4015 let size = Math.min(12, rect.height - 4);
4016 size = Math.max(size, 6);
4017
4018 while (size > 6) {
4019 const width = font.widthOfTextAtSize(text, size);
4020 if (width <= rect.width - 4) return size;
4021 size -= 0.5;
4022 }
4023
4024 return 6;
4025}
4026
4027function _drawCheckBox(page, field, rect, zapf) {
4028 let checked = false;

Callers 2

_drawTextFieldFunction · 0.85
_drawDropdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected