add examples

This commit is contained in:
sonil 2022-11-11 18:57:48 +08:00
parent 99cc193e57
commit 0c6057c2ae
8 changed files with 115 additions and 1 deletions

55
fonts/chs/font.ini Normal file
View File

@ -0,0 +1,55 @@
[font0]
maxHeight= 10
maxWidth= 10
lineSpacing=0
wordSpacing=4
letterSpacing=1
heightOffset=0
fileName=font.ttf
warpMode=0
encoding=GBK
[font1]
maxHeight= 12
maxWidth= 12
lineSpacing=1
wordSpacing=4
letterSpacing=1
heightOffset=1
fileName=zpix.ttf
warpMode=1
encoding=GBK
[font2]
maxHeight= 15
maxWidth= 15
lineSpacing=1
wordSpacing=3
letterSpacing=1
heightOffset=0
fileName=font.ttf
warpMode=0
encoding=GBK
[font3]
maxHeight= 15
maxWidth= 15
lineSpacing=1
wordSpacing=4
letterSpacing=1
heightOffset=0
fileName=font.ttf
warpMode=0
encoding=GBK
[font4]
maxHeight= 22
maxWidth= 22
lineSpacing=1
wordSpacing=12
letterSpacing=1
heightOffset=0
fileName=font.ttf
warpMode=0
encoding=GBK

BIN
fonts/chs/font.ttf Normal file

Binary file not shown.

BIN
fonts/chs/zpix.ttf Normal file

Binary file not shown.

Binary file not shown.

BIN
fonts/english/TT0807M_.TTF Normal file

Binary file not shown.

55
fonts/english/font.ini Normal file
View File

@ -0,0 +1,55 @@
[font0]
maxHeight=10
maxWidth=10
lineSpacing=0
wordSpacing=4
letterSpacing=1
heightOffset=0
fileName=r_fallouty.ttf
warpMode=0
encoding=GBK
[font1]
maxHeight=12
maxWidth=12
lineSpacing=0
wordSpacing=4
letterSpacing=1
heightOffset=0
fileName=r_fallouty.ttf
warpMode=0
encoding=GBK
[font2]
maxHeight=15
maxWidth=15
lineSpacing=1
wordSpacing=3
letterSpacing=1
heightOffset=0
fileName=r_fallouty.ttf
warpMode=0
encoding=GBK
[font3]
maxHeight=15
maxWidth=15
lineSpacing=1
wordSpacing=4
letterSpacing=1
heightOffset=0
fileName=r_fallouty.ttf
warpMode=0
encoding=GBK
[font4]
maxHeight=24
maxWidth=24
lineSpacing=1
wordSpacing=12
letterSpacing=1
heightOffset=0
fileName=TT0807M_.TTF
warpMode=0
encoding=GBK

Binary file not shown.

View File

@ -40,6 +40,7 @@ typedef struct FtFontDescriptor {
unsigned char* filebuffer; unsigned char* filebuffer;
int maxHeight; int maxHeight;
int maxWidth;
int letterSpacing; int letterSpacing;
int wordSpacing; int wordSpacing;
int lineSpacing; int lineSpacing;
@ -244,6 +245,9 @@ static int FtFontLoad(int font_index)
if (!configGetInt(&config, string, "maxHeight", &desc->maxHeight)) { if (!configGetInt(&config, string, "maxHeight", &desc->maxHeight)) {
return -1; return -1;
} }
if (!configGetInt(&config, string, "maxWidth", &desc->maxWidth)) {
desc->maxWidth = desc->maxHeight;
}
if (!configGetInt(&config, string, "lineSpacing", &desc->lineSpacing)) { if (!configGetInt(&config, string, "lineSpacing", &desc->lineSpacing)) {
return -1; return -1;
} }
@ -301,7 +305,7 @@ static int FtFontLoad(int font_index)
FT_New_Memory_Face(desc->library, desc->filebuffer, fileSize, 0, &desc->face); FT_New_Memory_Face(desc->library, desc->filebuffer, fileSize, 0, &desc->face);
FT_Select_Charmap(desc->face, FT_ENCODING_UNICODE); FT_Select_Charmap(desc->face, FT_ENCODING_UNICODE);
FT_Set_Pixel_Sizes(desc->face, desc->maxHeight, desc->maxHeight); FT_Set_Pixel_Sizes(desc->face, desc->maxWidth, desc->maxHeight);
fileClose(stream); fileClose(stream);
configFree(&config); configFree(&config);