diff --git a/README.md b/README.md index 7991910c35a833525aca484f728647676cadd362..b3035f5a19a4394372effd710bc95acc683586d9 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,23 @@ $ client/FontMaker_Cli.exe > 目前这个命令行软件还不支持输入参数进行定制生成字库文件,运行后默认使用的参数如下: > > 字体:幼圆 + > 字号:16 像素 + > 字重:普通(不加粗、不斜体、无下划线) + > 字符宽度:固定 + > 字符宽度:16 像素 + > 字符高度:16 像素 + > 水平偏移:0 像素 + > 垂直偏移:0 像素 + > 扫描方式:行扫描 + > 字节顺序:高位在前 #### 使用电脑测试 diff --git a/abconfig b/abconfig new file mode 100644 index 0000000000000000000000000000000000000000..70d320a14c48291594d533733d62e681e16520f6 --- /dev/null +++ b/abconfig @@ -0,0 +1,2 @@ +# client/combined.bin +drivers/ssd1306.py diff --git a/client b/client index f41014c6c12440894152b05dac4c65843238d2ed..cc516ad64bbd2810db4422b0e431c2014fbda1e9 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit f41014c6c12440894152b05dac4c65843238d2ed +Subproject commit cc516ad64bbd2810db4422b0e431c2014fbda1e9 diff --git a/fontlib.py b/fontlib.py index 1620d561ccb1d42c83a031b16bcf3399f728a34c..5ecae72b7feeeb5d55daf0c599bda1cbb8e3f5c7 100644 --- a/fontlib.py +++ b/fontlib.py @@ -72,7 +72,7 @@ class FontLib(object): self.__header = None with open(self.__font_filename, 'rb') as font_file: - self.__header = FontLibHeader(font_file.read(FontLibHeader.LENGTH)) + self.__header = FontLibHeader(memoryview(font_file.read(FontLibHeader.LENGTH))) self.__placeholder_buffer = self.__get_character_unicode_buffer(font_file, {ord('?')})[0][1] gc.collect() @@ -86,17 +86,24 @@ class FontLib(object): def __get_character_unicode_buffer(self, font_file, unicode_set): buffer_list = [] + def __seek(data, target): + for index in range(0, 1000, 2): + if data[index: index + 2] == target: + return offset + index + else: + return 0 + for unicode in unicode_set: if self.__is_ascii(unicode): char_offset = self.__header.ascii_start + (unicode - 0x20) * self.__header.data_size elif self.__is_gb2312(unicode): - gb2312_index = struct.pack('