Bring back base FONT_NORMAL as FONT_ALIASED

FONT_NORMAL is the same as FONT_TINY, except with a different scale to match mods that use FONT_NORMAL
This commit is contained in:
Agent X 2023-12-17 21:36:24 -05:00
parent 631dcdcfb3
commit bdb8f11eab
7 changed files with 65 additions and 3 deletions

View file

@ -3465,7 +3465,10 @@ FONT_HUD = 2
FONT_TINY = 3
--- @type DjuiFontType
FONT_COUNT = 4
FONT_ALIASED = 4
--- @type DjuiFontType
FONT_COUNT = 5
--- @class HudUtilsFilter

View file

@ -49,3 +49,26 @@ const f32 font_title_widths[] = {
};
//////////////////////////////////////////////////////////
ALIGNED8 const u8 texture_font_aliased[] = {
#include "textures/custom_font/custom_font_aliased.rgba32.inc.c"
};
const f32 font_aliased_widths[] = {
/* ! " # $ % & ' ( ) * + , - . / */
7, 12, 14, 12, 14, 16, 8, 10, 10, 12, 14, 8, 12, 8, 10,
/* 0 1 2 3 4 5 6 7 8 9 */
14, 12, 13, 14, 14, 14, 14, 13, 14, 14,
/* : ; < = > ? @ */
6, 8, 10, 12, 10, 11, 18,
/* 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 */
12, 12, 12, 12, 11, 10, 12, 12, 9, 12, 12, 10, 16, 16, 12, 11, 12, 12, 12, 10, 12, 10, 16, 14, 12, 12,
/* [ \ ] ^ _ ` */
10, 10, 10, 12, 12, 8,
/* 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 */
10, 10, 10, 10, 9, 8, 12, 10, 7, 9, 10, 4, 13, 10, 9, 9, 10, 9, 10, 9, 10, 9, 14, 12, 10, 10,
/* { | } ~ DEL */
10, 8, 10, 16, 10,
};
//////////////////////////////////////////////////////////

View file

@ -1170,7 +1170,8 @@
| FONT_MENU | 1 |
| FONT_HUD | 2 |
| FONT_TINY | 3 |
| FONT_COUNT | 4 |
| FONT_ALIASED | 4 |
| FONT_COUNT | 5 |
### [enum HudUtilsFilter](#HudUtilsFilter)
| Identifier | Value |

View file

@ -147,6 +147,38 @@ static const struct DjuiFont sDjuiFontTiny = {
.char_width = djui_font_normal_char_width,
};
////////////////////////////////
// font 5 (DJ's aliased font) //
////////////////////////////////
static void djui_font_aliased_render_char(char* c) {
// replace undisplayable characters
if (*c == ' ') { return; }
u32 index = djui_unicode_get_sprite_index(c);
u32 tx = index % 32;
u32 ty = index / 32;
extern ALIGNED8 const u8 texture_font_aliased[];
djui_gfx_render_texture_tile(texture_font_aliased, 512, 256, 32, tx * 16, ty * 32, 16, 32, false);
}
static f32 djui_font_aliased_char_width(char* c) {
if (*c == ' ') { return 6 / 32.0f; }
extern const f32 font_aliased_widths[];
return djui_unicode_get_sprite_width(c, font_aliased_widths) / 32.0f;
}
static const struct DjuiFont sDjuiFontAliased = {
.charWidth = 0.5f,
.charHeight = 1.0f,
.lineHeight = 0.8125f,
.defaultFontScale = 32.0f,
.textBeginDisplayList = NULL,
.render_char = djui_font_aliased_render_char,
.char_width = djui_font_aliased_char_width,
};
///////////////
// font list //
///////////////
@ -156,4 +188,5 @@ const struct DjuiFont* gDjuiFonts[] = {
&sDjuiFontTitle,
&sDjuiFontHud,
&sDjuiFontTiny,
&sDjuiFontAliased
};

View file

@ -18,6 +18,7 @@ enum DjuiFontType {
FONT_MENU,
FONT_HUD,
FONT_TINY,
FONT_ALIASED,
FONT_COUNT,
};

View file

@ -1372,7 +1372,8 @@ char gSmluaConstants[] = ""
"FONT_MENU = 1\n"
"FONT_HUD = 2\n"
"FONT_TINY = 3\n"
"FONT_COUNT = 4\n"
"FONT_ALIASED = 4\n"
"FONT_COUNT = 5\n"
"ENVFX_MODE_NONE = 0\n"
"ENVFX_SNOW_NORMAL = 1\n"
"ENVFX_SNOW_WATER = 2\n"

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB