gabrielelana / awesome-terminal-fonts

Tools and instructions on how to have awesome symbols in a terminal with a monospace font
MIT License
2.45k stars 230 forks source link

Fallback strategy not working #20

Closed elbaulp closed 8 years ago

elbaulp commented 8 years ago

Hi, first of all, thank you for the great work.

I am trying to install the fonts via the fallback strategy, but seems not to work and I gave up and install via patch. But I would like to install the first method. Here is what I am doing:

I've followed the steps in the README, but does not work. So I tried to install the fonts in /usr/share/fonts/truetype, and put the 10-symbols.conf in /usr/share/fontconfig/conf.d/.

Later I run fc-cache -fv /usr/share/fonts, as root, but nothing seems to work.

My 10-symbols is:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!--
When a glyph is missing in the current font freetype2 will look into
other installed fonts to see if it's going to find it, but which fonts?
and in which order?

The configuration below aim to declare an ordered list of fonts
to be looked into when a glyph is not found in a specic font

<alias>
  <family>FONT_WITH_A_POSSIBLY_MISSING_GLYPH</family>
  <prefer>
    <family>FIRST_FONT_TO_LOOK_INTO</family>
    <family>SECOND_FONT_TO_LOOK_INTO</family>
    <family>...</family>
  </prefer>
</alias>
-->

<fontconfig>
  <alias>
    <family>Ubuntu</family>
    <prefer>
      <family>FontAwesome</family>
      <family>Pomodoro</family>
      <family>Octicons</family>
    </prefer>
  </alias>
</fontconfig>

I've also tried with Ubuntu Mono and UbuntuMono.

I am using Linux Mint Debian Edition.

Any ideas?

Best regards

Akaryatrh commented 8 years ago

I'm running into the same issue, did you find any solution @algui91 ? Moreover i'm not 100% sure that freetype2 is installed by default on any Linux distribution.

elbaulp commented 8 years ago

No, didn't find anything 😕

On Fri, Jan 8, 2016, 09:46 Sébastien Van Eyck notifications@github.com wrote:

I'm running into the same issue, did you find any solution @algui91 https://github.com/algui91 ? Moreover i'm not 100% sure that freetype2 is installed by default on any Linux distribution.

— Reply to this email directly or view it on GitHub https://github.com/gabrielelana/awesome-terminal-fonts/issues/20#issuecomment-169936541 .

Alejandro Alcalde - elbauldelprogramador.com

gabrielelana commented 8 years ago

Hi @algui91 and @Akaryatrh, sorry for the delay

First of all try to find out if the all the fonts are correctly installed

$ fc-list | ack -i octicons
/home/coder/.fonts/octicons-regular.ttf: octicons:style=Regular

$ fc-list | ack -i pomicons
/home/coder/.fonts/pomicons-regular.ttf: Pomodoro:style=Regular

$ fc-list | ack -i awesome 
/home/coder/.fonts/fontawesome-regular.ttf: FontAwesome:style=Regular

With the same command you can check if Ubuntu it's the right name to put in your configuration

At last you should check with man fonts-conf where freetype2 is looking for the configuration files

Hope it helps, let me know

Akaryatrh commented 8 years ago

Hi @gabrielelana and thx for help On my side fc-listfinds all requested fonts. But man fonts-conf lists these directories :

  /etc/fonts/fonts.conf
  /etc/fonts/fonts.dtd
  /etc/fonts/conf.d
  $XDG_CONFIG_HOME/fontconfig/conf.d
  $XDG_CONFIG_HOME/fontconfig/fonts.conf
  ~/.fonts.conf.d
  ~/.fonts.conf

So the folder ~/.config/fontconfig/conf.d is not listed. Is there a way to add a folder for fonts-conf or should I move the conf file ?

