Closed mchobby closed 8 years ago
One character is rectangular I/O object. So, 2 bytes (one position) in tuple is one vertical pixel line in char. Better if I show in python code:
for line in Arial_14['65']: . . . print(bin(line)) . . . '0b100110000000000' '0b100001100000000' '0b100000111000000' '0b100000100111000' '0b100000100000100' '0b100000100111000' '0b100000111000000' '0b100001100000000' '0b100110000000000'
Then turn this rectangle into 90 degrees to the left and you will see 'A' character. Driver slices every line as string from '0b1' and than we have a quiet normal char in rectangular filling. But before we must replace zeros as 'bgcolor' tuples, otherwise (high levels) as character 'color'.
More obvious now.
The first bit (left most one) in '0b1' is to 1 because we don't care it's value since the font has 14 pixels height. So we only care about the 14 bits on the right.
Thanks
I'm getting some initial result around font. At this stage I'm loading a FreeType font and rendering the bitmap representation. Shortly, I will generate the xxx.py font file for the driver.
c:\Python\freetype-test>python freetype-generator.py
Load font Vera.ttf, set size to 19
max size (width,height): 18,19
--- w ----------------
width, height = 14, 10
** ** **
** ** **
** **** **
** **** **
** * * **
** ** ** **
** ** ** **
*** ***
*** ***
*** ***
--- W ----------------
width, height = 18, 14
** **** **
** **** **
** **** **
** **** **
** ** ** **
** ** ** **
** ** ** **
** ** ** **
** ** ** **
** ** ** **
**** ****
**** ****
*** ***
Hi Roman, I'm planning to work on easy font creation by using a python script. The plan is to extract the font from a structured bmp in order to create a font_xx.py file for the PyBoard.
However, I do need your help to understand the coding of your existing font.
So 182 bits or 30 bytes per character. In the sample here under....
However, I cannot figure out how the character is encoded. Could you help me with the encoding/decoding method?
Thanks