[whatwg] Font Resize Event

Scott Johnson sjohnson at mozilla.com
Fri Oct 5 15:16:21 PDT 2012


This might also be useful for us here at Mozilla (and perhaps the folks 
at WebKit). The reason being, if the text-size-adjust property 
(currently -webkit-text-size-adjust and -moz-text-size-adjust... not 
sure if other browsers implement this) becomes a spec, we then have to 
deal with the case on mobile where fonts are sized by the user agent, 
rather than the styling information (i.e. the author). So, firing a 
text resize event here might make sense, if only to let the page know 
that the text is undergoing a (potential) change in font size.

Out of curiosity, do you handle this case (i.e. the case on mobile 
where fonts could be inflated due to a user agent scaling algorithm, 
such as mozilla's font inflation) on the site you mentioned?
 What happens in iOS Safari, for example, when text in the div is 
resized unexpectedly due to the -webkit-text-size-adjust property not 
being specified?


~Scott

¯\_(ツ)_/¯

On Wed 26 Sep 2012 01:41:06 AM CDT, Hugh Guiney wrote:
> My use case: I have a <div> with overflow: hidden that contains slides
> as part of a JavaScript carousel. It has to be overflow: hidden
> because otherwise the unseen slides are visible/stretch the page. And
> because each slide is different, the containing <div> therefore needs
> to grow/shrink in height depending on the content currently being
> displayed. This is trivial enough to do, by changing the height to
> match its contents whenever a slide change occurs, or a resize or
> orientationchange event is fired, but currently if I increase or
> decrease the font size, the content can get cut off, or there will be
> a ton of extra white space, since the <div> height is out of sync with
> the height of its contents. This could be easily remedied with a
> fontresize (or textresize) event.
>
> Some existing efforts to fill in this functionality, going back to
> 2005, demonstrate the utility beyond just this use case:
>
> http://www.alistapart.com/articles/fontresizing/
> http://www.tomdeater.com/jquery/onfontresize/
> http://wellstyled.com/en/javascript-onfontresize-jquery-plugin/
> http://dev.sencha.com/playpen/docs/output/Ext.EventManager.html#onTextResize
> https://bugzilla.mozilla.org/show_bug.cgi?id=303405
>
> While it's true I could use one of the existing scripts I listed, to
> me they are all unusable as the change detections don't always occur
> when a Cmd-+/- is issued.


More information about the whatwg mailing list