Skip to content

Converting True Type Font to PNG using Ruby

Notifications You must be signed in to change notification settings

lxyzzhao/ttf2png

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert True Type Font(.ttf) to png using "convert" command in Imagemagick.

It's pretty simple and easier to use RMagick.

####Usage

ruby ttf2png.rb 1 then ls *.png

Simply type ruby ttf2png.rb, this is equivalent to specify no-operation flag. So you can see all commands to execute.

####Mechanism

This image was created by following command.

convert -background none -fill black -font yubimoji.ttf -pointsize 300 label:"あ" あ.png

####Perl Sample Want to convert 'U+E001' to png, type following command (perl required):

perl -e 'binmode(STDOUT, ":utf8"); print "\x{E001}";' | convert -background none -fill black -font YourFont.ttf -pointsize 300 label:@- foo.png

You can get code point via "Font Book" app in your Mac.

About

Converting True Type Font to PNG using Ruby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%