
실행하여 글꼴을 다운로드했습니다.
wget http://www.fontsquirrel.com/fonts/download/amatic
내 EC2 인스턴스 내에서. 그런 다음 .fonts 디렉토리를 생성하고 그 안에 파일의 압축을 풀었습니다. 그 다음에는 ls .fonts
글꼴 파일이 있습니다. 그런 다음 실행하여 fc-cache -f -v
다음과 같은 결과를 얻었습니다.
/usr/share/fonts: caching, new cache contents: 0 fonts, 3 dirs
/usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs
/usr/share/fonts/cmap/adobe-cns1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-gb1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-japan1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-japan2: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap/adobe-korea1: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/truetype/dejavu: caching, new cache contents: 6 fonts, 0 dirs
/usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/home/ubuntu/.local/share/fonts: skipping, no such directory
/home/ubuntu/.fonts: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts: caching, new cache contents: 0 fonts, 3 dirs
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/home/ubuntu/.local/share/fonts: skipping, no such directory
/home/ubuntu/.fonts: caching, new cache contents: 2 fonts, 0 dirs
/var/cache/fontconfig: not cleaning unwritable cache directory
/home/ubuntu/.cache/fontconfig: cleaning cache directory
/home/ubuntu/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
그런 다음 글꼴이 적용되었는지 확인하기 위해 브라우저로 이동했지만 여전히 아무것도 없습니다. 실행하면 fc-list
거기에 나열된 글꼴을 볼 수 있지만 Rails 앱에는 표시되지 않습니다. 그러나 ruby test.rb
동일한 이미지 처리 코드가 포함된 Ruby 스크립트를 실행하면 잘 실행되고 글꼴도 내가 원하는 것이지만 유일한 문제는 내 Rails 애플리케이션에 있다는 것을 알았습니다 . Rails 애플리케이션을 다시 시작했지만 문제가 지속됩니다.
이미지 처리에 이 글꼴을 사용하고 있습니다.
이게 내 코드야
txt = "Sushant"
overlay = Magick::Image.read("stamp.png").first
title = Magick::Draw.new
if txt.length <= 7
title.annotate(overlay, 0,0,120,200, txt) {
self.font_family = 'Amatic SC'
self.fill = 'white'
self.pointsize = 160
}
else
title.annotate(overlay, 0,0,0,200, txt) {
self.font_family = 'Amatic SC'
self.fill = 'white'
self.pointsize = 155
}
end
img = overlay.write('newimg.gif')