Skip to content

Commit 8ad20bf

Browse files
committed
Paragraph on mapping added
1 parent d8953cd commit 8ad20bf

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

README.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ as follows:
119119

120120
```python
121121
class PyFont(object):
122-
def __init__(self, font, index, vert, horiz, fixed, revbit):
122+
def __init__(self, font, index, vert, horiz, vmap, revbit):
123123
self._bits_horiz = horiz # Width of monospaced char or 0 if variable
124124
self._bits_vert = vert # Height of all chars
125-
self._fixed = fixed # Fixed pitch
125+
self._vmap = vmap # Vertical map
126126
self._revbit = revbit # Bit reversal of font bytes
127127
self._index = index
128128
self._font = font
@@ -134,7 +134,7 @@ class PyFont(object):
134134
return addressof(self._font) + offset, self._bits_vert, char_width
135135

136136
def get_properties(self):
137-
return self._bits_vert, self._bits_horiz, self._fixed, self._revbit
137+
return self._bits_vert, self._bits_horiz, self._vmap, self._revbit
138138
```
139139

140140
The device driver calls the ``get_ch`` method for each character in a string.
@@ -150,10 +150,30 @@ has the following outline definition (in practice the bytes objects are large):
150150
import pyfont
151151
_myfont = b'\x00\x00`
152152
_myfont_index = b'\x00\x00\x23\x00\`
153-
myfont = pyfont.PyFont(_myfont, _myfont_index, 24, 0, False, False)
153+
myfont = pyfont.PyFont(_myfont, _myfont_index, 24, 0, True, False)
154154

155155
```
156156

157+
## Mapping
158+
159+
A character occupies a space where (0, 0) represents the coordinates of the top
160+
left hand corner of the bitmap. It comprises a set of pixels where increasing x
161+
values represent locations to the right of the origin and increasing y values
162+
represent downward positions. Mapping is the process whereby this two
163+
dimensional array of bits is transformed into a linear sequence of bytes.
164+
165+
Vertical mapping means that the LSB of first byte is pixel (0,0), MSB of first
166+
byte is (0, 7). The second byte (assuming the height is greater than 8 pixels)
167+
is (0, 8) to (0, 15). Once the column is complete the next byte represents
168+
(1, 0) to (1, 7).
169+
170+
Horizontal mapping means that the MSB of byte 0 is pixel (0,0) with LSB at
171+
(7,0), with the second byte covering (8, 0) to (15, 0) if the width is greater
172+
than 8.
173+
174+
Bit reversal provides for the case where the bit order of each byte is reversed
175+
i.e. a byte comprising bits [b7b6b5b4b3b2b1b0] becomes [b0b1b2b3b4b5b6b7].
176+
157177
# Specification Notes
158178

159179
The design aims primarily to minimise RAM usage. Minimising the size of the

0 commit comments

Comments
 (0)