Files
ComputerCraft-Utf8/README.md
2025-11-12 12:06:16 +08:00

31 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 介绍
此仓库克隆自https://github.com/AAAB60/computer-craft-programs/tree/main
对其进行修改以共liulikeji程序使用
## 以下为原本介绍
一个基于像素打印的utf8打印程序
> $\color{red} \bf 注意:$
> CC 编译器会把utf8字符读作 '?',
> `print("你好世界")` 与 `print("????")` 的效果相同, 可以`"rb"`模式读取文件以设置输入
## 如何制作Font
- 字体文件返回一个table键值为utf8编码值为和对应字体的bitmap。
- bitmap为一个包含等长string的tablestring中的char属于computer craft定义的2*3像素点阵如需使用右下角像素将char的码值减128表示反转backgroundColor 和 textColor
- 单个字体文件中可以有不同尺寸的bitmap且**需要**有'H'(ascII:72)的bitmap表示该文件中最大bitmap高度
- 会以FontFamily出现的最大bitmap高度为基准最终输出下对齐的文本
- FontFamily中**需要**'-'(ascII:45)的bitmap以供自动换行时可能的切断单词使用
## 技术细节
- `require`一个fusion-pixel-12px字体大约消耗**10.5MB**内存
- `require`一个fusion-pixel-8px字体大约消耗**6MB**内存
- 8px字符实际占用3格高的字符数, 12px字符实际占用4格高
- 字体来自 <a href="https://github.com/TakWolf/fusion-pixel-font/releases"> fusion-pixel-font </a>