Page MenuHomePhabricator

Blurry enlarged icons in dialog outline
Closed, ResolvedPublic1 Estimated Story Points

Assigned To
Authored By
matmarex
Apr 17 2016, 4:18 AM
Referenced Files
F3899832: Screenshot 2016-04-20 11.33.24.png
Apr 20 2016, 4:43 PM
F3899822: Screenshot 2016-04-20 11.33.04.png
Apr 20 2016, 4:41 PM
F3899825: Screenshot 2016-04-20 11.34.15.png
Apr 20 2016, 4:41 PM
F3899483: T132864 SVG scaling Wikipedia 2016-04-20 08-12-46.png
Apr 20 2016, 3:22 PM
F3899327: pasted_file
Apr 20 2016, 3:05 PM
F3899299: upload-ltr.png
Apr 20 2016, 3:05 PM
F3899347: pasted_file
Apr 20 2016, 3:05 PM
F3899378: pasted_file
Apr 20 2016, 3:05 PM

Description

Icons in the dialog outline are enlarged to 26px (instead of the usual 24px) and are therefore slightly blurry.

kGpyFu1.png (447×719 px, 36 KB)

This is because of:

.theme-oo-ui-outlineOptionWidget () {
	font-size: 1.1em;
	...
}

Event Timeline

Jdforrester-WMF set the point value for this task to 1.

This is a separate issue. You can tell because you no doubt can reproduce this one, but not that one. :)

Well, SVGs should – in theory – be scalable without any negative effect, what browser/platform are you referring to here?

Indeed, in theory. In practice, since we're still using ancient ;) technology of pixel-based screens, and so scaling small SVGs up by less than 200% doesn't produce perfect-looking results.

For example, consider the 'upload' icon. We can blow it up losslessly to a large size:

pasted_file (506×505 px, 10 KB)

Here's actual size, 24x24px: upload-ltr.png (24×24 px, 250 B)

It doesn't look so neat when enlarged to 110%: upload-ltr.png (26×26 px, 418 B)

The shapes get a little blurry. How bad the effect is depends on the icon; some look just fine, some look horrible. This one is kind of in the middle.


Easy to see why if you overlay the pixel grid on the icon – which is how it will be shown on an actual screen. This is assuming non-Retina screens, but the effect on those is the same, just less pronounced (every normal pixel there is split into four, giving us 2x more details).

(click the images to enlarge)

At the actual size, 24x24px, the vertical/horizontal lines of the icon align perfectly with the grid, which will produce nice crisp shapes. (As crisp as we can get.)pasted_file (494×495 px, 14 KB) pasted_file (499×498 px, 10 KB)
But at 110%, 26x26px, they don't, which forces the icon to be rendered using grey pixels at the edges rather than just black and white, producing blurry shapes.pasted_file (533×536 px, 16 KB) pasted_file (536×534 px, 13 KB)
pasted_file (4×594 px, 138 B)

So it's the anti-aliasing of SVGs (below a certain threshold) on non-retina displays.
I can confirm that on a retina desktop display this is not an visual issue.

T132864 SVG scaling Wikipedia 2016-04-20 08-12-46.png (978×1 px, 54 KB)
(full retina resolution)

Wondering about the browser differences using different SVG libraries – with pixel-based image formats (Gif, PNG, JPEG) differences has long been a surprising source of pain.

Yes - the source of the issue is most of our icons are hand-designed to snap to the 24px grid - which makes them look really crisp on regular displays. I'm not sure the outline needs to be 1.1em (we rarely change the font size in OOUI), but if it must we should shrink it back down again for the icons.

I'm not sure the outline needs to be 1.1em (we rarely change the font size in OOUI), but if it must we should shrink it back down again for the icons.

We can also make it only change the font size of the label, but not the icon.

Was thinking about that option myself as first reaction, one issue is, that everything scales up with the 1.1em so also the height of the clickable area and so on.
Next possibility would be to scale icon back down, but with the em scaling it's a rat race, that doesn't really seem successful en large.

Change 284481 had a related patch set uploaded (by DLynch):
OutlineOptionWidget mediawiki theme: icons the correct size

https://gerrit.wikimedia.org/r/284481

Original:

Screenshot 2016-04-20 11.33.04.png (311×515 px, 25 KB)

That patch:

Screenshot 2016-04-20 11.34.15.png (316×516 px, 26 KB)

(Changing the font-size on just the label affects the layout:

Screenshot 2016-04-20 11.33.24.png (318×518 px, 27 KB)
)

@DLynch Doesn't that take us on the same unresolved sub-decimal rodeo again in IE 9-11 pointed out at T102364?

@DLynch Will check it out on my non-retina Windows machine.

Jdforrester-WMF assigned this task to DLynch.
Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF moved this task from Backlog to OOjs-UI-0.17.0 on the OOUI board.
Jdforrester-WMF edited projects, added OOUI (OOjs-UI-0.17.0); removed OOUI.

Change 284481 merged by jenkins-bot:
OutlineOptionWidget themes: icons the correct size

https://gerrit.wikimedia.org/r/284481