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

[css-size-adjust] Percentage-based adjustment

From: Scott Johnson <sjohnson@mozilla.com>
Date: Fri, 12 Jul 2013 09:52:10 -0500
Message-ID: <51E0181A.6080403@mozilla.com>
To: "www-style@w3.org" <www-style@w3.org>
Hi www-style,

I have an informal test that tests the behavior of
-webkit-text-size-adjust with a percentage value, specifically for the
spec at this location:

http://dev.w3.org/csswg/css-size-adjust/

I believe there are two possible meanings of text-size-adjust: <percentage> that I
was thinking could apply - the first being that setting the
text-size-adjust property to a percentage enlarges the text to exactly
that percentage, and the second being that it enlarges it, based on the user-agent's intrinsic implementation of text-size-adjust, such that it does not exceed this percentage. I will describe the experiment I used to test this below, but it appears that webkit is utilizing the first of these.

EXPERIMENT DESCRIPTION

The experiment I used to determine this is available here:

http://people.mozilla.org/~sjohnson/text-size-adjust/wk-tsa-1.html

If the -webkit-text-size-adjust property, with a percentage value,
enlarged the text up to that amount, then I would expect that with a
specified font size of 10pt, and a block width of 400px, with a property
of -webkit-text-size-adjust: 150%, would be equivalent to the default
text-size-adjust for that block. In this scenario, the default text-size-adjust
behavior for mobile safari is to enlarge the text to 14pt, which is an
increase of 40%), . In the example, this means the block
with a blue background (no text size adjustment property specified)
should be the same height as the block with a gray background
(-webkit-text-size-adjust: 180%).

On the other hand, if the -webkit-text-size adjust property, with a
percentage value enlarged text to exactly the percentage specified,
then a -webkit-text-size-adjust property with a value of 200% should be
equivalent to a block with font size specified at 20pt, with
-webkit-text-size-adjust: none. In the example, this means that the
block with a red background should be the same height as the block with
a tan background.

RESULTS

It appears from my testing that the second interpretation of the
property, that is that -webkit-text-size-adjust: <percentage> makes the
font size EXACTLY that percentage. There are, of course, caveats.

First, the -webkit-text-size-adjust property does not distinguish
between percentage values that are greater or less than 100. This can be
seen with the block with orange background in the example. It has a
-webkit-text-size-adjust property of 30%. I would expect that values
less than 100% should be ignored, but this seems to not be the case.

Second, as is documented abundantly on the web,
-webkit-text-size-adjust: none has an effect on desktop zooming. This
is, I believe, a bug in the webkit implementation of text size
adjustment, since it's being used to mean two separate things depending
on whether the user is using the mobile version of webkit or the desktop
version. On the desktop version, it apparently means that fonts should
not be adjusted when zooming, whereas on the mobile version it means
that fonts should not be adjusted using the "font boosting" algorithm.
Zooming still enlarges the text size on mobile safari as expected,
even with -webkit-text-size-adjust: none.

RECOMMENDATION

I would recommend, for the purposes of the text-size-adjust
specification, that we specify the behavior of text-size-adjust:
<percentage> to allow the increase of text sizes UP TO that percentage,
such that a percentage value of X% is equivalent to allowing a font-size
adjustment according to the following:

maximum adjusted font size = <specified font size> * (1.0 + (X/100.0))

SPECIFICATION PROSE

3. Size adjustment control: the 'text-size-adjust' property
...
<percentage>
Renderers must utilize the default size adjustment when displaying on a
small device, but the final rendered font size for the block on which
this property is in effect must be no larger than the font size given by
the following relation:
<final rendered font size> <= <author specified font size> * (1.0 +
<percentage>/100.0)


OTHER ISSUES

In section 3, the text-size-adjust property is allowed to be animatable,
but only as a percentage. I'm not sure this makes a lot of sense with
the new specification. It can still be implemented, but it doesn't seem
as though a maximum font-size should be something we animate, especially
considering it will only take effect on mobile implementations.

Thank you for your consideration. I would be open to any and all discussion
on this topic.

~Scott Johnson
Platform Developer, Mozilla
Received on Friday, 12 July 2013 14:52:33 UTC

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