From 509c82fcd55201d4c572e147aaf8865d363c25ca Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 20 Apr 2023 12:58:17 -0700 Subject: [PATCH] Made font-normal kerning consistent --- bin/custom_font.c | 15 ++++++++------- src/pc/djui/djui_font.c | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/custom_font.c b/bin/custom_font.c index c3c0aa1b..fce5ed07 100644 --- a/bin/custom_font.c +++ b/bin/custom_font.c @@ -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[] = { diff --git a/src/pc/djui/djui_font.c b/src/pc/djui/djui_font.c index a5d714d6..9bd31cd0 100644 --- a/src/pc/djui/djui_font.c +++ b/src/pc/djui/djui_font.c @@ -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 = {