FontManager / font-manager

http://fontmanager.github.io/
GNU General Public License v3.0
826 stars 44 forks source link

Confused with fonts #74

Closed farzadmf closed 5 years ago

farzadmf commented 5 years ago

After I wrote this issue, I noticed it became a bit long, sorry for that. I think it's still readable, but let me know if it's not :)


Hi,

I might or might not be a continuation of the issue I opened before (#69), but I'm facing a dilemma here again!

I was enjoying my fonts and everything, but by accident, I noticed that one of the commands I use in terminal (minikube) prints emojis to the terminal, but I don't see them. So I started playing with the settings in font-manager, and using the following setting, I can see the emojis (first one is the settings and second one is the terminal): image image

BUT, my problem with the terminal is that I have downloaded and set the font to Monaco, and the font I'm seeing doesn't look like Monaco at all!

If I turn off Use Embedded Bitmaps in Font Manager, the font looks better but emojis are missing: image


The following experimentation uses the settings I mentioned in the beginning (Use Embedded Bitmaps set to enabled)

I tried playing with font size, and it seems that size 9 seems to be problematic for Monaco, below, the first one is 8 and the second one is 10: image image

Although if you look closely at the second one, you'll see that there are some artifacts in the output, e.g., I in IP seems to be green

This size issue seems to be something that I'm noticing in Chrome too; for example, in Lastpass vault, I see the font is Monaco 16px, and it looks like this: image

If I change the font size to 17px, It looks much better: image

But the difference with Chrome is that changing the embedded bitmap setting in font manager doesn't affect it at all!

At some point, I tried to modify NVidia settings (by running sudo nvidia-settings) to see if I see something. I saw a setting Antialiasing Settings and I changed it, but now I think I got to original values: image

So, I was just wondering if you can tell me what's going on here because it's annoying me :(

JerryCasiano commented 5 years ago

What does it seem to me that some sizes are "missing"?

Because they are. Fonts that embed bitmaps only do so for certain sizes.

Why do I see the artifacts?

Probably because it's using embedded bitmaps instead of the outlines.

https://en.wikipedia.org/wiki/Computer_font#Bitmap_fonts https://docs.microsoft.com/en-us/typography/opentype/otspec150/eblc

As far as rendering differences between applications that depends on a variety of factors. Some applications may use fontconfig only to locate fonts on the system and then do their own rendering ignoring any other settings.

See https://www.freedesktop.org/software/fontconfig/fontconfig-user.html and /etc/fonts/conf.d/README for more details about fontconfig configuration.

But you probably want to disable embedded bitmaps by default and save something like

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <test name="family"  compare="eq">
      <string>REPLACE_WITH_EMOJI_FONT_NAME</string>
    </test>
    <edit name="embeddedbitmap" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
</fontconfig>

to ~/.config/fontconfig/conf.d/29-enable_emoji_bitmaps.conf instead.

Closing this out as it's not actually an issue related to the application but feel free to continue this conversation here.

farzadmf commented 5 years ago

Thank you @JerryCasiano for your answer.

Fonts that embed bitmaps only do so for certain sizes

Is there any kind of tool or something that I can use to somehow embed bitmaps for other sizes?

I'm going to try what you suggested. And, is there anything that I can do about the things you mentioned that "it's using embedded bitmaps instead of the outlines"?

Also, I was wondering if this could have anything to do with the display drivers.

I'm asking because I have almost the same setup on my laptop and my desktop, with the only difference being that at some point, I tried to install "official" NVidia drivers on my desktop, which I regret now because I think it messed up everything!

On my laptop, everything is working perfectly; even the issue I mentioned for Chrome is fine on my laptop (as a side note, I discovered the emojis running minikube on my laptop).

On my laptop when I go to Additional Drivers in Software and Updates, I see this: image

So, I think it's using the "generic" driver, but on my desktop, after trying to install "official" NVidia, I see that it's using something else, and for some reason, I cannot use the "generic" driver anymore. This is what I see on my desktop: image

I know that what I'm saying has nothing to do with this application, but you're my only hope now to get an answer :)

JerryCasiano commented 5 years ago

Is there any kind of tool or something that I can use to somehow embed bitmaps for other sizes?

Font editing software such as fontforge. It's a lot of work.

And, is there anything that I can do about the things you mentioned that "it's using embedded bitmaps instead of the outlines"?

Aside from disabling embedded bitmaps globally and only enabling them for cases where you like the result, no.

Nothing to do with graphics drivers.

The result in this case simply depends on available fonts and configuration.

farzadmf commented 5 years ago

Thank you @JerryCasiano for your answer.

I installed fontforge, and I tried to open my Monaco.ttf with the application. When opening, it asks me whether I want to load the embedded bitmaps: image

So, here I see that size 9 apparently has embedded bitmaps, but this is the size that I had problem with. What's happening here?

JerryCasiano commented 5 years ago

What's happening here?

Let's see the actual bitmaps in both sizes.

farzadmf commented 5 years ago

Sorry, can you explain how to do that? This is my first time using fontforge and opening a ttf with it 😛

JerryCasiano commented 5 years ago

Sorry, I rarely use fontforge and the few times I have it wasn't to deal with bitmap fonts.

You'll have to figure out how to examine the bitmaps at both sizes and see if there is any difference.

Keep in mind that even if there isn't an actual difference while in fontforge, gnome-terminal and other applications may not use the same rendering method.

If both the bitmaps look identical at both point sizes 9 & 10 then you'll probably need to use fontconfig's debug variables to see what's actually being used in your terminal.

farzadmf commented 5 years ago

Thank you @JerryCasiano . I am really grateful for all the help you provided :+1:

I'll see if I can figure something out; I would also appreciate if you know of a resource, tutorial, etc. or anything that would help me with this stuff.

But thank you anyways.

JerryCasiano commented 5 years ago

Your welcome.

A couple links that come to mind

https://wiki.archlinux.org/index.php/font_configuration https://eev.ee/blog/2015/05/20/i-stared-into-the-fontconfig-and-the-fontconfig-stared-back-at-me/