Is the text in Canvas also affected by the minimum font size of the browser?

We want to get the specific width of the text, so we calculate it through the API of measureText , and we get the text width corresponding to the font size of 3px in demo. https://www.w3schools.com/tag.

but when it comes to our page, the font size of 3px does not get the same small data. Instead, it seems to be affected. The width of the text 12px is calculated, corresponding to the minimum font size for browsing. This is rather difficult to understand. Will the font size in Canvas be affected in some cases?

Mar.20,2021

here seems to have mentioned,

when we repeatedly tested and found that the font of canvas is equal to the "13px Arial" font (other fonts are not guaranteed), the height of the text is about 1.1 times that of fontSize.

should be limited, but it doesn't seem to be the same as the restriction on dom? If you need a font that is too small, you can scale text as small as you want

Menu