bitmap font parser
- BDF
- Vertical alignment (i.e. overhang) (rendering)
- Add the dependency to your
shard.yml
:
dependencies:
fontanyl:
github: fliegermarzipan/fontanyl
- Run
shards install
require "fontanyl"
def render(bitmap)
# The generated bitmap is an array of lines-of-text
bitmap.each do |line|
# Each text line contains several Y-scanlines
# as an Array(Bool) bitmap
line.each { |e| puts e.map { |i| i ? '#' : ' ' }.join }
end
end
# Load BDF font from file
font = Fontanyl::BDF.new("font.bdf")
# Generate bitmap of string using loaded font
# and pass it to our render() function that maps the bits
# to ascii-art text
render font.get_bitmap("Hello, World")
TODO: Write development instructions here
- Fork it (https://github.com/fliegermarzipan/fontanyl/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Robin Broda - creator and maintainer