Added 15 more characters

This commit is contained in:
MysterD 2023-03-28 16:14:48 -07:00
parent c0ee5016dd
commit 90d1a71b64
20 changed files with 182 additions and 51 deletions

View file

@ -3597,6 +3597,10 @@ ALIGNED8 static const u8 texture_font_normal_char_ca_a[] = {
#include "textures/segment2/custom_font_normal_char_ca_a.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_ca_a.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_ca_ang[] = {
#include "textures/segment2/custom_font_normal_char_ca_ang.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ca_c[] = { ALIGNED8 static const u8 texture_font_normal_char_ca_c[] = {
#include "textures/segment2/custom_font_normal_char_ca_c.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_ca_c.ia4.inc.c"
}; };
@ -3637,6 +3641,10 @@ ALIGNED8 static const u8 texture_font_normal_char_ci_a[] = {
#include "textures/segment2/custom_font_normal_char_ci_a.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_ci_a.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_ci_c[] = {
#include "textures/segment2/custom_font_normal_char_ci_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ci_g[] = { ALIGNED8 static const u8 texture_font_normal_char_ci_g[] = {
#include "textures/segment2/custom_font_normal_char_ci_g.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_ci_g.ia4.inc.c"
}; };
@ -3673,6 +3681,10 @@ ALIGNED8 static const u8 texture_font_normal_char_cu_a[] = {
#include "textures/segment2/custom_font_normal_char_cu_a.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_cu_a.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_cu_c[] = {
#include "textures/segment2/custom_font_normal_char_cu_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cu_g[] = { ALIGNED8 static const u8 texture_font_normal_char_cu_g[] = {
#include "textures/segment2/custom_font_normal_char_cu_g.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_cu_g.ia4.inc.c"
}; };
@ -3693,6 +3705,10 @@ ALIGNED8 static const u8 texture_font_normal_char_la_a[] = {
#include "textures/segment2/custom_font_normal_char_la_a.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_la_a.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_la_ang[] = {
#include "textures/segment2/custom_font_normal_char_la_ang.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_c[] = { ALIGNED8 static const u8 texture_font_normal_char_la_c[] = {
#include "textures/segment2/custom_font_normal_char_la_c.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_la_c.ia4.inc.c"
}; };
@ -3733,6 +3749,10 @@ ALIGNED8 static const u8 texture_font_normal_char_li_a[] = {
#include "textures/segment2/custom_font_normal_char_li_a.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_li_a.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_li_c[] = {
#include "textures/segment2/custom_font_normal_char_li_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_li_g[] = { ALIGNED8 static const u8 texture_font_normal_char_li_g[] = {
#include "textures/segment2/custom_font_normal_char_li_g.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_li_g.ia4.inc.c"
}; };
@ -3769,6 +3789,10 @@ ALIGNED8 static const u8 texture_font_normal_char_lu_a[] = {
#include "textures/segment2/custom_font_normal_char_lu_a.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_lu_a.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_lu_c[] = {
#include "textures/segment2/custom_font_normal_char_lu_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lu_g[] = { ALIGNED8 static const u8 texture_font_normal_char_lu_g[] = {
#include "textures/segment2/custom_font_normal_char_lu_g.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_lu_g.ia4.inc.c"
}; };
@ -3785,6 +3809,42 @@ ALIGNED8 static const u8 texture_font_normal_char_ly_u[] = {
#include "textures/segment2/custom_font_normal_char_ly_u.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_ly_u.ia4.inc.c"
}; };
ALIGNED8 static const u8 texture_font_normal_char_lae[] = {
#include "textures/segment2/custom_font_normal_char_lae.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cae[] = {
#include "textures/segment2/custom_font_normal_char_cae.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_loe[] = {
#include "textures/segment2/custom_font_normal_char_loe.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_coe[] = {
#include "textures/segment2/custom_font_normal_char_coe.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_leth[] = {
#include "textures/segment2/custom_font_normal_char_leth.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ceth[] = {
#include "textures/segment2/custom_font_normal_char_ceth.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_los[] = {
#include "textures/segment2/custom_font_normal_char_los.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cos[] = {
#include "textures/segment2/custom_font_normal_char_cos.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ss[] = {
#include "textures/segment2/custom_font_normal_char_ss.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_punc_sp_ex[] = { ALIGNED8 static const u8 texture_font_normal_char_punc_sp_ex[] = {
#include "textures/segment2/custom_font_normal_char_punc_sp_ex.ia4.inc.c" #include "textures/segment2/custom_font_normal_char_punc_sp_ex.ia4.inc.c"
}; };
@ -3892,6 +3952,7 @@ const u8* const font_normal_chars[] = {
texture_font_char_us_star_filled, // DEL texture_font_char_us_star_filled, // DEL
texture_font_normal_char_ca_a, // Á texture_font_normal_char_ca_a, // Á
texture_font_normal_char_ca_ang, // Å
texture_font_normal_char_ca_c, // Â texture_font_normal_char_ca_c, // Â
texture_font_normal_char_ca_g, // À texture_font_normal_char_ca_g, // À
texture_font_normal_char_ca_t, // Ã texture_font_normal_char_ca_t, // Ã
@ -3902,6 +3963,7 @@ const u8* const font_normal_chars[] = {
texture_font_normal_char_ce_g, // È texture_font_normal_char_ce_g, // È
texture_font_normal_char_ce_u, // Ë texture_font_normal_char_ce_u, // Ë
texture_font_normal_char_ci_a, // Í texture_font_normal_char_ci_a, // Í
texture_font_normal_char_ci_c, // Î
texture_font_normal_char_ci_g, // Ì texture_font_normal_char_ci_g, // Ì
texture_font_normal_char_ci_u, // Ï texture_font_normal_char_ci_u, // Ï
texture_font_normal_char_cn_t, // Ñ texture_font_normal_char_cn_t, // Ñ
@ -3911,12 +3973,14 @@ const u8* const font_normal_chars[] = {
texture_font_normal_char_co_t, // Õ texture_font_normal_char_co_t, // Õ
texture_font_normal_char_co_u, // Ö texture_font_normal_char_co_u, // Ö
texture_font_normal_char_cu_a, // Ú texture_font_normal_char_cu_a, // Ú
texture_font_normal_char_cu_c, // Û
texture_font_normal_char_cu_g, // Ù texture_font_normal_char_cu_g, // Ù
texture_font_normal_char_cu_u, // Ü texture_font_normal_char_cu_u, // Ü
texture_font_normal_char_cy_a, // Ý texture_font_normal_char_cy_a, // Ý
texture_font_normal_char_cy_u, // Ÿ texture_font_normal_char_cy_u, // Ÿ
texture_font_normal_char_la_a, // á texture_font_normal_char_la_a, // á
texture_font_normal_char_la_ang, // å
texture_font_normal_char_la_c, // â texture_font_normal_char_la_c, // â
texture_font_normal_char_la_g, // à texture_font_normal_char_la_g, // à
texture_font_normal_char_la_t, // ã texture_font_normal_char_la_t, // ã
@ -3927,6 +3991,7 @@ const u8* const font_normal_chars[] = {
texture_font_normal_char_le_g, // è texture_font_normal_char_le_g, // è
texture_font_normal_char_le_u, // ë texture_font_normal_char_le_u, // ë
texture_font_normal_char_li_a, // í texture_font_normal_char_li_a, // í
texture_font_normal_char_li_c, // î
texture_font_normal_char_li_g, // ì texture_font_normal_char_li_g, // ì
texture_font_normal_char_li_u, // ï texture_font_normal_char_li_u, // ï
texture_font_normal_char_ln_t, // ñ texture_font_normal_char_ln_t, // ñ
@ -3936,11 +4001,22 @@ const u8* const font_normal_chars[] = {
texture_font_normal_char_lo_t, // õ texture_font_normal_char_lo_t, // õ
texture_font_normal_char_lo_u, // ö texture_font_normal_char_lo_u, // ö
texture_font_normal_char_lu_a, // ú texture_font_normal_char_lu_a, // ú
texture_font_normal_char_lu_c, // û
texture_font_normal_char_lu_g, // ù texture_font_normal_char_lu_g, // ù
texture_font_normal_char_lu_u, // ü texture_font_normal_char_lu_u, // ü
texture_font_normal_char_ly_a, // ý texture_font_normal_char_ly_a, // ý
texture_font_normal_char_ly_u, // ÿ texture_font_normal_char_ly_u, // ÿ
texture_font_normal_char_lae, // æ
texture_font_normal_char_cae, // Æ
texture_font_normal_char_loe, // œ
texture_font_normal_char_coe, // Œ
texture_font_normal_char_leth, // ð
texture_font_normal_char_ceth, // Ð
texture_font_normal_char_los, // ø
texture_font_normal_char_cos, // Ø
texture_font_normal_char_ss, // ß
texture_font_normal_char_punc_sp_ex, // ¡ texture_font_normal_char_punc_sp_ex, // ¡
texture_font_normal_char_punc_sp_qu, // ¿ texture_font_normal_char_punc_sp_qu, // ¿

View file

@ -4,61 +4,78 @@
struct SmCodeGlyph { struct SmCodeGlyph {
char unicode[3]; char unicode[3];
char base; char base;
f32 width;
}; };
struct SmCodeGlyph sSmCodeGlyphs[] = { struct SmCodeGlyph sSmCodeGlyphs[] = {
{ "Á", 'A' }, { "Á", 'A', 0 },
{ "Â", 'A' }, { "Å", 'A', 0 },
{ "À", 'A' }, { "Â", 'A', 0 },
{ "Ã", 'A' }, { "À", 'A', 0 },
{ "Ä", 'A' }, { "Ã", 'A', 0 },
{ "Ç", 'C' }, { "Ä", 'A', 0 },
{ "É", 'E' }, { "Ç", 'C', 0 },
{ "Ê", 'E' }, { "É", 'E', 0 },
{ "È", 'E' }, { "Ê", 'E', 0 },
{ "Ë", 'E' }, { "È", 'E', 0 },
{ "Í", 'I' }, { "Ë", 'E', 0 },
{ "Ì", 'I' }, { "Í", 'I', 0 },
{ "Ï", 'I' }, { "Î", 'I', 0 },
{ "Ñ", 'N' }, { "Ì", 'I', 0 },
{ "Ó", 'O' }, { "Ï", 'I', 0 },
{ "Ô", 'O' }, { "Ñ", 'N', 0 },
{ "Ò", 'O' }, { "Ó", 'O', 0 },
{ "Õ", 'O' }, { "Ô", 'O', 0 },
{ "Ö", 'O' }, { "Ò", 'O', 0 },
{ "Ú", 'U' }, { "Õ", 'O', 0 },
{ "Ù", 'U' }, { "Ö", 'O', 0 },
{ "Ü", 'U' }, { "Ú", 'U', 0 },
{ "Ý", 'Y' }, { "Û", 'U', 0 },
{ "Ÿ", 'Y' }, { "Ù", 'U', 0 },
{ "Ü", 'U', 0 },
{ "Ý", 'Y', 0 },
{ "Ÿ", 'Y', 0 },
{ "á", 'a' }, { "á", 'a', 0 },
{ "â", 'a' }, { "å", 'a', 0 },
{ "à", 'a' }, { "â", 'a', 0 },
{ "ã", 'a' }, { "à", 'a', 0 },
{ "ä", 'a' }, { "ã", 'a', 0 },
{ "ç", 'c' }, { "ä", 'a', 0 },
{ "é", 'e' }, { "ç", 'c', 0 },
{ "ê", 'e' }, { "é", 'e', 0 },
{ "è", 'e' }, { "ê", 'e', 0 },
{ "ë", 'e' }, { "è", 'e', 0 },
{ "í", 'i' }, { "ë", 'e', 0 },
{ "ì", 'i' }, { "í", 'i', 0 },
{ "ï", 'i' }, { "î", 'i', 0 },
{ "ñ", 'n' }, { "ì", 'i', 0 },
{ "ó", 'o' }, { "ï", 'i', 0 },
{ "ô", 'o' }, { "ñ", 'n', 0 },
{ "ò", 'o' }, { "ó", 'o', 0 },
{ "õ", 'o' }, { "ô", 'o', 0 },
{ "ö", 'o' }, { "ò", 'o', 0 },
{ "ú", 'u' }, { "õ", 'o', 0 },
{ "ù", 'u' }, { "ö", 'o', 0 },
{ "ü", 'u' }, { "ú", 'u', 0 },
{ "ý", 'y' }, { "û", 'u', 0 },
{ "ÿ", 'y' }, { "ù", 'u', 0 },
{ "ü", 'u', 0 },
{ "ý", 'y', 0 },
{ "ÿ", 'y', 0 },
{ "¡", '!' }, { "æ", 'a', 0.5000f },
{ "¿", '?' }, { "Æ", 'a', 0.6000f },
{ "œ", 'o', 0.5000f },
{ "Œ", 'o', 0.5000f },
{ "ð", 'd', 0 },
{ "Ð", 'D', 0.4375f },
{ "ø", 'o', 0 },
{ "Ø", 'O', 0 },
{ "ß", 'S', 0 },
{ "¡", '!', 0 },
{ "¿", '?', 0 },
}; };
@ -74,6 +91,28 @@ u8 djui_font_convert_smcode_to_base(char c) {
return sSmCodeGlyphs[((u8)c - 128)].base; return sSmCodeGlyphs[((u8)c - 128)].base;
} }
void djui_font_convert_to_unicode(char* from, char* to, int length, int maxlength) {
int clen = 0;
int count = 0;
to[0] = '\0';
while (*from != '\0' && count < length) {
count++;
if ((u8)*from < 128 || !djui_font_valid_smcode(*from)) {
clen = strlen(to);
snprintf(to + clen, maxlength - clen, "%c", *from);
from++;
continue;
}
int i = (u8)*from - 128;
struct SmCodeGlyph* glyph = &sSmCodeGlyphs[i];
clen = strlen(to);
snprintf(to + clen, maxlength - clen, "%s", glyph->unicode);
from++;
}
}
void djui_font_convert_to_smcode(char* text) { void djui_font_convert_to_smcode(char* text) {
size_t glyphCount = sizeof(sSmCodeGlyphs) / sizeof(sSmCodeGlyphs[0]); size_t glyphCount = sizeof(sSmCodeGlyphs) / sizeof(sSmCodeGlyphs[0]);
@ -159,6 +198,21 @@ static void djui_font_normal_render_char(char c) {
static f32 djui_font_normal_char_width(char c) { static f32 djui_font_normal_char_width(char c) {
if (c == ' ') { return 0.30f; } if (c == ' ') { return 0.30f; }
extern const f32 font_normal_widths[]; extern const f32 font_normal_widths[];
if ((u8)c < 128) {
return font_normal_widths[(u8)c - '!'];
}
size_t glyphCount = sizeof(sSmCodeGlyphs) / sizeof(sSmCodeGlyphs[0]);
u8 max = 128 + glyphCount;
if ((u8)c > max) {
return font_normal_widths[(u8)'?' - '!'];
}
if (sSmCodeGlyphs[(u8)c - 128].width > 0) {
return sSmCodeGlyphs[(u8)c - 128].width;
}
c = djui_font_convert_smcode_to_base(c); c = djui_font_convert_smcode_to_base(c);
return font_normal_widths[(u8)c - '!']; return font_normal_widths[(u8)c - '!'];
} }

View file

@ -16,5 +16,6 @@ struct DjuiFont {
extern const struct DjuiFont* gDjuiFonts[]; extern const struct DjuiFont* gDjuiFonts[];
u8 djui_font_convert_smcode_to_base(char c); u8 djui_font_convert_smcode_to_base(char c);
void djui_font_convert_to_unicode(char* from, char* to, int length, int maxlength);
void djui_font_convert_to_smcode(char* text); void djui_font_convert_to_smcode(char* text);
bool djui_font_valid_smcode(char c); bool djui_font_valid_smcode(char c);

View file

@ -236,7 +236,7 @@ bool djui_inputbox_on_key_down(struct DjuiBase *base, int scancode) {
if (sHeldControl && (scancode == SCANCODE_C || scancode == SCANCODE_X)) { if (sHeldControl && (scancode == SCANCODE_C || scancode == SCANCODE_X)) {
if (sel[0] != sel[1]) { if (sel[0] != sel[1]) {
char clipboardText[256] = { 0 }; char clipboardText[256] = { 0 };
snprintf(clipboardText, fmin(256, 1 + s2 - s1), "%s", &msg[s1]); djui_font_convert_to_unicode(&msg[s1], clipboardText, fmin(256, 1 + s2 - s1), 255);
wm_api->set_clipboard_text(clipboardText); wm_api->set_clipboard_text(clipboardText);
if (scancode == SCANCODE_X) { if (scancode == SCANCODE_X) {
djui_inputbox_delete_selection(inputbox); djui_inputbox_delete_selection(inputbox);

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B