W3C home > Mailing lists > Public > www-style@w3.org > August 2013

Re: Request for adjustable font-size: line-fit

From: Anselm Hannemann <info@anselm-hannemann.com>
Date: Wed, 21 Aug 2013 15:27:24 +0200
Cc: Lea Verou <lea@verou.me>, "www-style@w3.org List" <www-style@w3.org>
Message-Id: <03B04834-FE1E-4BE2-BD30-352138DB6954@anselm-hannemann.com>
To: Brad Kemper <brad.kemper@gmail.com>
On 21.08.2013, at 08:55, Brad Kemper <brad.kemper@gmail.com> wrote:

> On Aug 20, 2013, at 12:27 PM, Anselm Hannemann <info@anselm-hannemann.com> wrote:
> 
>> On 20.08.2013, at 16:16, Brad Kemper <brad.kemper@gmail.com> wrote:
>> 
>>> On Aug 20, 2013, at 6:29 AM, Anselm Hannemann <info@anselm-hannemann.com> wrote:
>>> 
>>>> Can you think of a how this can be solved the easiest way for a browser 
>>>> (I'm personally missing some background information to know how they calculate their styles 
>>>> and can get styles from parent / root in such cases).
>>> 
>>> It seems to me we already have a property for dealing with single lines of text that don't fit. It is not 'font-size', it is 'text-overflow'. Therefore, I think what you are trying to achieve would work better as 'text-overflow: fit'. If the text can't fit on one line, can't wrap to a second line, and can't overflow visibly or into a scrollable space, then it shrinks the used font size until it does fit. It should also shrink the value of 1em, so that descendants on that line with properties measured in ems would continue to be proportional.  
>>> 
>>> You might still want some minimum-font-size too.
>> 
>> This being true I don't think it is proper to do this via text-overflow.
>> Overflow only describes what happens if the text is longer than the parent element.
>> This request is about what happens to fit the line (usually this means upscaling the font to parent element's width).
> 
> Really? I would think downscaling to fit would be a much more common and important use case. Justification is often good enough if you just want text to fill the line, but if the text is too long and you don't want it cut off, that's when shrinking it to fit becomes extremely useful. You can see something similar in iOS, in places.

Sorry, this of course is a use-case and it's not rare. It just was not what I wanted to achieve when raising this issue but you're right, this also can be solved by implementing such a technique.

> 
>> As a developer I would find it very awkward to find a `font-size` controlling value in `text-overflow`.
> 
> It would only control the used font size. 

True but as developer you expect the font-size you set to be applied, right? In your case you could specify any font-size but it won't be recognized by the browser. This is what I don't like about it. Maybe this should be elaborated what developers preferů?
Received on Wednesday, 21 August 2013 13:27:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:33 UTC