fontanyl

bitmap font parser lib

fontanyl

bitmap font parser

Details

Currently supported formats

  • BDF

Known missing features

  • Vertical alignment (i.e. overhang) (rendering)

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  fontanyl:
    github: fliegermarzipan/fontanyl
  1. Run shards install

Usage

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")

Development

TODO: Write development instructions here

Contributing

  1. Fork it (https://github.com/fliegermarzipan/fontanyl/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

fontanyl

Owner
Statistic
  • 0
  • 1
  • 0
  • 0
  • 0
  • almost 6 years ago
  • December 7, 2018
License

GNU Affero General Public License v3.0

Links
Synced at

Thu, 07 Nov 2024 22:07:30 GMT

Languages