Made font-normal kerning consistent

This commit is contained in:
MysterD 2023-04-20 12:58:17 -07:00
parent 737b790869
commit 509c82fcd5
2 changed files with 10 additions and 9 deletions

View File

@ -9,21 +9,22 @@ ALIGNED8 const u8 texture_font_normal[] = {
const f32 font_normal_widths[] = {
/* ! " # $ % & ' ( ) * + , - . / */
0.2200f, 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,
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 */
0.4375f, 0.3800f, 0.4200f, 0.4375f, 0.4300f, 0.4375f, 0.4375f, 0.4000f, 0.4375f, 0.4375f,
14, 12, 13, 14, 14, 14, 14, 13, 14, 14,
/* : ; < = > ? @ */
0.2000f, 0.2500f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.5750f,
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 */
0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 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,
12, 12, 12, 12, 12, 10, 12, 12, 10, 12, 12, 10, 16, 16, 12, 12, 12, 12, 12, 10, 12, 12, 16, 14, 12, 12,
/* [ \ ] ^ _ ` */
0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3750f, 0.2500f,
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 */
0.3000f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3000f, 0.3750f, 0.3125f, 0.2200f, 0.3125f, 0.3125f, 0.1700f, 0.4350f, 0.3125f, 0.3000f, 0.3000f, 0.3125f, 0.2700f, 0.3125f, 0.3125f, 0.3125f, 0.2750f, 0.4375f, 0.3750f, 0.3125f, 0.3125f,
10, 10, 10, 10, 10, 8, 12, 10, 7, 10, 10, 5, 14, 10, 10, 10, 10, 9, 10, 10, 10, 9, 14, 12, 10, 10,
/* { | } ~ DEL */
0.3125f, 0.2500f, 0.3125f, 0.5000f, 0.3125f,
10, 8, 10, 16, 10,
};
//////////////////////////////////////////////////////////
ALIGNED8 const u8 texture_font_title[] = {

View File

@ -19,9 +19,9 @@ static void djui_font_normal_render_char(char* c) {
}
static f32 djui_font_normal_char_width(char* c) {
if (*c == ' ') { return 0.20f; }
if (*c == ' ') { return 5 / 32.0f; }
extern const f32 font_normal_widths[];
return djui_unicode_get_sprite_width(c, font_normal_widths);
return djui_unicode_get_sprite_width(c, font_normal_widths) / 32.0f;
}
static const struct DjuiFont sDjuiFontNormal = {