https://github.com/coderobe/fontanyl
bitmap font parser lib
https://github.com/coderobe/fontanyl
Last synced: 10 months ago
JSON representation
bitmap font parser lib
- Host: GitHub
- URL: https://github.com/coderobe/fontanyl
- Owner: coderobe
- License: agpl-3.0
- Created: 2018-12-07T07:43:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-16T22:33:38.000Z (about 7 years ago)
- Last Synced: 2025-01-26T11:44:27.212Z (12 months ago)
- Language: Crystal
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`:
```yaml
dependencies:
fontanyl:
github: fliegermarzipan/fontanyl
```
2. Run `shards install`
## Usage
```crystal
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 ()
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
- [Robin Broda](https://github.com/coderobe) - creator and maintainer