使用位图字体
# 下载位图字体编辑软件
下载bmfonthttps://www.angelcode.com/products/bmfont/ (opens new window)
运行bmfont 的界面
# 编辑位图
1.准备位图图片,示例准备了[+、-、0-9] 十二张图片
注意
每张图片的宽度和高度必须一致
2.导入位图图片,点击菜单Edit->Open Image Manager,弹出Image Manager对话框
3.点击菜单Image->Import image,依次选择要导入的位图图片
注意
id 为字符的ASCII码
4.导出字体 1.点击菜单Options->Font Settings设置字体大小,一般为位图的大小
2.点击菜单Options->Export Options = 32位
ARGB = glyph
Texture = png - Portable Network Graphics
3.点击菜单Options->Save bitmap font as...,保存类型 = Bitmap font(*.fnt)
会在保存目录生成二个文件**.fnt和.png**
# 在编辑器内使用位图字体
把字体文件和对应的png文件拖入到编辑器中。设置控件的Theme Overrides为fnt文件
# ASCII码对应表
注意
某些特殊字符无法显示
字符 | 十进制 | 十六进制 |
---|---|---|
0 | 00 | |
1 | 01 | |
2 | 02 | |
3 | 03 | |
4 | 04 | |
5 | 05 | |
6 | 06 | |
7 | 07 | |
8 | 08 | |
9 | 09 | |
10 | 0a | |
11 | 0b | |
12 | 0c | |
13 | 0d | |
14 | 0e | |
15 | 0f | |
16 | 10 | |
17 | 11 | |
18 | 12 | |
19 | 13 | |
20 | 14 | |
21 | 15 | |
22 | 16 | |
23 | 17 | |
24 | 18 | |
25 | 19 | |
26 | 1a | |
27 | 1b | |
28 | 1c | |
29 | 1d | |
30 | 1e | |
31 | 1f | |
32 | 20 | |
! | 33 | 21 |
" | 34 | 22 |
# | 35 | 23 |
$ | 36 | 24 |
% | 37 | 25 |
& | 38 | 26 |
' | 39 | 27 |
( | 40 | 28 |
) | 41 | 29 |
* | 42 | 2a |
+ | 43 | 2b |
, | 44 | 2c |
- | 45 | 2d |
. | 46 | 2e |
/ | 47 | 2f |
0 | 48 | 30 |
1 | 49 | 31 |
2 | 50 | 32 |
3 | 51 | 33 |
4 | 52 | 34 |
5 | 53 | 35 |
6 | 54 | 36 |
7 | 55 | 37 |
8 | 56 | 38 |
9 | 57 | 39 |
: | 58 | 3a |
; | 59 | 3b |
< | 60 | 3c |
= | 61 | 3d |
> | 62 | 3e |
? | 63 | 3f |
@ | 64 | 40 |
A | 65 | 41 |
B | 66 | 42 |
C | 67 | 43 |
D | 68 | 44 |
E | 69 | 45 |
F | 70 | 46 |
G | 71 | 47 |
H | 72 | 48 |
I | 73 | 49 |
J | 74 | 4a |
K | 75 | 4b |
L | 76 | 4c |
M | 77 | 4d |
N | 78 | 4e |
O | 79 | 4f |
P | 80 | 50 |
Q | 81 | 51 |
R | 82 | 52 |
S | 83 | 53 |
T | 84 | 54 |
U | 85 | 55 |
V | 86 | 56 |
W | 87 | 57 |
X | 88 | 58 |
Y | 89 | 59 |
Z | 90 | 5a |
[ | 91 | 5b |
| | 92 | 5c |
] | 93 | 5d |
^ | 94 | 5e |
_ | 95 | 5f |
` | 96 | 60 |
a | 97 | 61 |
b | 98 | 62 |
c | 99 | 63 |
d | 100 | 64 |
e | 101 | 65 |
f | 102 | 66 |
g | 103 | 67 |
h | 104 | 68 |
i | 105 | 69 |
j | 106 | 6a |
k | 107 | 6b |
l | 108 | 6c |
m | 109 | 6d |
n | 110 | 6e |
o | 111 | 6f |
p | 112 | 70 |
q | 113 | 71 |
r | 114 | 72 |
s | 115 | 73 |
t | 116 | 74 |
u | 117 | 75 |
v | 118 | 76 |
w | 119 | 77 |
x | 120 | 78 |
y | 121 | 79 |
z | 122 | 7a |
{ | 123 | 7b |
124 | ||
} | 125 | 7d |
~ | 126 | 7e |
| 127 | 7f |
# Ascll码生成c#代码
string str = "字符| 十进制 | 十六进制 |" + System.Environment.NewLine;
str += "| ---- | ---- |---- |" + System.Environment.NewLine;
for (char @char = (char)0;@char < 128; @char++)
{
int ten = (int)@char;
string sixteen = ten.ToString("x8").Replace("000000",string.Empty);
str += $"|{@char.ToString()}|{ten}|{sixteen}|" + System.Environment.NewLine;
}
File.WriteAllText("d:/ascll.txt",str,Encoding.UTF8);