question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Describe the bug Icon fonts are showing up as squares.

I have tried specifying the @font-face in both the main index.html and in the javascript.

To Reproduce

let styles = []
let feature = new Feature({ geometry: geometry});
...
let iconProperties = {
                text: new Text({
                    text: \uf16a,
                    font: 'normal 25px My-Icon-Font',
                    offsetY: 0,
                    offsetX: 0
                })
            };
            styles.push(new Style(iconProperties));

...

return new VectorLayer({
            source: new VectorSource({
                features: [feature]
            }),
            style: styles
        });

Add the layer to your map. Icon displays as a square.

Expected behavior

A font icon displays.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fredjcommented, Dec 11, 2019

Hi @fuoridallarete,

I’ve put a small example in https://codesandbox.io/s/font-awesome-text-0ectn (the font is loaded in the index.html page)

0reactions
fuoridallaretecommented, Dec 11, 2019

Thanks for your quick answer (and solution) @fredj. It works. I was stupidly missing the css link in the html. xx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Icon Styles & Designs - Varghese Mathai
Choose an icon style: Outline, glyph, colored and flat. outline, glyph, colored and flat. outlined, flat, material, glyph, hand-drawn, etc ...
Read more >
UI cheat sheet: Icon categories + icon style reference guide
There are different ways of categorising icon styles; you can look at subject matter, colour palette, size, era, how it was created, ...
Read more >
A Designer's Guide to Icon Styles - IconScout Blogs
A Designer's Guide to Icon Styles · 1. Line · 2. Glyph · 3. Colored outline · 4. Flat · 5. Gradient ·...
Read more >
Flaticon guide to icon styles
Icon styles · Black outline · Black filled · Hand drawn · Gradient · Lineal Color · Flat.
Read more >
Icon Styles - Pinterest
Sep 14, 2020 - Explore Corinna Hutter's board "Icon Styles", followed by 258 people on Pinterest. See more ideas about icon, icon design,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found