Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retina compatible icons #850

Open
fuddl opened this issue Dec 3, 2014 · 38 comments
Open

retina compatible icons #850

fuddl opened this issue Dec 3, 2014 · 38 comments
Labels
ui User Interface

Comments

@fuddl
Copy link

fuddl commented Dec 3, 2014

on the way to retina support (#104), one thing that has to be done is adding high res icons.

I mean these:
osm icons

are these available as svg somewhere? or as a font?

@tomhughes
Copy link
Member

Yes.

@smsm1
Copy link
Contributor

smsm1 commented Dec 3, 2014

@tomhughes
Copy link
Member

or in other words, just replace .png with .svg to find it ;-)

@HolgerJeromin
Copy link
Contributor

HiDPI browsers probably support the new picture element (in the future http://caniuse.com/#search=picture). So the (few) img with png in it could be replaced by the following construct:

<picture>
   <source srcset="/assets/osm_logo-xxx.svg" type="image/svg+xml">
   <img alt="OpenStreetMap Logo" class="logo" src="/assets/osm_logo-xxx.png"/>
</picture>

But the logo seems to be the only img tag on the site.
Edit: changed and tested with chrome.

@HolgerJeromin
Copy link
Contributor

The sprite thing could perhaps be solved with this additional code

    @media
   ( -webkit-min-device-pixel-ratio: 2), /* old Webkit */
          (min-resolution: 150dpi) /* standard way */
      {  
      .icon {
        background:transparent url("sprite.svg") no-repeat 0 0;
      }
    }

And hope that the browsers announcing this properties are able to render svg background bugfree :-)
Edit: changed and tested with chrome.

@fuddl
Copy link
Author

fuddl commented Dec 3, 2014

the question-mark in the svg is just a text element:

    <text
       xml:space="preserve"
       style="font-size:20px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
       x="264.8125"
       y="869.62622"
       id="text3021"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3023"
         x="264.8125"
         y="869.62622">?</tspan></text>

without a font included… the font is specified as Sans Bold does anyone have more info what font that was?

@samanpwbb
Copy link
Member

Open Sans Bold. It should be outlined... do you have this work started in a branch? Happy to fix this up.

@fuddl
Copy link
Author

fuddl commented Dec 3, 2014

@samanpwbb I'm trying to fix this issue

@tomhughes
Copy link
Member

Yes the question mark was just a massive hack on my part... It will be whatever my inkscape on my laptop though Sans Bold was - probably DejaVu Sans Bold or something.

Happy to take a better icon for the query tool.

@HolgerJeromin
Copy link
Contributor

Perhaps we could keep it as a question mark in HTML markup.

@tomhughes
Copy link
Member

I always intended the question mark icon to be temporary - it's just I didn't find anybody with the time and design skills to do something better so wound up releasing it.

@fuddl
Copy link
Author

fuddl commented Dec 8, 2014

does anyone know where the clipboard and the chain icon are used? oh, and the check mark…

@tomhughes
Copy link
Member

It's quite possible that they aren't used.

@fuddl
Copy link
Author

fuddl commented Dec 9, 2014

I added all icons as fonts for all browsers and devices.

What do you think?

@tomhughes
Copy link
Member

Hmm.... Icon fonts are very contentious. Will need to think about that.

@fuddl
Copy link
Author

fuddl commented Dec 9, 2014

are they?

@yannickoo
Copy link

@tomhughes contentious?! Do you have any references for that statement?

@tomhughes
Copy link
Member

I've seen a number of articles in the last year or so complaining about them, particularly for example the use GitHub makes of them.

I believe one complaint for example is the affect on screen readers, which expect text to be, well, text, and try and read it out.

@tomhughes
Copy link
Member

The other common problem I think is people that deliberately override fonts in browser CSS perhaps for accessibility reasons.

It's all a bit hard to google for though because "icon fonts" gives you like a bazillion sites offering you one...

@fuddl
Copy link
Author

fuddl commented Dec 9, 2014

how would a screenreader read an information mark (ℹ), a heart (❤) or a plus (+)?

@tomhughes
Copy link
Member

Well according to http://www.filamentgroup.com/lab/bulletproof_icon_fonts.html at least one screen reader reads ★ as "black star" so it's clearly not impossible that unicode pictogram type characters will be read out.

@fuddl
Copy link
Author

fuddl commented Dec 9, 2014

maybe it would be an improvement to do something like <abbr title="Zoom in">+</abbr>, <abbr title="Zoom out">-</abbr> or <abbr title="star this">★</abbr>.