Edit: ok, ~/.config is the default config folder for home directory, so it should work :(

(FYI I'm on Ubuntu 15.10)

gabrielelana commented 8 years ago

@Akaryatrh few more checks:

I'm on Ubuntu 15.04 so it should/must work for you too :smile:

Akaryatrh commented 8 years ago

1 => It seems I'm using the proper family font name :

$ fc-list | ack -i sourcecodepro
/home/ubu/.fonts/sourcecodepro/SourceCodePro-Semibold.ttf: Source Code Pro,Source Code Pro Semibold:style=Semibold,Regular
/home/ubu/.fonts/sourcecodepro/SourceCodePro-SemiboldIt.ttf: Source Code Pro,Source Code Pro Semibold:style=Semibold Italic,Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-BoldIt.ttf: Source Code Pro:style=Bold Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-BlackIt.ttf: Source Code Pro,Source Code Pro Black:style=Black Italic,Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-Medium.ttf: Source Code Pro,Source Code Pro Medium:style=Medium,Regular
/home/ubu/.fonts/sourcecodepro/SourceCodePro-Regular.ttf: Source Code Pro:style=Regular
/home/ubu/.fonts/sourcecodepro/SourceCodePro-It.ttf: Source Code Pro:style=Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-Light.ttf: Source Code Pro,Source Code Pro Light:style=Light,Regular
/home/ubu/.fonts/sourcecodepro/SourceCodePro-MediumIt.ttf: Source Code Pro,Source Code Pro Medium:style=Medium Italic,Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-Black.ttf: Source Code Pro,Source Code Pro Black:style=Black,Regular
/home/ubu/.fonts/sourcecodepro/SourceCodePro-LightIt.ttf: Source Code Pro,Source Code Pro Light:style=Light Italic,Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-ExtraLight.ttf: Source Code Pro,Source Code Pro ExtraLight:style=ExtraLight,Regular
/home/ubu/.fonts/sourcecodepro/SourceCodePro-ExtraLightIt.ttf: Source Code Pro,Source Code Pro ExtraLight:style=ExtraLight Italic,Italic
/home/ubu/.fonts/sourcecodepro/SourceCodePro-Bold.ttf: Source Code Pro:style=Bold

And the conf file (i'm using the Source Code Pro regular) :

<fontconfig>
  <alias>
    <family>Source Code Pro</family>
    <prefer>
      <family>FontAwesome</family>
      <family>Pomodoro</family>
      <family>octicons</family>
    </prefer>
  </alias>
</fontconfig>

2 => It doesn't work while icon characters are not or wrongly displayed. I tried as you suggested to source the fontawesome-regular.sh file, but no effect: image

3 => As you can see i'm also using gnome-terminal. I tried the patched font method and icons display properly. I'm fine with the patched method even if the fallback one is far way more elegant :)

BTW, if you want us to continue this discussion on Stack Overflow to avoid polluting the issue tracker, tell me.

gabrielelana commented 8 years ago

@Akaryatrh Ah! A small clue, try echo -e "\u$CODEPOINT_OF_AWESOME_TWITTER" (note the -e flag)

Sorry for the bother but if we can figure out what's not working for you, maybe I can improve the documentation

Akaryatrh commented 8 years ago

With the -e flag, icon displays properly.

But i just noticed something... I didn't copy the .sh files (do I really need them?) from the ./build folder to the ./fonts one. So i did it but still. Even after clearing the cache (fc-cache -fv ~/.fonts) and restarting the terminal icons don't display properly.

You don't bother me, no worries :)

gabrielelana commented 8 years ago

Then it works! :tada:

Let me explain: all the symbols in the icon fonts don't have a standard codepoint, in the unicode there's no such thing as "the twitter icon" what we did here is to put all these special glyphs in the private area

So, how could I know where is the twitter icon? How can I find it's codepoint? We created a map for each font that binds a shell variable (ex CODEPOINT_OF_AWESOME_TWITTER) that represents a glyph to the corresponding codepoint (ex f099)

What you need to do is to source all the *.sh files (ex. source fontawesome-regular.sh) in your .bashrc (or .zshrc or whatever) and then use the declared variables when you want to print a glyph (ex. \u$CODEPOINT_OF_AWESOME_TWITTER)

In your screenshot glyphs don't display properly in your prompt not because the glyphs/fonts are not available but because in the prompt definition you are using the wrong codepoints

elbaulp commented 8 years ago

Hi, I think it is working for me, but only with SourceCodePro font, this estrategy its suppose to work with any font? For example

<fontconfig>
  <alias>
    <family>UbuntuMono</family>
    <prefer>
      <family>Pomodoro</family>
      <family>FontAwesome</family>
      <family>Octicons</family>
    </prefer>
  </alias>
</fontconfig>

And then I set the font in the terminal to UbuntuMono. Should this work? Because it is not showing the icons.

Best regards

Akaryatrh commented 8 years ago

@gabrielelana If I need to source shell files manually then yep, the documentation must be upated :) And also this file : https://github.com/gabrielelana/awesome-terminal-fonts/blob/master/install.sh

@algui91 Did you sourced the shell files in your .bashrc file to make it work ?

Edit: even with shell files sourced, i still have issues (but "echoing" a unicode code point works). Actually I'm using oh-my-git, but they don't reference unicode codepoints, they use directly unicode characters (https://github.com/arialdomartini/oh-my-git/blob/master/prompt.sh). Is that make a difference or is this the same representation for the terminal ?

elbaulp commented 8 years ago

Yes, I've source all of them. When I echo - e, it shows the icons.

On Fri, Jan 15, 2016, 19:38 Sébastien Van Eyck notifications@github.com wrote:

@gabrielelana https://github.com/gabrielelana If I need to source shell files manually then yep, the documentation must be upated :) And also this file : https://github.com/gabrielelana/awesome-terminal-fonts/blob/master/install.sh

@algui91 https://github.com/algui91 Did you sourced the shell files in your .bashrc file to make it work ?

— Reply to this email directly or view it on GitHub https://github.com/gabrielelana/awesome-terminal-fonts/issues/20#issuecomment-172046426 .

Alejandro Alcalde - elbauldelprogramador.com

hashhar commented 8 years ago

I am having the same issue as @Akaryatrh . The echo works fine but the icons don't work with oh-my-git. The patched icons work. I need the fallback ones because I'm using font-awesome with i3 and the patched fonts override it.

anied commented 5 years ago

Am am running into a similar issue here-- I can confirm that the fallback is working outside the terminal-- if I copy paste the offending text into libreoffice and choose the same font as the terminal is using then the font icons are shown-- however, in the terminal they are malformed. Ubuntu 18.04 using the gnome terminal.