Converter for hex font (unscii, unifont)

I just (re)wrote my font converter for hex font (unscii, unifont)., so that you don’t need to go hex -> ttf -> lv_font

If you found it useful it’s here:


Can you send a pull request to lv_utils to update the script?

forgot I had it here, I’m sending a pull request. I’ll let you update the

Merged, thank you! :slight_smile:

I am trying to use but running into problems.

$ ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

When I execute the program I get the following.

$ ruby hex2lvfont.rb unscii-8.hex --height 8 --bpp 1 
hex2lvfont.rb:52:in `from_hex': undefined method `unpack1' for #<String:0x00000001764ed0> (NoMethodError)
Did you mean?  unpack
	from hex2lvfont.rb:64:in `block in from_hexfile'
	from hex2lvfont.rb:62:in `foreach'
	from hex2lvfont.rb:62:in `with_index'
	from hex2lvfont.rb:62:in `each'
	from hex2lvfont.rb:62:in `map'
	from hex2lvfont.rb:62:in `from_hexfile'
	from hex2lvfont.rb:433:in `<main>'

Maybe the steps I did are not correct.

  1. Go to website
  2. Select unscii-8 - the hex format
  3. A window in browser opens that contains all the hex data.
  4. Select all the text displayed
  5. Copy the selected text to Text Editor and Save file with name unscii-8.hex
  6. The use this hex file to convert.

Also from the program --help

  1. Can you give example what you expect for range?
  2. What is set used for?
  3. What is baseline used for?

unpack1 is defined in ruby >= 2.4.
doc says: Decodes str (which may contain binary data) according to the format string, returning the first value extracted. See also String#unpack , Array#pack .

it should be possible to replace unpack1 or monkey patch the string class. The following should do the trick:

class String
  def unpack1(format)
1 Like