Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I install specific fonts on my AWS EC2 instance?

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?

like image 762
orome Avatar asked Feb 02 '15 02:02

orome


2 Answers

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/"
like image 72
Scott Avatar answered Sep 29 '22 13:09

Scott


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
like image 24
Dylan Avatar answered Sep 29 '22 13:09

Dylan