107

Adobe released an open source font family called "Source Code Pro" (download here, Slashdot article here). How do I install it?

1
  • 5
    So many people coming to this question, and not a single one of us has taken the time to just add a fonts-source-code-pro package to Debian...
    – user677955
    Sep 8, 2019 at 21:17

8 Answers 8

168
  1. Download the archive from the Source Code Pro homepage. You can do it also using wget: Open a terminal (ctrl-alt-t or press the win key and type "terminal") and type

    wget https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
    
  2. Unzip the archive (you can use Nautilus for that, or use the following command).

    unzip 1.050R-it.zip
    
  3. Locate and ensure your fonts folder exist in your home directory, often in ~/.local/share/fonts folder (either go to home in Nautilus and create a new folder, or type the following from the terminal)

    fontpath="${XDG_DATA_HOME:-$HOME/.local/share}"/fonts
    
    mkdir -p $fontpath
    

If you already have that directory, don't worry.

  1. Move the Open Type fonts (*.otf) to the newly created .fonts directory. In command line, that would be

    cp source-code-pro-*-it/OTF/*.otf $fontpath
    
  2. If you haven't done it yet, open a terminal, and type

    fc-cache -f -v
    

Your font is now ready to use and the applications should be able to see it.

All in one script for those who simply want to copy/paste the answer

#!/bin/bash
set  -euo pipefail
I1FS=$'\n\t'
mkdir -p /tmp/adodefont
cd /tmp/adodefont
wget -q --show-progress -O source-code-pro.zip https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
unzip -q source-code-pro.zip -d source-code-pro
fontpath="${XDG_DATA_HOME:-$HOME/.local/share}"/fonts
mkdir -p $fontpath
cp -v source-code-pro/*/OTF/*.otf $fontpath
fc-cache -f
rm -rf source-code-pro{,.zip}

If you want to install system wide instead of per user, copy the files to /usr/local/share/fonts/ instead of ~/.local/share/fonts/.

2
  • 1
    This doesn't let me use this font on Terminal. What should I do to apply this font on the Terminal? Sep 5, 2014 at 19:07
  • @SSchneid I've seen your edit proposal and rejected it. Please, either correct the whole answer and replace the dead links with working ones or submit a new answer.
    – MadMike
    Mar 15, 2017 at 12:10
55

In order to install Source Code Pro, you can:

  1. Go to Google Fonts
  2. Type source code in the search box (the only match should be Source Code Pro)
  3. Click "Add to collection"
  4. Click on the text sample (this should present all the font styles)
  5. Tick all the check boxes
  6. Click the download icon (a down arrow on the top right) and download as Zip file

Now you just need to decompress the Zip file into your ~/.fonts folder:

mkdir -p ~/.fonts/Source_Code_Pro
unzip Source_Code_Pro.zip  -d ~/.fonts/Source_Code_Pro

You may need to run

fc-cache -f

to make the fonts available (no need to log out).

3
  • 5
    This is probably the answer that will age the best.
    – user459652
    Sep 2, 2017 at 14:23
  • This one was the first method to work for me. The other ones I tried either did nothing, or resulted in empty squares.
    – Henrik
    Aug 7, 2020 at 8:17
  • If you don't want to clutter your home directory, you can use ~/.local/share/fonts instead of ~/.fonts Jan 18, 2021 at 1:44
17

Thanks for the answer, just a modified script to get the latest file

#!/bin/bash
FONT_NAME="SourceCodePro"
URL="https://github.com/adobe-fonts/source-code-pro/archive/1.017R.zip"

mkdir /tmp/adodefont
cd /tmp/adodefont
wget ${URL} -O ${FONT_NAME}.zip
unzip -o -j ${FONT_NAME}.zip
mkdir -p ~/.fonts
cp *.otf ~/.fonts
fc-cache -f -v
0
8

My answer is similar to the others just updating the URL'S as it seems those are removed. Source code pro's new home seems to be on github. Source code pro on github.

#!/bin/bash
mkdir /tmp/adodefont
cd /tmp/adodefont
wget https://github.com/adobe-fonts/source-code-pro/archive/1.017R.zip
unzip 1.017R.zip 
mkdir -p ~/.fonts
cp source-code-pro-1.017R/OTF/*.otf ~/.fonts/
fc-cache -f -v
0
7
sudo wget --content-disposition -P /usr/share/fonts/opentype/source-code-pro https://github.com/adobe-fonts/source-code-pro/blob/29fdb884c6e9dc2a312f4a5e2bb3b2dad2350777/OTF/SourceCodePro-{Black,BlackIt,Bold,BoldIt,ExtraLight,ExtraLightIt,It,Light,LightIt,Medium,MediumIt,Regular,Semibold,SemiboldIt}.otf?raw=true

That will install the latest release of the font (as I'm writing this in June 2021, released January 2021).

3
  • For anyone else coming here in late 2021, this is the answer you want to use. It's a single line you can copy and paste into the terminal. There's no longer any need for unzipping and creating directories. The other answers are outdated, and though it's not possible, they should be removed. Sep 30, 2021 at 13:24
  • 1
    This doesn't work in ZSH, use Bash to run this command, works perfectly in Bash. Nov 12, 2021 at 5:39
  • 1
    It would be nice to explain parameter(s) and what it does. It would also be beneficial to know how did you get the 29fdb884c6e9dc2a312f4a5e2bb3b2dad2350777 which probably is unique for this 2021 latest version.
    – tukan
    Jun 7, 2022 at 9:23
3

There is also a working third-party debian package on github.

To install:

git clone https://github.com/hainp/source-code-pro-deb 
cd source-code-pro-deb
sudo apt-get install debhelper
dpkg-buildpackage -rfakeroot -b -uc -us
sudo dpkg -i ../fonts-source-code-pro_1.017_all.deb
2

Not exactly what the OP is asking for, but this might be easier.

You can install the powerline fonts which include slightly modified versions of a bunch of mono fonts which work with powerline for the prompt and Vim with the vim-airline plugin. It kind of gives you an 'awesome' list of source code mono fonts to try out, including "Source Code Pro". To install all the fonts:

$ git clone https://github.com/powerline/fonts.git --depth=1
$ cd fonts
$ ./install.sh
2
  • 1
    If you install it this way, the font is called Source Code Pro for Powerline
    – user677955
    Feb 17, 2019 at 4:03
  • The problem with this repository is that the fonts are not updated. Source Code Pro has 2021 update, but the the font is 5 years old here.
    – tukan
    Jun 7, 2022 at 8:45
1

Based on a GitHub post, this script worked for me. I had to modify the folder names to get it to work.

version=1.050

echo "\n* Downloading version $version of source code pro font"
rm -f SourceCodePro_FontsOnly-$version.zip
rm -rf SourceCodePro_FontsOnly-$version
font_folder=source-code-pro-2.030R-ro-${version}R-it
zip_file=${version}R-it.zip
wget https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/$zip_file

echo "\n* Unziping package"
unzip $zip_file
mkdir -p ~/.fonts

echo "\n* Copying fonts to ~/fonts"
cp $font_folder/OTF/*.otf ~/.fonts/

echo "\n* Updating font cache"
sudo fc-cache -f -v

echo "\n* Looking for 'Source Code Pro' in installed fonts"
fc-list | grep "Source Code Pro"

echo "\n* Now, you can use the 'Source Code Pro' fonts, ** for sublime text ** just add the lines bellow to 'Preferences > Settings':"
echo '\n  "font_face": "Source Code Pro",'
echo '  "font_size": 10'

echo "\n* Finished :)\n"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .