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

Fonts are not vertically centered #11

Open
teclab-at opened this issue Nov 1, 2020 · 17 comments
Open

Fonts are not vertically centered #11

teclab-at opened this issue Nov 1, 2020 · 17 comments
Labels
bug Something isn't working

Comments

@teclab-at
Copy link

Whatever I do I cannot get the font icon vertically centered:
notcentered

I've already tried using the --descent option but with no effect. SVG files look correct. Also changing the CSS properties has no effect, so I am starting to believe that it is really inside the generated font.

Can I do something about it?

thx

@teclab-at
Copy link
Author

As a workaround one can put a display=grid style option into the <i> element.

@teclab-at
Copy link
Author

Unfort. this is not the final solution. The characters/symbols are bottom aligned inside the font and it seems there is no possibility to vertically center the symbols inside the font ...

@tancredi
Copy link
Owner

tancredi commented Nov 7, 2020

Sorry, just closed the other issue: #13

I see here you've already tried using descent which seems to work fine on my end.

Do you mind having another try with descent and fantasticon version 1.0.13?

Add a very high value (e.g. 1000) just to see if it has any effect - works fine for me, and if still ineffective let me know and we'll debug this a little more?

@tancredi tancredi added the bug Something isn't working label Nov 7, 2020
@teclab-at
Copy link
Author

1000? I only used values around 10 or so ... Now I see why it did not work. Anyhow I have solved my issue using frames.
thx

@solomon-gumball
Copy link

Having the same issue here:

Screen Shot 2020-11-23 at 5 40 10 PM

Original SVGs are centered vertically but it seems like all the :before tags are smaller than and offset vertically from their parent i tags. Not sure if it's an issue with the font generation or the CSS.

@saiballo
Copy link

same problem here... instead with same icons icon-font-generator works ok

@Tukkan
Copy link

Tukkan commented Feb 12, 2021

i[class^="icon-"], i[class*=" icon-"] {
    line-height: 1;
}

Fixes the issue.
Make sure you generated fonts with --normalize true

@saiballo
Copy link

ok, normalize true is mandatory if you have one icon some pixel bigger then others.

thanks

@mkurczewski
Copy link

I've got the same issue but with this config everything seems to work well:

{
  normalize: true,
  fontHeight: 300,
  descent: 150
}

@seanking2919
Copy link

Even with normalize true, I still icons not vertically aligned like this:

image
image

@jesustorres38
Copy link

the same for me. I solved the problem by adjusting the value of descent ... in my case to 45

fantasticonrc.json

{
    "normalize": true,
    "descent": 45
}

before:
ksnip_20210427-211529

after:
ksnip_20210427-211136

@kovacevjosip
Copy link

Issue is because of :before pseudo-element definition. Just override somewhere in project same css without pseudo-elements.

i[class^="mq-p-"], i[class*=" mq-p-"] {
  font-family: mq-planning-icons !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@keune
Copy link

keune commented Aug 18, 2021

@kovacevjosip that does work. did you do anything to automate this or do you modify the css by hand?

@kovacevjosip
Copy link

@kovacevjosip that does work. did you do anything to automate this or do you modify the css by hand?

You just need to copy code above somewhere inside your project (like src/scss/_icons.scss or whatever). You don't need to touch actual lib.

@harun911
Copy link

I also run into issues with the icons not being centered vertically. Using descent is not an option in my case, because the icons are all varying in height and width. So, I can not use a single value to correct the offset.

Here you can clearly see the problem:
image

Here is another screenshot of the icons.html, where you see the difference in alignment.
image

Is it possible to somehow vertically align them inside the font? All the fixes mentioned before,unfortunately did not work for me.

@kovacevjosip
Copy link

I also run into issues with the icons not being centered vertically. Using descent is not an option in my case, because the icons are all varying in height and width. So, I can not use a single value to correct the offset.

Here you can clearly see the problem: image

Here is another screenshot of the icons.html, where you see the difference in alignment. image

Is it possible to somehow vertically align them inside the font? All the fixes mentioned before,unfortunately did not work for me.

The design team needs to design icons properly. I think they need to vertically align icons inside given grid (if icons are not occupying 100% of height).

@james-william-r
Copy link

Bit hacky, but I just made every icon an inline-flex and centered items and content... 😅
.icon { display: inline-flex; align-items: center; justify-content: center; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests