Rick Kukiela
Rick Kukiela

Reputation: 1264

Detect safari advanced setting: "never use font sizes smaller than..." from javascript?

Safari (mac) has a setting under safari -> preferences -> advanced that disabled the use of fonts smaller than a given point size.

I'm writing a PDF application using PDF.js which causes the fonts to be rendered huge and overlap when this setting is enabled.

I'm trying to find out if there is a way from javascript to detect if this setting is enabled or not before loading the PDF, and then instead load a message explaining to the user what they need to do to properly view the PDF.

Any idea?

Upvotes: 3

Views: 581

Answers (1)

Nevir
Nevir

Reputation: 8101

Make a DOM node with a font-size: 1px, line-height: 1.0 and measure its height. If it's > 1px, then your font size is capped.

http://codepen.io/nevir/full/trwEb

Upvotes: 1

Related Questions