right now the control buttons aren't read at all, are they?

@HolgerJeromin
Copy link
Contributor

Changing a font is much more work (and needs more knowledge) than changing a svg. For crossbrowser support we need eot and woff font. With a svg we need a png as a fallback.
I would use a media query (like my code above) or a @supports rule (http://caniuse.com/#feat=css-featurequeries).

@fuddl
Copy link
Author

fuddl commented Dec 9, 2014

I created the font using fontello which is pretty easy to use. Definitely easier then adding something to a svg sprite, adding it in css and keeping it up to date with a png sprite.

OSM icon font in Fontello

I can show you how to add anything you like to the woff and eot font, and stylesheet using fontello.

@yannickoo
Copy link

@fuddl could you upload the config.json file? :)

@HolgerJeromin
Copy link
Contributor

@fuddl
Copy link
Author

fuddl commented Dec 10, 2014

@HolgerJeromin I read it carefully and I think most of it does not apply on us:

  1. We use all these icons at the same time and they are always visible. The current approach also bundles the Icons in image files.

  2. I didn't use the private use area

  3. I have no idea what osm.org looks like in opera mini. Neither I have a testing tool… is it a thing?

  4. A long fixed bug in chrome? this is a problem?

  5. Can not confirm this one. it looks equally amazing in chrome firefox and safari:

    chrome firefox safari
    maybe I didn't understand the problem

  6. I agree and I would also prefer not to use generated content in css. I would prefer putting real symbols to the html DOM which is also possible with the icon font approach but not with the current approach.

  7. I find it very easy to position fonts with css… I'd do it if required. In the commit I actually removed a lot of unnecessary css

  8. We don't need multi colour icons, do we?

  9. We don't need animated icons, do we?

  10. Popular approaches (pseudo elements, Private Use Area) seem indeed like hacks for me. I fail to see using unicode symbols for their supposed purpose as hacky.

I wonder why this technology is contentious here. Isn't it something normal in modern webdesign? also github uses an icon font, doesn't it?

@HolgerJeromin
Copy link
Contributor

opera mini is not able to use interactive websites. So the osm page is not usable in the first place.
No blocker for using a technology.

@Zverik
Copy link
Contributor

Zverik commented Aug 4, 2015

Is this issue still relevant?

@bcherny
Copy link

bcherny commented Sep 10, 2015

yes - icons still look bad on retina:

screen shot 2015-09-10 at 11 11 01 am

can we just serve the SVG instead of PNG? svg is:

  • supported by all modern browsers
  • compatible with higher dpi devices that may appear in the near future
  • smaller (just 1.1kb gzipped after running through svgo) compared to PNG (3.3kb gzipped)

@HolgerJeromin
Copy link
Contributor

I am pretty sure osm.org should be usable with Internet Explorer < 9.
Thats why i suggested a compatible version.

@bcherny
Copy link

bcherny commented Sep 10, 2015

can you make a pr?

@HolgerJeromin
Copy link
Contributor

Made two PR for the two changes and thrown both SVGs into SVGO (nice tool btw :-)
The directions button has no SVG file in the repo. Perhaps @zerebubuth can help here.

The markers (for routing and other stuff) were not changed. These are interacting with the map via drag and drop and i was not brave enough for changing them, too.

@HolgerJeromin
Copy link
Contributor

@tomhughes
Copy link
Member

Well this is unfortunately the kind of ticket that is not sufficiently concrete to be easily closeable. There are many image that are still not retina compatible, and even some of the ones we have added patches for are not really sorted.

In particular I discovered after I merged your picture based fix for the logo that one of the two main browsers where retina support is needed (iOS Safari) doesn't actually support picture elements at all, so we really need to revisit that.

@HolgerJeromin
Copy link
Contributor

You are right. Safari seems to ignore picture element, but rely on the uglier srcset for img tag. I hoped this is a temporary problem, but the bug report is quite old.
IEs support for picture is under development, but srcset on img is ready now.

@danieldegroot2
Copy link
Contributor

danieldegroot2 commented Sep 4, 2022

@gravitystorm Requesting to label this issue at least as ui to make it easier to find.

@hiddewie
Copy link
Contributor

hiddewie commented May 9, 2024

I made a pull request in #4775 to replace a number of commonly used icons. If this pull request is appreciated, I can replace many more of the icons with their SVG variants. This should improve the retina support of the OpenStreetMap website considerably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui User Interface
Projects
None yet
Development

No branches or pull requests