DJUI: Adjusted normal font, added missing characters

This commit is contained in:
MysterD 2021-06-28 18:08:24 -07:00
parent 8f5f94f0c7
commit 2a4817b29b
23 changed files with 319 additions and 123 deletions

View file

@ -384,99 +384,116 @@ ALIGNED8 static const u8 texture_font_title_char_95[] = {
}; };
const u8* const font_title_chars[] = { const u8* const font_title_chars[] = {
texture_font_title_char_01, texture_font_title_char_01, // !
texture_font_title_char_02, texture_font_title_char_02, // "
texture_font_title_char_03, texture_font_title_char_03, // #
texture_font_title_char_04, texture_font_title_char_04, // $
texture_font_title_char_05, texture_font_title_char_05, // %
texture_font_title_char_06, texture_font_title_char_06, // &
texture_font_title_char_07, texture_font_title_char_07, // '
texture_font_title_char_08, texture_font_title_char_08, // (
texture_font_title_char_09, texture_font_title_char_09, // )
texture_font_title_char_10, texture_font_title_char_10, // *
texture_font_title_char_11, texture_font_title_char_11, // +
texture_font_title_char_12, texture_font_title_char_12, // ,
texture_font_title_char_13, texture_font_title_char_13, // -
texture_font_title_char_14, texture_font_title_char_14, // .
texture_font_title_char_15, texture_font_title_char_15, // /
texture_font_title_char_16, texture_font_title_char_16, // 0
texture_font_title_char_17, texture_font_title_char_17, // 1
texture_font_title_char_18, texture_font_title_char_18, // 2
texture_font_title_char_19, texture_font_title_char_19, // 3
texture_font_title_char_20, texture_font_title_char_20, // 4
texture_font_title_char_21, texture_font_title_char_21, // 5
texture_font_title_char_22, texture_font_title_char_22, // 6
texture_font_title_char_23, texture_font_title_char_23, // 7
texture_font_title_char_24, texture_font_title_char_24, // 8
texture_font_title_char_25, texture_font_title_char_25, // 9
texture_font_title_char_26, texture_font_title_char_26, // :
texture_font_title_char_27, texture_font_title_char_27, // ;
texture_font_title_char_28, texture_font_title_char_28, // <
texture_font_title_char_29, texture_font_title_char_29, // =
texture_font_title_char_30, texture_font_title_char_30, // >
texture_font_title_char_31, texture_font_title_char_31, // ?
texture_font_title_char_32, texture_font_title_char_32, // @
texture_font_title_char_33, texture_font_title_char_33, // A
texture_font_title_char_34, texture_font_title_char_34, // B
texture_font_title_char_35, texture_font_title_char_35, // C
texture_font_title_char_36, texture_font_title_char_36, // D
texture_font_title_char_37, texture_font_title_char_37, // E
texture_font_title_char_38, texture_font_title_char_38, // F
texture_font_title_char_39, texture_font_title_char_39, // G
texture_font_title_char_40, texture_font_title_char_40, // H
texture_font_title_char_41, texture_font_title_char_41, // I
texture_font_title_char_42, texture_font_title_char_42, // J
texture_font_title_char_43, texture_font_title_char_43, // K
texture_font_title_char_44, texture_font_title_char_44, // L
texture_font_title_char_45, texture_font_title_char_45, // M
texture_font_title_char_46, texture_font_title_char_46, // N
texture_font_title_char_47, texture_font_title_char_47, // O
texture_font_title_char_48, texture_font_title_char_48, // P
texture_font_title_char_49, texture_font_title_char_49, // Q
texture_font_title_char_50, texture_font_title_char_50, // R
texture_font_title_char_51, texture_font_title_char_51, // S
texture_font_title_char_52, texture_font_title_char_52, // T
texture_font_title_char_53, texture_font_title_char_53, // U
texture_font_title_char_54, texture_font_title_char_54, // V
texture_font_title_char_55, texture_font_title_char_55, // W
texture_font_title_char_56, texture_font_title_char_56, // X
texture_font_title_char_57, texture_font_title_char_57, // Y
texture_font_title_char_58, texture_font_title_char_58, // Z
texture_font_title_char_59, texture_font_title_char_59, // [
texture_font_title_char_60, texture_font_title_char_60, // \ //
texture_font_title_char_61, texture_font_title_char_61, // ]
texture_font_title_char_62, texture_font_title_char_62, // ^
texture_font_title_char_63, texture_font_title_char_63, // _
texture_font_title_char_64, texture_font_title_char_64, // `
texture_font_title_char_65, texture_font_title_char_65, // a
texture_font_title_char_66, texture_font_title_char_66, // b
texture_font_title_char_67, texture_font_title_char_67, // c
texture_font_title_char_68, texture_font_title_char_68, // d
texture_font_title_char_69, texture_font_title_char_69, // e
texture_font_title_char_70, texture_font_title_char_70, // f
texture_font_title_char_71, texture_font_title_char_71, // g
texture_font_title_char_72, texture_font_title_char_72, // h
texture_font_title_char_73, texture_font_title_char_73, // i
texture_font_title_char_74, texture_font_title_char_74, // j
texture_font_title_char_75, texture_font_title_char_75, // k
texture_font_title_char_76, texture_font_title_char_76, // l
texture_font_title_char_77, texture_font_title_char_77, // m
texture_font_title_char_78, texture_font_title_char_78, // n
texture_font_title_char_79, texture_font_title_char_79, // o
texture_font_title_char_80, texture_font_title_char_80, // p
texture_font_title_char_81, texture_font_title_char_81, // q
texture_font_title_char_82, texture_font_title_char_82, // r
texture_font_title_char_83, texture_font_title_char_83, // s
texture_font_title_char_84, texture_font_title_char_84, // t
texture_font_title_char_85, texture_font_title_char_85, // u
texture_font_title_char_86, texture_font_title_char_86, // v
texture_font_title_char_87, texture_font_title_char_87, // w
texture_font_title_char_88, texture_font_title_char_88, // x
texture_font_title_char_89, texture_font_title_char_89, // y
texture_font_title_char_90, texture_font_title_char_90, // z
texture_font_title_char_91, texture_font_title_char_91, // {
texture_font_title_char_92, texture_font_title_char_92, // |
texture_font_title_char_93, texture_font_title_char_93, // }
texture_font_title_char_94, texture_font_title_char_94, // ~
texture_font_title_char_95, texture_font_title_char_95, // DEL
};
const f32 font_title_widths[] = {
/* ! " # $ % & ' ( ) * + , - . / */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
/* 0 1 2 3 4 5 6 7 8 9 */
0.45f, 0.35f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f,
/* : ; < = > ? @ */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
/* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z */
0.55f, 0.50f, 0.50f, 0.50f, 0.45f, 0.45f, 0.50f, 0.55f, 0.28f, 0.60f, 0.50f, 0.45f, 0.55f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.55f, 0.50f, 0.50f, 0.50f, 0.60f, 0.52f, 0.60f, 0.45f,
/* [ \ ] ^ _ ` */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
0.45f, 0.45f, 0.40f, 0.40f, 0.45f, 0.37f, 0.40f, 0.40f, 0.20f, 0.45f, 0.40f, 0.30f, 0.50f, 0.40f, 0.40f, 0.40f, 0.45f, 0.40f, 0.50f, 0.45f, 0.50f, 0.40f, 0.50f, 0.50f, 0.45f, 0.45f,
/* { | } ~ DEL */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
}; };

View file

@ -3372,3 +3372,200 @@ const s16 seg2_painting_mesh_neighbor_tris[] = {
3, 240, 242, 244, 3, 240, 242, 244,
1, 243, 1, 243,
}; };
//////////////////////////////////////////////////////////
ALIGNED8 static const u8 texture_font_normal_char_03[] = {
#include "textures/segment2/custom_font_normal_char_03.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_04[] = {
#include "textures/segment2/custom_font_normal_char_04.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_10[] = {
#include "textures/segment2/custom_font_normal_char_10.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_11[] = {
#include "textures/segment2/custom_font_normal_char_11.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_15[] = {
#include "textures/segment2/custom_font_normal_char_15.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_26[] = {
#include "textures/segment2/custom_font_normal_char_26.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_27[] = {
#include "textures/segment2/custom_font_normal_char_27.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_28[] = {
#include "textures/segment2/custom_font_normal_char_28.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_29[] = {
#include "textures/segment2/custom_font_normal_char_29.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_30[] = {
#include "textures/segment2/custom_font_normal_char_30.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_32[] = {
#include "textures/segment2/custom_font_normal_char_32.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_59[] = {
#include "textures/segment2/custom_font_normal_char_59.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_60[] = {
#include "textures/segment2/custom_font_normal_char_60.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_61[] = {
#include "textures/segment2/custom_font_normal_char_61.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_62[] = {
#include "textures/segment2/custom_font_normal_char_62.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_63[] = {
#include "textures/segment2/custom_font_normal_char_63.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_64[] = {
#include "textures/segment2/custom_font_normal_char_64.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_91[] = {
#include "textures/segment2/custom_font_normal_char_91.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_92[] = {
#include "textures/segment2/custom_font_normal_char_92.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_93[] = {
#include "textures/segment2/custom_font_normal_char_93.ia4.inc.c"
};
const u8* const font_normal_chars[] = {
texture_font_char_us_exclamation, // !
texture_font_char_us_double_quote_open, // "
texture_font_normal_char_03, // #
texture_font_normal_char_04, // $
texture_font_char_us_percent, // %
texture_font_char_us_ampersand, // &
texture_font_char_us_apostrophe, // '
texture_font_char_us_open_parentheses, // (
texture_font_char_us_close_parentheses, // )
texture_font_normal_char_10, // *
texture_font_normal_char_11, // +
texture_font_char_us_comma, // ,
texture_font_char_us_slash, // -
texture_font_char_us_period, // .
texture_font_normal_char_15, // /
texture_font_char_us_0, // 0
texture_font_char_us_1, // 1
texture_font_char_us_2, // 2
texture_font_char_us_3, // 3
texture_font_char_us_4, // 4
texture_font_char_us_5, // 5
texture_font_char_us_6, // 6
texture_font_char_us_7, // 7
texture_font_char_us_8, // 8
texture_font_char_us_9, // 9
texture_font_normal_char_26, // :
texture_font_normal_char_27, // ;
texture_font_normal_char_28, // <
texture_font_normal_char_29, // =
texture_font_normal_char_30, // >
texture_font_char_us_question, // ?
texture_font_normal_char_32, // @
texture_font_char_us_A, // A
texture_font_char_us_B, // B
texture_font_char_us_C, // C
texture_font_char_us_D, // D
texture_font_char_us_E, // E
texture_font_char_us_F, // F
texture_font_char_us_G, // G
texture_font_char_us_H, // H
texture_font_char_us_I, // I
texture_font_char_us_J, // J
texture_font_char_us_K, // K
texture_font_char_us_L, // L
texture_font_char_us_M, // M
texture_font_char_us_N, // N
texture_font_char_us_O, // O
texture_font_char_us_P, // P
texture_font_char_us_Q, // Q
texture_font_char_us_R, // R
texture_font_char_us_S, // S
texture_font_char_us_T, // T
texture_font_char_us_U, // U
texture_font_char_us_V, // V
texture_font_char_us_W, // W
texture_font_char_us_X, // X
texture_font_char_us_Y, // Y
texture_font_char_us_Z, // Z
texture_font_normal_char_59, // [
texture_font_normal_char_60, // \ //
texture_font_normal_char_61, // ]
texture_font_normal_char_62, // ^
texture_font_normal_char_63, // _
texture_font_normal_char_64, // `
texture_font_char_us_a, // a
texture_font_char_us_b, // b
texture_font_char_us_c, // c
texture_font_char_us_d, // d
texture_font_char_us_e, // e
texture_font_char_us_f, // f
texture_font_char_us_g, // g
texture_font_char_us_h, // h
texture_font_char_us_i, // i
texture_font_char_us_j, // j
texture_font_char_us_k, // k
texture_font_char_us_l, // l
texture_font_char_us_m, // m
texture_font_char_us_n, // n
texture_font_char_us_o, // o
texture_font_char_us_p, // p
texture_font_char_us_q, // q
texture_font_char_us_r, // r
texture_font_char_us_s, // s
texture_font_char_us_t, // t
texture_font_char_us_u, // u
texture_font_char_us_v, // v
texture_font_char_us_w, // w
texture_font_char_us_x, // x
texture_font_char_us_y, // y
texture_font_char_us_z, // z
texture_font_normal_char_91, // {
texture_font_normal_char_92, // |
texture_font_normal_char_93, // }
texture_font_char_us_tilde, // ~
texture_font_char_us_interpunct, // DEL
};
const f32 font_normal_widths[] = {
/* ! " # $ % & ' ( ) * + , - . / */
0.3125f, 0.3750f, 0.4375f, 0.3750f, 0.4375f, 0.5000f, 0.2500f, 0.3125f, 0.3125f, 0.3750f, 0.4375f, 0.2500f, 0.3750f, 0.2500f, 0.3125f,
/* 0 1 2 3 4 5 6 7 8 9 */
0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f,
/* : ; < = > ? @ */
0.2500f, 0.2500f, 0.3125f, 0.3750f, 0.3125f, 0.4375f, 0.5750f,
/* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z */
0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.3125f, 0.5000f, 0.5000f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.5000f, 0.4375f, 0.3750f, 0.3750f,
/* [ \ ] ^ _ ` */
0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3750f, 0.2500f,
/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
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.4375f
};

View file

@ -36,21 +36,19 @@ static const Gfx djui_font_normal_text_settings[] = {
}; };
static void djui_font_normal_render_char(char c) { static void djui_font_normal_render_char(char c) {
void** fontLUT; extern const u8* const font_normal_chars[];
void* packedTexture; void* fontChar = (void*)font_normal_chars[c - '!'];
if (fontChar == NULL) { fontChar = (void*)font_normal_chars[94]; }
u8 d = str_ascii_char_to_dialog(c);
fontLUT = segmented_to_virtual(main_font_lut);
packedTexture = segmented_to_virtual(fontLUT[d]);
gDPPipeSync(gDisplayListHead++); gDPPipeSync(gDisplayListHead++);
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, VIRTUAL_TO_PHYSICAL(packedTexture)); gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (void*)fontChar);
gSPDisplayList(gDisplayListHead++, djui_font_normal_text_settings); gSPDisplayList(gDisplayListHead++, djui_font_normal_text_settings);
} }
static f32 djui_font_normal_char_width(char c) { static f32 djui_font_normal_char_width(char c) {
u8 d = str_ascii_char_to_dialog(c); if (c == ' ') { return 0.30f; }
return gDialogCharWidths[d] / 16.0f; extern const f32 font_normal_widths[];
return font_normal_widths[c - '!'];
} }
static const struct DjuiFont sDjuiFontNormal = { static const struct DjuiFont sDjuiFontNormal = {
@ -68,23 +66,6 @@ static const struct DjuiFont sDjuiFontNormal = {
// font 1 (custom title font) // // font 1 (custom title font) //
//////////////////////////////// ////////////////////////////////
static f32 sDjuiFontTitleCharWidths[] = {
/* ! " # $ % & ' ( ) * + , - . / */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
/* 0 1 2 3 4 5 6 7 8 9 */
0.45f, 0.35f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f, 0.45f,
/* : ; < = > ? @ */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
/* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z */
0.55f, 0.50f, 0.50f, 0.50f, 0.45f, 0.45f, 0.50f, 0.55f, 0.28f, 0.60f, 0.50f, 0.45f, 0.55f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.55f, 0.50f, 0.50f, 0.50f, 0.60f, 0.52f, 0.60f, 0.45f,
/* [ \ ] ^ _ ` */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
0.45f, 0.45f, 0.40f, 0.40f, 0.45f, 0.37f, 0.40f, 0.40f, 0.20f, 0.45f, 0.40f, 0.30f, 0.50f, 0.40f, 0.40f, 0.40f, 0.45f, 0.40f, 0.50f, 0.45f, 0.50f, 0.40f, 0.50f, 0.50f, 0.45f, 0.45f,
/* { | } ~ ! */
0.50f, 0.50f, 0.50f, 0.50f, 0.50f,
};
static void djui_font_title_render_char(char c) { static void djui_font_title_render_char(char c) {
extern const u8* const font_title_chars[]; extern const u8* const font_title_chars[];
djui_gfx_render_texture(font_title_chars[c - '!'], 64, 64, 32); djui_gfx_render_texture(font_title_chars[c - '!'], 64, 64, 32);
@ -92,7 +73,8 @@ static void djui_font_title_render_char(char c) {
static f32 djui_font_title_char_width(char c) { static f32 djui_font_title_char_width(char c) {
if (c == ' ') { return 0.30f; } if (c == ' ') { return 0.30f; }
return sDjuiFontTitleCharWidths[c - '!']; extern const f32 font_title_widths[];
return font_title_widths[c - '!'];
} }
static const struct DjuiFont sDjuiFontTitle = { static const struct DjuiFont sDjuiFontTitle = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B