Is there a way to override the minumum font size in webkit browsers?

I am doing tiny text on a canvas instance, and it works as expected in Firefox 4, but in Chrome and Safari the font displays the minimum font size set in these browsers, which is already minimal and cannot be omitted through the user interface (which looks like 6px font size), but it's still too big for what I want to accomplish.

The code I use to print the font is similar to the following if this can be useful:

ctx.font = '4px Monospace'; ctx.fillText("Any text", 0, 10); 

So, is it even possible to override the minimum font size settings?

Update . I know that the text cannot be read at 4px, but that is not a question. In fact, I do not need to read this.

Update 2 : In Safari, this solution works, but it still does not work in Chrome.

Thanks.

+4
source share
1 answer

You can try using a larger font and scale the context :

 ctx.font = '8px Monospace'; ctx.save(); ctx.scale(0.5, 0.5); ctx.fillText("Any text", 0, 20); ctx.restore(); 

Remember to keep scaling when specifying the position of your text.

This can easily reduce the quality of the graphics in the text, but in this case it will still be unreadable.

+2
source

All Articles