@mocanvas/mocanvas · function

getNoteFontSize

declare function getNoteFontSize(shape: {
    props?: unknown;
}, theme?: TLTheme): number

Effective font size: the size style, shrunk by fontSizeAdjustment.

fontSizeAdjustment is a *fraction* of the styled size, written when a label had to shrink to fit its square: 1 is a label that fits as it is, 0.25 a label at a quarter. 0 is the backfill for a record written before the prop existed and means the same as 1.

It was read as an absolute size in px until 4.10.1, with anything below 4 dismissed as "not a font size anyone meant". Nothing ever wrote such a value: the only sample in this repository carries 1, which both readings render the same way, and a consumer's live records carry fractions between 0.078 and 0.21 — which the threshold discarded, so every shrunk label came out at full size and ran off its note. A fraction is also what a .tldr file means by it.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.