added initial support for kerning tables

This commit is contained in:
farisawan-2000 committed 2020-12-28 17:40:57 -05:00
1 parent 2710f4e36a
commit be343003fc
2 files changed
+102 -20

No files matched your search

+100 -19
View File
@@ -1,20 +1,101 @@
char impact_kerning_table[] = {
// unprintable characters
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
// start of ascii
2, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
};
// unprintable characters
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
/* */ 8,
/* ! */ 3,
/* " */ 6,
/* # */ 9,
/* $ */ 7,
/* % */ 9,
/* & */ 8,
/* ' */ 3,
/* ( */ 4,
/* ) */ 4,
/* * */ 4,
/* + */ 6,
/* , */ 3,
/* - */ 5,
/* . */ 3,
/* / */ 4,
/* 0 */ 6,
/* 1 */ 5,
/* 2 */ 6,
/* 3 */ 6,
/* 4 */ 6,
/* 5 */ 6,
/* 6 */ 7,
/* 7 */ 5,
/* 8 */ 6,
/* 9 */ 7,
/* : */ 3,
/* ; */ 3,
/* < */ 5,
/* = */ 7,
/* > */ 5,
/* ? */ 6,
/* @ */ 10,
/* A */ 7,
/* B */ 7,
/* C */ 7,
/* D */ 7,
/* E */ 5,
/* F */ 5,
/* G */ 7,
/* H */ 7,
/* I */ 3,
/* J */ 3,
/* K */ 6,
/* L */ 5,
/* M */ 9,
/* N */ 7,
/* O */ 7,
/* P */ 6,
/* Q */ 7,
/* R */ 6,
/* S */ 6,
/* T */ 6,
/* U */ 7,
/* V */ 6,
/* W */ 10,
/* X */ 7,
/* Y */ 7,
/* Z */ 5,
/* [ */ 4,
/* \ */ 4,
/* ] */ 4,
/* ^ */ 7,
/* _ */ 8,
/* ` */ 3,
/* a */ 6,
/* b */ 6,
/* c */ 6,
/* d */ 6,
/* e */ 6,
/* f */ 4,
/* g */ 6,
/* h */ 6,
/* i */ 3,
/* j */ 4,
/* k */ 6,
/* l */ 3,
/* m */ 9,
/* n */ 6,
/* o */ 6,
/* p */ 6,
/* q */ 6,
/* r */ 4,
/* s */ 6,
/* t */ 4,
/* u */ 6,
/* v */ 6,
/* w */ 8,
/* x */ 6,
/* y */ 5,
/* z */ 4,
/* { */ 3,
/* | */ 3,
/* } */ 3,
/* ~ */ 6,
};
+2 -1
View File
@@ -72,7 +72,8 @@ void s2d_snprint(int x, int y, const char *str, uObjMtx *buf, int len) {
break;
default:
if (current_char != '\0') {
draw_s2d_glyph(current_char, (x += (s2d_kerning_table[current_char] * myScale)), y, (buf++));
draw_s2d_glyph(current_char, x, y, (buf++));
(x += (s2d_kerning_table[current_char] * myScale));
}
}
if (*p == '\0') break;