Make adding extra characters even easier, add more umlaut and grave characters
108
bin/segment2.c
|
@ -3609,6 +3609,10 @@ ALIGNED8 static const u8 texture_font_normal_char_ca_t[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_ca_t.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ca_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ca_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_cc_ced[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_cc_ced.ia4.inc.c"
|
||||
};
|
||||
|
@ -3621,10 +3625,26 @@ ALIGNED8 static const u8 texture_font_normal_char_ce_c[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_ce_c.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ce_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ce_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ce_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ce_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ci_a[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ci_a.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ci_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ci_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ci_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ci_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_cn_t[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_cn_t.ia4.inc.c"
|
||||
};
|
||||
|
@ -3637,6 +3657,14 @@ ALIGNED8 static const u8 texture_font_normal_char_co_c[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_co_c.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_co_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_co_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_co_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_co_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_co_t[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_co_t.ia4.inc.c"
|
||||
};
|
||||
|
@ -3645,10 +3673,22 @@ ALIGNED8 static const u8 texture_font_normal_char_cu_a[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_cu_a.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_cu_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_cu_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_cu_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_cu_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_cy_a[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_cy_a.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_cy_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_cy_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_la_a[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_la_a.ia4.inc.c"
|
||||
};
|
||||
|
@ -3665,6 +3705,10 @@ ALIGNED8 static const u8 texture_font_normal_char_la_t[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_la_t.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_la_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_la_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_lc_ced[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_lc_ced.ia4.inc.c"
|
||||
};
|
||||
|
@ -3677,10 +3721,26 @@ ALIGNED8 static const u8 texture_font_normal_char_le_c[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_le_c.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_le_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_le_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_le_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_le_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_li_a[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_li_a.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_li_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_li_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_li_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_li_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ln_t[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ln_t.ia4.inc.c"
|
||||
};
|
||||
|
@ -3693,6 +3753,14 @@ ALIGNED8 static const u8 texture_font_normal_char_lo_c[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_lo_c.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_lo_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_lo_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_lo_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_lo_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_lo_t[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_lo_t.ia4.inc.c"
|
||||
};
|
||||
|
@ -3701,10 +3769,22 @@ ALIGNED8 static const u8 texture_font_normal_char_lu_a[] = {
|
|||
#include "textures/segment2/custom_font_normal_char_lu_a.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_lu_g[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_lu_g.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_lu_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_lu_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ly_a[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ly_a.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_ly_u[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_ly_u.ia4.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_font_normal_char_punc_sp_ex[] = {
|
||||
#include "textures/segment2/custom_font_normal_char_punc_sp_ex.ia4.inc.c"
|
||||
};
|
||||
|
@ -3815,31 +3895,51 @@ const u8* const font_normal_chars[] = {
|
|||
texture_font_normal_char_ca_c, // Â
|
||||
texture_font_normal_char_ca_g, // À
|
||||
texture_font_normal_char_ca_t, // Ã
|
||||
texture_font_normal_char_ca_u, // Ä
|
||||
texture_font_normal_char_cc_ced, // Ç
|
||||
texture_font_normal_char_ce_a, // É
|
||||
texture_font_normal_char_ce_c, // Ê
|
||||
texture_font_normal_char_ce_g, // È
|
||||
texture_font_normal_char_ce_u, // Ë
|
||||
texture_font_normal_char_ci_a, // Í
|
||||
texture_font_normal_char_ci_g, // Ì
|
||||
texture_font_normal_char_ci_u, // Ï
|
||||
texture_font_normal_char_cn_t, // Ñ
|
||||
texture_font_normal_char_co_a, // Ó
|
||||
texture_font_normal_char_co_c, // Ô
|
||||
texture_font_normal_char_co_g, // Ò
|
||||
texture_font_normal_char_co_t, // Õ
|
||||
texture_font_normal_char_co_u, // Ö
|
||||
texture_font_normal_char_cu_a, // Ú
|
||||
texture_font_normal_char_cu_g, // Ù
|
||||
texture_font_normal_char_cu_u, // Ü
|
||||
texture_font_normal_char_cy_a, // Ý
|
||||
texture_font_normal_char_cy_u, // Ÿ
|
||||
|
||||
texture_font_normal_char_la_a, // á
|
||||
texture_font_normal_char_la_c, // â
|
||||
texture_font_normal_char_la_g, // à
|
||||
texture_font_normal_char_la_t, // ã
|
||||
texture_font_normal_char_la_u, // ä
|
||||
texture_font_normal_char_lc_ced, // ç
|
||||
texture_font_normal_char_le_a, // é
|
||||
texture_font_normal_char_le_c, // ê
|
||||
texture_font_normal_char_le_g, // è
|
||||
texture_font_normal_char_le_u, // ë
|
||||
texture_font_normal_char_li_a, // í
|
||||
texture_font_normal_char_li_g, // ì
|
||||
texture_font_normal_char_li_u, // ï
|
||||
texture_font_normal_char_ln_t, // ñ
|
||||
texture_font_normal_char_lo_a, // ó
|
||||
texture_font_normal_char_lo_c, // ô
|
||||
texture_font_normal_char_lo_g, // ò
|
||||
texture_font_normal_char_lo_t, // õ
|
||||
texture_font_normal_char_lo_u, // ö
|
||||
texture_font_normal_char_lu_a, // ú
|
||||
texture_font_normal_char_lu_g, // ù
|
||||
texture_font_normal_char_lu_u, // ü
|
||||
texture_font_normal_char_ly_a, // ý
|
||||
texture_font_normal_char_ly_u, // ÿ
|
||||
|
||||
texture_font_normal_char_punc_sp_ex, // ¡
|
||||
texture_font_normal_char_punc_sp_qu, // ¿
|
||||
|
@ -3861,14 +3961,6 @@ const f32 font_normal_widths[] = {
|
|||
0.3750f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.2500f, 0.3125f, 0.3125f, 0.1875f, 0.4375f, 0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.4375f, 0.4375f, 0.3125f, 0.3125f,
|
||||
/* { | } ~ DEL */
|
||||
0.3125f, 0.2500f, 0.3125f, 0.5000f, 0.5000f,
|
||||
|
||||
/* Á Â À Ã Ç É Ê Í Ñ Ó Ô Õ Ú Ü */
|
||||
0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.5000f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f,
|
||||
/* á â à ã ç é ê í ñ ó ô õ ú ü */
|
||||
0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3125f, 0.3125f, 0.2500f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3125f,
|
||||
/* ¡ ¿ */
|
||||
0.3125f, 0.4375f,
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2,43 +2,78 @@
|
|||
#include "game/segment2.h"
|
||||
|
||||
struct SmCodeGlyph {
|
||||
s8 unicode1;
|
||||
s8 unicode2;
|
||||
char unicode[3];
|
||||
char base;
|
||||
};
|
||||
|
||||
struct SmCodeGlyph sSmCodeGlyphs[] = {
|
||||
{ -61, -127 }, // Á
|
||||
{ -61, -126 }, // Â
|
||||
{ -61, -128 }, // À
|
||||
{ -61, -125 }, // Ã
|
||||
{ -61, -121 }, // Ç
|
||||
{ -61, -119 }, // É
|
||||
{ -61, -118 }, // Ê
|
||||
{ -61, -115 }, // Í
|
||||
{ -61, -111 }, // Ñ
|
||||
{ -61, -109 }, // Ó
|
||||
{ -61, -108 }, // Ô
|
||||
{ -61, -107 }, // Õ
|
||||
{ -61, -102 }, // Ú
|
||||
{ -61, -100 }, // Ü
|
||||
{ -61, -95 }, // á
|
||||
{ -61, -94 }, // â
|
||||
{ -61, -96 }, // à
|
||||
{ -61, -93 }, // ã
|
||||
{ -61, -89 }, // ç
|
||||
{ -61, -87 }, // é
|
||||
{ -61, -86 }, // ê
|
||||
{ -61, -83 }, // í
|
||||
{ -61, -79 }, // ñ
|
||||
{ -61, -77 }, // ó
|
||||
{ -61, -76 }, // ô
|
||||
{ -61, -75 }, // õ
|
||||
{ -61, -70 }, // ú
|
||||
{ -61, -68 }, // ü
|
||||
{ -62, -95 }, // ¡
|
||||
{ -62, -65 }, // ¿
|
||||
{ "Á", 'A' },
|
||||
{ "Â", 'A' },
|
||||
{ "À", 'A' },
|
||||
{ "Ã", 'A' },
|
||||
{ "Ä", 'A' },
|
||||
{ "Ç", 'C' },
|
||||
{ "É", 'E' },
|
||||
{ "Ê", 'E' },
|
||||
{ "È", 'E' },
|
||||
{ "Ë", 'E' },
|
||||
{ "Í", 'I' },
|
||||
{ "Ì", 'I' },
|
||||
{ "Ï", 'I' },
|
||||
{ "Ñ", 'N' },
|
||||
{ "Ó", 'O' },
|
||||
{ "Ô", 'O' },
|
||||
{ "Ò", 'O' },
|
||||
{ "Õ", 'O' },
|
||||
{ "Ö", 'O' },
|
||||
{ "Ú", 'U' },
|
||||
{ "Ù", 'U' },
|
||||
{ "Ü", 'U' },
|
||||
{ "Ý", 'Y' },
|
||||
{ "Ÿ", 'Y' },
|
||||
|
||||
{ "á", 'a' },
|
||||
{ "â", 'a' },
|
||||
{ "à", 'a' },
|
||||
{ "ã", 'a' },
|
||||
{ "ä", 'a' },
|
||||
{ "ç", 'c' },
|
||||
{ "é", 'e' },
|
||||
{ "ê", 'e' },
|
||||
{ "è", 'e' },
|
||||
{ "ë", 'e' },
|
||||
{ "í", 'i' },
|
||||
{ "ì", 'i' },
|
||||
{ "ï", 'i' },
|
||||
{ "ñ", 'n' },
|
||||
{ "ó", 'o' },
|
||||
{ "ô", 'o' },
|
||||
{ "ò", 'o' },
|
||||
{ "õ", 'o' },
|
||||
{ "ö", 'o' },
|
||||
{ "ú", 'u' },
|
||||
{ "ù", 'u' },
|
||||
{ "ü", 'u' },
|
||||
{ "ý", 'y' },
|
||||
{ "ÿ", 'y' },
|
||||
|
||||
{ "¡", '!' },
|
||||
{ "¿", '?' },
|
||||
};
|
||||
|
||||
|
||||
u8 djui_font_convert_smcode_to_base(char c) {
|
||||
if ((u8)c < 128) {
|
||||
return c;
|
||||
}
|
||||
size_t glyphCount = sizeof(sSmCodeGlyphs) / sizeof(sSmCodeGlyphs[0]);
|
||||
u8 max = 128 + glyphCount;
|
||||
if ((u8)c > max) {
|
||||
return '?';
|
||||
}
|
||||
return sSmCodeGlyphs[((u8)c - 128)].base;
|
||||
}
|
||||
|
||||
void djui_font_convert_to_smcode(char* text) {
|
||||
size_t glyphCount = sizeof(sSmCodeGlyphs) / sizeof(sSmCodeGlyphs[0]);
|
||||
|
||||
|
@ -49,7 +84,7 @@ void djui_font_convert_to_smcode(char* text) {
|
|||
//printf("%d ", *t);
|
||||
for (size_t i = 0; i < glyphCount; i++) {
|
||||
struct SmCodeGlyph* glyph = &sSmCodeGlyphs[i];
|
||||
if (t[0] == glyph->unicode1 && t[1] == glyph->unicode2) {
|
||||
if (t[0] == glyph->unicode[0] && t[1] == glyph->unicode[1]) {
|
||||
// consume down to one character
|
||||
char* t2 = t;
|
||||
while (*t2 != '\0') { t2[0] = t2[1]; t2++; }
|
||||
|
@ -124,6 +159,7 @@ static void djui_font_normal_render_char(char c) {
|
|||
static f32 djui_font_normal_char_width(char c) {
|
||||
if (c == ' ') { return 0.30f; }
|
||||
extern const f32 font_normal_widths[];
|
||||
c = djui_font_convert_smcode_to_base(c);
|
||||
return font_normal_widths[(u8)c - '!'];
|
||||
}
|
||||
|
||||
|
|
|
@ -15,5 +15,6 @@ struct DjuiFont {
|
|||
|
||||
extern const struct DjuiFont* gDjuiFonts[];
|
||||
|
||||
u8 djui_font_convert_smcode_to_base(char c);
|
||||
void djui_font_convert_to_smcode(char* text);
|
||||
bool djui_font_valid_smcode(char c);
|
||||
|
|
BIN
textures/segment2/custom_font_normal_char_ca_u.ia4.png
Normal file
After Width: | Height: | Size: 517 B |
BIN
textures/segment2/custom_font_normal_char_ce_g.ia4.png
Normal file
After Width: | Height: | Size: 513 B |
BIN
textures/segment2/custom_font_normal_char_ce_u.ia4.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
textures/segment2/custom_font_normal_char_ci_g.ia4.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
textures/segment2/custom_font_normal_char_ci_u.ia4.png
Normal file
After Width: | Height: | Size: 511 B |
BIN
textures/segment2/custom_font_normal_char_co_g.ia4.png
Normal file
After Width: | Height: | Size: 516 B |
BIN
textures/segment2/custom_font_normal_char_co_u.ia4.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
textures/segment2/custom_font_normal_char_cu_g.ia4.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
textures/segment2/custom_font_normal_char_cy_a.ia4.png
Normal file
After Width: | Height: | Size: 505 B |
BIN
textures/segment2/custom_font_normal_char_cy_u.ia4.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
textures/segment2/custom_font_normal_char_la_u.ia4.png
Normal file
After Width: | Height: | Size: 511 B |
BIN
textures/segment2/custom_font_normal_char_le_g.ia4.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
textures/segment2/custom_font_normal_char_le_u.ia4.png
Normal file
After Width: | Height: | Size: 511 B |
BIN
textures/segment2/custom_font_normal_char_li_g.ia4.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
textures/segment2/custom_font_normal_char_li_u.ia4.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
textures/segment2/custom_font_normal_char_lo_g.ia4.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
textures/segment2/custom_font_normal_char_lo_u.ia4.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
textures/segment2/custom_font_normal_char_lu_g.ia4.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
textures/segment2/custom_font_normal_char_ly_a.ia4.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
textures/segment2/custom_font_normal_char_ly_u.ia4.png
Normal file
After Width: | Height: | Size: 508 B |