Skip to content

Instantly share code, notes, and snippets.

@sigoden
Created September 30, 2018 02:30
Show Gist options
  • Save sigoden/d01ad118da677f796bab01781b7eae23 to your computer and use it in GitHub Desktop.
Save sigoden/d01ad118da677f796bab01781b7eae23 to your computer and use it in GitHub Desktop.
wget -O /tmp/YaHei.Consolas.1.12.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/uigroupcode/YaHei.Consolas.1.12.zip
unzip /tmp/YaHei.Consolas.1.12.zip
sudo mkdir -p /usr/share/fonts/consolas
sudo mv YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/
sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttf
cd /usr/share/fonts/consolas
sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
@TheTajinMan
Copy link

Tried it in Linux Mint 19.3 and it worked perfectly fine! thank you very much

@darkguy2008
Copy link

This works great, thanks so much!

@AcuteSyntax
Copy link

Still works as of September, thanks!

@LarsHLunde
Copy link

This is the stranges and most wholesome little gist 👍

@yilinbp
Copy link

yilinbp commented Oct 20, 2020

Still works as of September, thanks!

Hi, I have downloaded with the commands above,
How can I implement in Ubuntu?
Could you please help me?
Thanks in advance !

@rulon
Copy link

rulon commented Oct 30, 2020

Still works as of September, thanks!

Hi, I have downloaded with the commands above,
How can I implement in Ubuntu?
Could you please help me?
Thanks in advance !

try this:
https://linuxconfig.org/how-to-install-fonts-on-ubuntu-20-04-focal-fossa-linux

@cobusLee
Copy link

Thanks, It works well on Linux Mint 20 Ulyana!!

Copy link

ghost commented Dec 17, 2020

How can I add this to Visual Studio Code.. "Consolas" is not working.

@gilpabu
Copy link

gilpabu commented Jan 7, 2021

it works on Oracle Linux 7 thanks!

@ppalone
Copy link

ppalone commented Feb 16, 2021

How can I add this to Visual Studio Code.. "Consolas" is not working.

Try adding "YaHei Consolas Hybrid"

@ZP-Z
Copy link

ZP-Z commented Mar 22, 2021

How can I add this to Visual Studio Code.. "Consolas" is not working.

Try adding "YaHei Consolas Hybrid"

nICe !!!!

@jonardcaguioa
Copy link

thank you so much~

@jonardcaguioa
Copy link

how can i add consolas to python fpdf font ?

@100Mbps
Copy link

100Mbps commented Jul 1, 2021

thank you very much.Tested on
Linux work 5.4.0-58-generic #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

@emillynge
Copy link

Also, to use as a fallback font for Consolas create this font config file:

~/.config/fontconfig/conf.d/20-consolas.conf
------------------------------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <description>USe Yahei Consolas when Consolas is requested</description>

  <match target="pattern">
  <test qual="any" name="family"><string>Consolas</string></test>
  <edit name="family" mode="assign" binding="same"><string>YaHei Consolas Hybrid</string></edit>
</match>
</fontconfig>

@wajihullahbaig
Copy link

Works 20.04 as of today :)

@AbdelhamidAITMHID
Copy link

Tested on Ubuntu 20.10 LTS
Works well
Thank you

@RahulLooserR
Copy link

Thank you

@andrey-zakharov
Copy link

image
broken cyrillic

@DarkRoku12
Copy link

Tested in Zorin OS 16, works great!

@aaron-nuy
Copy link

Works on Manjaro Xfce

@JomenkoXD
Copy link

Thank you a lot!
Still works.

@ALEX-YRDM
Copy link

Still work on ubuntu20.04
Sep,2022

@onatkarabulut
Copy link

Tested on Ubuntu 22.04.02 LTS
works perfectly!

@Preet-Sojitra
Copy link

How can I add this to Visual Studio Code.. "Consolas" is not working.

Try adding "YaHei Consolas Hybrid"

Worked even in 2023!! Thanks ❤️

@LarsHLunde
Copy link

LarsHLunde commented Nov 6, 2023

Fun fact, if you are on RHEL, Rocky, Fedora or Oracle Linux,
the same commands work as long as you run :
sudo yum install xorg-x11-font-utils

@Fabxx
Copy link

Fabxx commented Dec 31, 2023

How do i apply this on xfce4-terminal? the terminal only shows fc-list :mono fonts

@siposm
Copy link

siposm commented Mar 8, 2024

Working is confirmed on Ubuntu 22.04 LTS
VSCode should have 'YaHei Consolas Hybrid' not 'consolas' as font setting.

@YugandharrPatil
Copy link

the tilde character looks bad :( switched off because of it...
not the same in the regular consolas font though.

@edgar1437
Copy link

Works perfectly fine on Ubuntu 22.04 LTS. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment