11

I have a Python application running on an AWS EC2 (Amazon Linux, Elastic Beanstalk) instance that requires certain specific fonts to produce output and wonder how to install them as part of the deployment or instance launching process.

My code, running on my local machine (OS X) uses

'Arial Unicode MS'
'Open Sans'

as fonts. But these fonts are not present by default on EC2 (I only see DejavuSans and DejvuSerif in /usr/share/fonts), and it is not clear to me either what packages might include the fonts I need, or how to install them.

How do I install those two fonts on EC2, preferably using yum or a command or container_command as part of the deployment/instaitation process specified on an .ebextensions/*.config file?

orome
  • 45,163
  • 57
  • 202
  • 418
  • It may be easier to package the font files with your application and load them when needed. Due to copyrights, only open sans will likely be available in any linux packages. – datasage Feb 02 '15 at 03:11

4 Answers4

14

This is an old question but since no one answered it, the following worked for me.

Create a fonts/ folder in your application and fill it with the font(s) you want. Create a .ebextensions/copy_fonts.config file that looks like:

container_commands:
    copy_fonts:
        command: "cp fonts/*.ttf /usr/share/fonts/"
Scott
  • 306
  • 3
  • 5
1

I am currently using this code snippet. Just simply find your font on web and repalce the link and its name. Hope this can help.

  container_commands:
    01_download_nanum_font:
      command: wget http://static.campaign.naver.com/0/hangeul/renew/download/NanumFont_TTF.zip 
    02_unzip_font:
      command: unzip Nanum*.zip
    03_creat_fontdir:
      command: mkdir -p /usr/share/fonts/nanumfont
    04_mv_font:
      command: mv *.ttf /usr/share/fonts/nanumfont
    05_add_font_cache:
      command: fc-cache -r
Diya Li
  • 1,048
  • 9
  • 21
0

Another options is to install the font via package (if it is available). You can declare it in your .ebextensions/install_pacakges.config

Example:

commands:
  gnu-free-serif-fonts:
    command: rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/gnu-free-serif-fonts-20120503-8.el7.noarch.rpm
Zvika Badalov
  • 193
  • 2
  • 2
  • 11
0

I think the command requires a flag, i.e. -R.

container_commands:
    01_copy_otf:
        command: "cp -R ./src/public/css/fonts/ /usr/share/fonts/" 
Alain Bianchini
  • 3,883
  • 1
  • 7
  • 27
kevin
  • 1
  • 1
  • 1