Make a new larger font for Waveshare SPI e-Paper
There are five fonts (font8, font12, font16, font20 and font24) provided for e-Paper. Some users just want to make their customized fonts or bigger font, but have no idea about how to do it.
This Blog, I will tell you how the provided fonts works and how to make a new bigger font.
This Blog, I will tell you how the provided fonts works and how to make a new bigger font.
How do the fonts provided works?
To draw a
character on dots matrix screen, it works like to draw many dots on screen and make it
look like a character. Just like this: we draw every “pixel” to white (for visibility I set it Yellow)or black,
and finally we get the character “T”.
As you can see,
we set the paint area to 9(wide) x 20 (wide). White is 0 and black is 1, then we
can get a set of binary value for every raw, convert them to HEX format,
we can get the value as the fonts file. Note that one HEX value stand for
8bits, if the last bits are less than 8, we could extend it. We say it is scanning
from left to right and top to bottom:
We take the
font24 as example. The fonts we used are created by MCD Application Team. Its scanning way is from left to right and from top to bottom as well.
Make new font
In this way, we
can make a larger font manually, or use tool. Like this one, as the software only
supports Chinese, I don’t provide it. The character I made is 24 wide and 40
height.
The next step we need to add the font40.c to libraries. We name it Font40_Table[ ] and add the Font40 structure
Add it to heard
file and don’t forget to update the max height/width font value
Then we could
use it on the code.
Effect
Draw char function
Some users what to
make fonts for special character or other language. The most information things
which they should consider about is how to calling the values of fonts on functions and turn it to
pixels drawing.
The fonts we make above is all ASCII characters, and they stored in arrays in order of ASCII table from 32 (space) to 127 (DEL).
ASCII
|
Character
|
ASCII
|
Character
|
ASCII
|
Character
|
ASCII
|
Character
|
0
|
NUT
|
32
|
(space)
|
64
|
@
|
96
|
、
|
1
|
SOH
|
33
|
!
|
65
|
A
|
97
|
a
|
2
|
STX
|
34
|
"
|
66
|
B
|
98
|
b
|
3
|
ETX
|
35
|
#
|
67
|
C
|
99
|
c
|
4
|
EOT
|
36
|
$
|
68
|
D
|
100
|
d
|
5
|
ENQ
|
37
|
%
|
69
|
E
|
101
|
e
|
6
|
ACK
|
38
|
&
|
70
|
F
|
102
|
f
|
7
|
BEL
|
39
|
,
|
71
|
G
|
103
|
g
|
8
|
BS
|
40
|
(
|
72
|
H
|
104
|
h
|
9
|
HT
|
41
|
)
|
73
|
I
|
105
|
i
|
10
|
LF
|
42
|
*
|
74
|
J
|
106
|
j
|
11
|
VT
|
43
|
+
|
75
|
K
|
107
|
k
|
12
|
FF
|
44
|
,
|
76
|
L
|
108
|
l
|
13
|
CR
|
45
|
-
|
77
|
M
|
109
|
m
|
14
|
SO
|
46
|
.
|
78
|
N
|
110
|
n
|
15
|
SI
|
47
|
/
|
79
|
O
|
111
|
o
|
16
|
DLE
|
48
|
0
|
80
|
P
|
112
|
p
|
17
|
DCI
|
49
|
1
|
81
|
Q
|
113
|
q
|
18
|
DC2
|
50
|
2
|
82
|
R
|
114
|
r
|
19
|
DC3
|
51
|
3
|
83
|
S
|
115
|
s
|
20
|
DC4
|
52
|
4
|
84
|
T
|
116
|
t
|
21
|
NAK
|
53
|
5
|
85
|
U
|
117
|
u
|
22
|
SYN
|
54
|
6
|
86
|
V
|
118
|
v
|
23
|
TB
|
55
|
7
|
87
|
W
|
119
|
w
|
24
|
CAN
|
56
|
8
|
88
|
X
|
120
|
x
|
25
|
EM
|
57
|
9
|
89
|
Y
|
121
|
y
|
26
|
SUB
|
58
|
:
|
90
|
Z
|
122
|
z
|
27
|
ESC
|
59
|
;
|
91
|
[
|
123
|
{
|
28
|
FS
|
60
|
<
|
92
|
/
|
124
|
|
|
29
|
GS
|
61
|
=
|
93
|
]
|
125
|
}
|
30
|
RS
|
62
|
>
|
94
|
^
|
126
|
`
|
31
|
US
|
63
|
?
|
95
|
_
|
127
|
DEL
|
We can see, we get the offset value of the characters by minus character ‘ ‘ (space)* the numbers of HEX data per character.
For example, if we want to draw a char A, we know that its ASCII value is 65 according to the above table. And in the fonts the first character is ‘ ‘ (space) which ASCII value is 32. We get the offset 33 (65-32). And we know that, the font40 wide 24 and height 40, we can get that 24x40 = 960 bits for every character, and because we save it in HEX format, so we can get that, for every character, it has 960/8 = 120 HEX values. With this we can get the address of first data of character “A” is 33 x 120 = 3960. So Font40_Table[3960] is the first HEX data of character “A”. That is how the function working with the fonts.
If you want to make a new fonts for other characters which are not inclued in the ASCII table, you need to change this function to get the right values.
hello i have created single letter as you did but i am not getting the letter .send me the solution to thrishulgudelli@gmail.com
回复删除ok, i like it
回复删除very much
Arrows RC airplane
Atten soldering gun
Dynam RC airplane
Kerui GSM alarm
Freewing RC jet
Hobbystar Motor
Like the other naturally procured juices that help you face a drug test with confidence, cranberry juice can quickly cleanse your body of objectionable substances. It will not camouflage or hide the presence of THC in your system, but rather it will simply flush out the toxins as rapidly and effectively as possible.The goal is to urinate frequently so that you cleanse your body of toxins. For this, you can consume cranberry juice with several glasses of water. Cranberry juice can also be gulped down with electrolytes, like a sports drink, to ensure maximum urination. This will ensure that no toxin is left behind.Regular consumers prefer to push the envelope a little more by adding Vitamin-B supplements to their routine. This ensures that the color of urine is more natural and thus prevents any doubts about the watered-down urine.laweekly.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-11.03.19-AM-600x244.png 600w" sizes="(max-width: 1500px) 100vw, 1500px" /> Feel free to hide your urine bottle in their secret stash undies — designed like normal underwear, only it has a deep pocket. Or make your way to the lab facility with the bottle stashed in Quick Fix’s special leg strap. No one will know, unless, of course, you let them know! <img class="size-full wp-image-470655 aligncenter" src="https://www.laweekly.
回复删除The Wynn Casino is now open in Las Vegas
回复删除The Wynn Casino is now open in Las Vegas. With a total of 571 gaming tables and 속초 출장안마 over 2,200 광명 출장마사지 slot 구미 출장샵 machines, this Las 충청남도 출장안마 Vegas hotel, 김포 출장안마 casino,