@pythoncoder thank you very much for your reply and for your help
I missed to say that I can complete with success all the examples in the
Getting Started section.
So I installed successfully "micropython-oled" via upip, as you stated.
My problem is only in the generation of the font.py file.
Since I have your attention, can you please help me solving this trouble?
The gen.py file in that package creates a font.py file with this format:
Code: Select all
_FONT = {
48: [8, 65535, 65535, 65535, 65535, 61455, 62415, 53235, 53235, 53235, 53235, 53235, 53235, 62415, 61455, 65535, 65535, 65535],
49: [8, 65535, 65535, 65535, 65535, 62463, 61503, 61455, 62463, 62463, 62463, 62463, 62463, 62463, 62463, 65535, 65535, 65535],
50: [8, 65535, 65535, 65535, 65535, 61455, 53187, 53247, 53247, 62463, 64767, 65343, 65487, 65523, 49155, 65535, 65535, 65535],
51: [8, 65535, 65535, 65535, 65535, 61455, 53235, 53247, 53247, 61503, 50175, 53247, 53247, 50163, 61455, 65535, 65535, 65535],
52: [8, 65535, 65535, 65535, 65535, 62463, 61695, 62271, 62415, 62415, 62451, 62460, 49152, 62463, 62463, 65535, 65535, 65535],
53: [8, 65535, 65535, 65535, 65535, 49155, 65523, 65523, 64515, 62463, 53247, 53247, 53247, 50163, 61455, 65535, 65535, 65535],
...
This is ubuntu_15.py font.
For the icons, in the description of the package, there is another example:
Code: Select all
_FONT = {
'battery-empty': [20, 1099511627775, 1099511627775, 1099511627775, 824633720832, 824633720832, 17179869168, 17179869168, 68719476720, 68719476720, 17179869168, 17179869168, 824633720832, 824633720832, 1099511627775],
}
This kind of file is very different from a font python file generated with another tool that I have found online
(micropython font to file
https://github.com/peterhinch/micropython-font-to-py)
which is similar to this:
Code: Select all
# Code generated by font-to-py.py.
# Font: Courier Prime.ttf
version = '0.2'
def height():
return 20
def max_width():
return 14
def hmap():
return True
def reverse():
return False
def monospaced():
return True
def min_ch():
return 32
def max_ch():
return 126
_font =\
b'\x0e\x00\x00\x00\x00\x00\x7c\x00\xfe\x00\xc7\x00\xc3\x00\x03\x00'\
b'\x07\x00\x1e\x00\x18\x00\x18\x00\x18\x00\x3c\x00\x3c\x00\x18\x00'\
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00'\
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x60\x00\x60\x00\x60\x00'\
b'\x60\x00\x60\x00\x60\x00\x60\x00\x60\x00\x00\x00\x60\x00\xf0\x00'\
b'\xf0\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00'\
b'\x00\x00\x00\x00\xe6\x00\xe6\x00\x66\x00\x66\x00\x66\x00\x66\x00'\
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x03\x30\x02\x20'\
...
I am aiming to obtain a string like this:
48: [8, 65535, 65535, 65535, 65535, 61455, 62415, 53235, 53235, 53235, 53235, 53235, 53235, 62415, 61455, 65535, 65535, 65535],
which looks very different from this
b'\x0e\x00\x00\x00\x00\x00\x7c\x00\xfe\x00\xc7\x00\xc3\x00\x03\x00'\
I imagine that these are both two methods for draw pixels on the OLED but I cannot generate the first (via gen.py or anything else, since I don't know what to search for), and I cannot manage easily the second (I am not able to input a unicode character with the awesome font and to obtaining his font.py file), so I am stucked.
Every help is very appreciated.
Thank you very much