From e42a0a6dbeb1b0db15ed14dd862ee7ed9c2f5e4f Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 13:00:10 +0100 Subject: [PATCH] Narrower fonts --- charmap.txt | 3 + gflib/text.c | 331 ++++++++++++++++++++++-- gflib/text.h | 7 + gflib/window.c | 10 + gflib/window.h | 2 + graphics/fonts/latin_narrower.png | Bin 0 -> 7346 bytes graphics/fonts/latin_short_narrow.png | Bin 0 -> 7508 bytes graphics/fonts/latin_small_narrower.png | Bin 0 -> 7037 bytes graphics_file_rules.mk | 9 + include/fonts.h | 6 + include/list_menu.h | 5 +- src/fonts.c | 108 ++++++++ src/list_menu.c | 10 +- 13 files changed, 467 insertions(+), 24 deletions(-) create mode 100644 graphics/fonts/latin_narrower.png create mode 100644 graphics/fonts/latin_short_narrow.png create mode 100644 graphics/fonts/latin_small_narrower.png diff --git a/charmap.txt b/charmap.txt index 7271c621ca..872e9f76e4 100644 --- a/charmap.txt +++ b/charmap.txt @@ -464,6 +464,9 @@ FONT_NORMAL = FC 06 01 FONT_SHORT = FC 06 02 FONT_NARROW = FC 06 07 FONT_SMALL_NARROW = FC 06 08 +FONT_NARROWER = FC 06 0A +FONT_SMALL_NARROWER = FC 06 0B +FONT_SHORT_NARROW = FC 06 0C @ colors diff --git a/gflib/text.c b/gflib/text.c index cc6a6e90f2..c4ed5f4dbe 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -23,17 +23,26 @@ static u16 FontFunc_ShortCopy2(struct TextPrinter *); static u16 FontFunc_ShortCopy3(struct TextPrinter *); static u16 FontFunc_Narrow(struct TextPrinter *); static u16 FontFunc_SmallNarrow(struct TextPrinter *); +static u16 FontFunc_Narrower(struct TextPrinter *); +static u16 FontFunc_SmallNarrower(struct TextPrinter *); +static u16 FontFunc_ShortNarrow(struct TextPrinter *); static void DecompressGlyph_Small(u16, bool32); static void DecompressGlyph_Normal(u16, bool32); static void DecompressGlyph_Short(u16, bool32); static void DecompressGlyph_Narrow(u16, bool32); static void DecompressGlyph_SmallNarrow(u16, bool32); static void DecompressGlyph_Bold(u16); +static void DecompressGlyph_Narrower(u16, bool32); +static void DecompressGlyph_SmallNarrower(u16, bool32); +static void DecompressGlyph_ShortNarrow(u16, bool32); static u32 GetGlyphWidth_Small(u16, bool32); static u32 GetGlyphWidth_Normal(u16, bool32); static u32 GetGlyphWidth_Short(u16, bool32); static u32 GetGlyphWidth_Narrow(u16, bool32); static u32 GetGlyphWidth_SmallNarrow(u16, bool32); +static u32 GetGlyphWidth_Narrower(u16, bool32); +static u32 GetGlyphWidth_SmallNarrower(u16, bool32); +static u32 GetGlyphWidth_ShortNarrow(u16, bool32); static EWRAM_DATA struct TextPrinter sTempTextPrinter = {0}; static EWRAM_DATA struct TextPrinter sTextPrinters[WINDOWS_MAX] = {0}; @@ -81,15 +90,18 @@ static const u8 sWindowVerticalScrollSpeeds[] = { static const struct GlyphWidthFunc sGlyphWidthFuncs[] = { - { FONT_SMALL, GetGlyphWidth_Small }, - { FONT_NORMAL, GetGlyphWidth_Normal }, - { FONT_SHORT, GetGlyphWidth_Short }, - { FONT_SHORT_COPY_1, GetGlyphWidth_Short }, - { FONT_SHORT_COPY_2, GetGlyphWidth_Short }, - { FONT_SHORT_COPY_3, GetGlyphWidth_Short }, - { FONT_BRAILLE, GetGlyphWidth_Braille }, - { FONT_NARROW, GetGlyphWidth_Narrow }, - { FONT_SMALL_NARROW, GetGlyphWidth_SmallNarrow } + { FONT_SMALL, GetGlyphWidth_Small }, + { FONT_NORMAL, GetGlyphWidth_Normal }, + { FONT_SHORT, GetGlyphWidth_Short }, + { FONT_SHORT_COPY_1, GetGlyphWidth_Short }, + { FONT_SHORT_COPY_2, GetGlyphWidth_Short }, + { FONT_SHORT_COPY_3, GetGlyphWidth_Short }, + { FONT_BRAILLE, GetGlyphWidth_Braille }, + { FONT_NARROW, GetGlyphWidth_Narrow }, + { FONT_SMALL_NARROW, GetGlyphWidth_SmallNarrow }, + { FONT_NARROWER, GetGlyphWidth_Narrower }, + { FONT_SMALL_NARROWER, GetGlyphWidth_SmallNarrower }, + { FONT_SHORT_NARROW, GetGlyphWidth_ShortNarrow }, }; struct @@ -217,21 +229,54 @@ static const struct FontInfo sFontInfos[] = .fgColor = 1, .bgColor = 2, .shadowColor = 15, - } + }, + [FONT_NARROWER] = { + .fontFunction = FontFunc_Narrower, + .maxLetterWidth = 5, + .maxLetterHeight = 16, + .letterSpacing = 0, + .lineSpacing = 0, + .fgColor = 2, + .bgColor = 1, + .shadowColor = 3, + }, + [FONT_SMALL_NARROWER] = { + .fontFunction = FontFunc_SmallNarrower, + .maxLetterWidth = 5, + .maxLetterHeight = 8, + .letterSpacing = 0, + .lineSpacing = 0, + .fgColor = 2, + .bgColor = 1, + .shadowColor = 3, + }, + [FONT_SHORT_NARROW] = { + .fontFunction = FontFunc_ShortNarrow, + .maxLetterWidth = 5, + .maxLetterHeight = 14, + .letterSpacing = 0, + .lineSpacing = 0, + .fgColor = 2, + .bgColor = 1, + .shadowColor = 3, + }, }; static const u8 sMenuCursorDimensions[][2] = { - [FONT_SMALL] = { 8, 12 }, - [FONT_NORMAL] = { 8, 15 }, - [FONT_SHORT] = { 8, 14 }, - [FONT_SHORT_COPY_1] = { 8, 14 }, - [FONT_SHORT_COPY_2] = { 8, 14 }, - [FONT_SHORT_COPY_3] = { 8, 14 }, - [FONT_BRAILLE] = { 8, 16 }, - [FONT_NARROW] = { 8, 15 }, - [FONT_SMALL_NARROW] = { 8, 8 }, - [FONT_BOLD] = {} + [FONT_SMALL] = { 8, 12 }, + [FONT_NORMAL] = { 8, 15 }, + [FONT_SHORT] = { 8, 14 }, + [FONT_SHORT_COPY_1] = { 8, 14 }, + [FONT_SHORT_COPY_2] = { 8, 14 }, + [FONT_SHORT_COPY_3] = { 8, 14 }, + [FONT_BRAILLE] = { 8, 16 }, + [FONT_NARROW] = { 8, 15 }, + [FONT_SMALL_NARROW] = { 8, 8 }, + [FONT_BOLD] = {}, + [FONT_NARROWER] = { 8, 15 }, + [FONT_SMALL_NARROWER] = { 8, 8 }, + [FONT_SHORT_NARROW] = { 8, 14 }, }; static const u16 sFontBoldJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/bold.hwjpnfont"); @@ -813,6 +858,42 @@ static u16 FontFunc_SmallNarrow(struct TextPrinter *textPrinter) return RenderText(textPrinter); } +static u16 FontFunc_Narrower(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); + + if (subStruct->hasFontIdBeenSet == FALSE) + { + subStruct->fontId = FONT_NARROWER; + subStruct->hasFontIdBeenSet = TRUE; + } + return RenderText(textPrinter); +} + +static u16 FontFunc_SmallNarrower(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); + + if (subStruct->hasFontIdBeenSet == FALSE) + { + subStruct->fontId = FONT_SMALL_NARROWER; + subStruct->hasFontIdBeenSet = TRUE; + } + return RenderText(textPrinter); +} + +static u16 FontFunc_ShortNarrow(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); + + if (subStruct->hasFontIdBeenSet == FALSE) + { + subStruct->fontId = FONT_SHORT_NARROW; + subStruct->hasFontIdBeenSet = TRUE; + } + return RenderText(textPrinter); +} + void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); @@ -1250,6 +1331,15 @@ static u16 RenderText(struct TextPrinter *textPrinter) case FONT_SMALL_NARROW: DecompressGlyph_SmallNarrow(currChar, textPrinter->japanese); break; + case FONT_NARROWER: + DecompressGlyph_Narrower(currChar, textPrinter->japanese); + break; + case FONT_SMALL_NARROWER: + DecompressGlyph_SmallNarrower(currChar, textPrinter->japanese); + break; + case FONT_SHORT_NARROW: + DecompressGlyph_ShortNarrow(currChar, textPrinter->japanese); + break; case FONT_BRAILLE: break; } @@ -2012,3 +2102,204 @@ static void DecompressGlyph_Bold(u16 glyphId) gCurGlyph.width = 8; gCurGlyph.height = 12; } + +static void DecompressGlyph_Narrower(u16 glyphId, bool32 isJapanese) +{ + const u16 *glyphs; + + if (isJapanese == TRUE) + { + glyphs = gFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10)); + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); + gCurGlyph.width = 8; + gCurGlyph.height = 15; + } + else + { + glyphs = gFontNarrowerLatinGlyphs + (0x20 * glyphId); + gCurGlyph.width = gFontNarrowerLatinGlyphWidths[glyphId]; + + if (gCurGlyph.width <= 8) + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + } + else + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8); + } + + gCurGlyph.height = 15; + } +} + +static u32 GetGlyphWidth_Narrower(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFontNarrowerLatinGlyphWidths[glyphId]; +} + +static void DecompressGlyph_SmallNarrower(u16 glyphId, bool32 isJapanese) +{ + const u16 *glyphs; + + if (isJapanese == TRUE) + { + glyphs = gFontSmallJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10)); + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); + gCurGlyph.width = 8; + gCurGlyph.height = 15; + } + else + { + glyphs = gFontSmallNarrowerLatinGlyphs + (0x20 * glyphId); + gCurGlyph.width = gFontSmallNarrowerLatinGlyphWidths[glyphId]; + + if (gCurGlyph.width <= 8) + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + } + else + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8); + } + + gCurGlyph.height = 15; + } +} + +static u32 GetGlyphWidth_SmallNarrower(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFontSmallNarrowerLatinGlyphWidths[glyphId]; +} + +static void DecompressGlyph_ShortNarrow(u16 glyphId, bool32 isJapanese) +{ + const u16 *glyphs; + + if (isJapanese == TRUE) + { + glyphs = gFontShortJapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); // gCurGlyph + 0x20 + DecompressGlyphTile(glyphs + 0x88, gCurGlyph.gfxBufferBottom + 8); // gCurGlyph + 0x60 + gCurGlyph.width = gFontShortJapaneseGlyphWidths[glyphId]; + gCurGlyph.height = 14; + } + else + { + glyphs = gFontShortNarrowLatinGlyphs + (0x20 * glyphId); + gCurGlyph.width = gFontShortNarrowLatinGlyphWidths[glyphId]; + + if (gCurGlyph.width <= 8) + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + } + else + { + DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); + DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); + DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom); + DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8); + } + + gCurGlyph.height = 14; + } +} + +static u32 GetGlyphWidth_ShortNarrow(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return gFontShortJapaneseGlyphWidths[glyphId]; + else + return gFontShortNarrowLatinGlyphWidths[glyphId]; +} + +static const s8 sNarrowerFontIds[] = +{ + [FONT_SMALL] = FONT_SMALL_NARROW, + [FONT_NORMAL] = FONT_NARROW, + [FONT_SHORT] = FONT_SHORT_NARROW, + [FONT_SHORT_COPY_1] = FONT_SHORT_NARROW, + [FONT_SHORT_COPY_2] = FONT_SHORT_NARROW, + [FONT_SHORT_COPY_3] = FONT_SHORT_NARROW, + [FONT_BRAILLE] = -1, + [FONT_NARROW] = FONT_NARROWER, + [FONT_SMALL_NARROW] = FONT_SMALL_NARROWER, + [FONT_BOLD] = -1, + [FONT_NARROWER] = -1, + [FONT_SMALL_NARROWER] = -1, + [FONT_SHORT_NARROW] = -1, +}; + +// If the narrowest font ID doesn't fit the text, we still return that +// ID because clipping is better than crashing. +u32 GetFontIdToFit(const u8 *string, u32 fontId, u32 letterSpacing, u32 widthPx) +{ + for (;;) + { + s32 narrowerFontId = sNarrowerFontIds[fontId]; + if (narrowerFontId == -1) + return fontId; + if (GetStringWidth(fontId, string, letterSpacing) <= widthPx) + return fontId; + fontId = narrowerFontId; + } +} + +u8 *PrependFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width) +{ + + u32 fitFontId = GetFontIdToFit(start, fontId, 0, width); + if (fitFontId != fontId) + { + memmove(&start[3], &start[0], end - start); + start[0] = EXT_CTRL_CODE_BEGIN; + start[1] = EXT_CTRL_CODE_FONT; + start[2] = fitFontId; + end[3] = EOS; + return end + 3; + } + else + { + return end; + } +} + +u8 *WrapFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width) +{ + + u32 fitFontId = GetFontIdToFit(start, fontId, 0, width); + if (fitFontId != fontId) + { + memmove(&start[3], &start[0], end - start); + start[0] = EXT_CTRL_CODE_BEGIN; + start[1] = EXT_CTRL_CODE_FONT; + start[2] = fitFontId; + end[3] = EXT_CTRL_CODE_BEGIN; + end[4] = EXT_CTRL_CODE_FONT; + end[5] = fontId; + end[6] = EOS; + return end + 6; + } + else + { + return end; + } +} diff --git a/gflib/text.h b/gflib/text.h index 7e1d7bfb11..0b12edc363 100644 --- a/gflib/text.h +++ b/gflib/text.h @@ -26,6 +26,9 @@ enum { FONT_NARROW, FONT_SMALL_NARROW, // Very similar to FONT_SMALL, some glyphs are narrower FONT_BOLD, // JP glyph set only + FONT_NARROWER, + FONT_SMALL_NARROWER, + FONT_SHORT_NARROW, }; // Return values for font functions @@ -190,4 +193,8 @@ u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension); u16 FontFunc_Braille(struct TextPrinter *textPrinter); u32 GetGlyphWidth_Braille(u16 glyphId, bool32 isJapanese); +u32 GetFontIdToFit(const u8 *string, u32 widestFontId, u32 letterSpacing, u32 widthPx); +u8 *PrependFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width); +u8 *WrapFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width); + #endif // GUARD_TEXT_H diff --git a/gflib/window.c b/gflib/window.c index 61264000ea..5e77283945 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -712,3 +712,13 @@ static u32 GetNumActiveWindowsOnBg8Bit(u32 bgId) } return windowsNum; } + +u32 WindowWidthPx(u32 windowId) +{ + return gWindows[windowId].window.width * TILE_WIDTH; +} + +u32 WindowTemplateWidthPx(const struct WindowTemplate *template) +{ + return template->width * TILE_WIDTH; +} diff --git a/gflib/window.h b/gflib/window.h index 85e385cb9f..2fd0bddb20 100644 --- a/gflib/window.h +++ b/gflib/window.h @@ -73,6 +73,8 @@ void FillWindowPixelBuffer8Bit(u32 windowId, u8 fillValue); void FillWindowPixelRect8Bit(u32 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); void BlitBitmapRectToWindow4BitTo8Bit(u32 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); void CopyWindowToVram8Bit(u32 windowId, u8 mode); +u32 WindowWidthPx(u32 windowId); +u32 WindowTemplateWidthPx(const struct WindowTemplate *template); extern struct Window gWindows[]; extern void *gWindowBgTilemapBuffers[]; diff --git a/graphics/fonts/latin_narrower.png b/graphics/fonts/latin_narrower.png new file mode 100644 index 0000000000000000000000000000000000000000..22847ef09953dda2644214d2619277f4090324b2 GIT binary patch literal 7346 zcmeHKeK^zW|NqP|=BYxY2Qw$>VKy@}V;=Hc#*#`Twiy<-VQeH8={WLKsguVRw9X^_Zug@Wu5NLX+py@N&_}g*O}W~T=%}CvPV+tlI<(|j4gzV zc6smaB3d_THV-JCs~tE2BU@$DJPhIaVWTbmG-#)L`-zjJs~is*GHv4=Hs0r`jg7^7 zX4|v4&G2)Qq&pH_{xy-mMhf94v|}1xR7ZWvaAcQ%kyl)wAp4|cmE5@0<{tNPua7ZL z%EG+2_@&R7eR(`=IRkWD-mjoeZS(=tJI1uIpx9Yh{GJV%L*|i_B-?vt>+X9z-(j_7 zOX!NgW=hsrF0#+LgmMgiVXtp{{lGJ{@3WMPHwf@D37F~X5_z2`w}?03(IQw}Wz6Z^ z6RDr;F18|H#Pmnj)=b|x43qkZeO_uN+sf^>-`Gdfs@Wpx@v9B6peihF*+zFbb!v!k z=iRUUqwc9bAtuvfS6Rnay3vym5t^$e#|tZ|?9Ma50lm^XgFe0;{XJHgQ_i)oSck|%UX}#I}Z5Y1HRB704{prA2;9^n9fEZeqK zDzBUmCxTVSXM)w`LbfN;*#SCKFE)*#!w=wqWd{JprhE>S?#JLFXbc}Fi-de%Q-?$_ zy-3J?`eY25W5Muc+J*-)c85DS)5HDfhF(Zh6Sy&-2o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_narrow.png b/graphics/fonts/latin_short_narrow.png new file mode 100644 index 0000000000000000000000000000000000000000..cf48712719ace38225213bdf1b896ac07e7f9e19 GIT binary patch literal 7508 zcmeHKdo+~m_kU*wYUSA-|t$#?^)~n{qM|rXT8s}pS?eO@6WTJz1}C4 z>f#_PttJfsfUJ|FohtyqpdlQ9BcPYUJMR$abv@R78_$&%h2li8gP5TpiWkEHQD8JP z2mqo7!l*uS2yMwPAC)ZO*rgft#wVvtC#MgVbPViT*1D8u_wZAKW%v0cYW7&5_txv$ zTMdj=B@#`R+elzVW0)d~5d9gYx!YTC$Ll<_Ox1j$f#?2?(bwp1ru+uxIcQYhS=W$Ad6tZ{35_eOgI zgIx;Y?bPEhOVA_k<8P)U4oXvW1pp9K9 zV<=-`6ne((Z3`{1x~p}gdQC~$(#=a9+$p8;+N0ICV-D7MR9+mn{3K&*z8frfL3GFz zq7S2NlJ^>H)W5kQ*W=_?G1s~NX_vf5SHDka(@QTgt0vnw*l%BiaMQv1@bI$2-eIwB}vKM31@Vo86l zU&m&*_KC!gMxW2D!$r%ytBAQ~{4xA9aH_0)OqRouOjFj6yLPj&@k!j=N9UU6mD#Eh zHPuD2B&g`3nNV?Uqd1f3>@Y(bgB=JOMu%~rssjKE>u3&*z7yo30>NM=%M$&%u^EkG zGAz-a#uOZdV+)2b9b+Rvw^$cXGmgsF1D$14}0iuY8L_-|LKAO3UfVPrGSwt{`NUnApzC%DWOLPd2$01>{ zQBhHbQAURBh+r(<+}s?CBVY*x45WeK#;|y_Xbg+1vjFi8!w%%qBbXc>lg&acVA2BF zkvvN@8d^vF9$y%TLiq!p#r@6##0NH-#=+tZaoDgh?2i^)p8YNe)`IH}ol&eS z$Yn=H&_VlMAd9E-BLsu~hdn1UB6Kkw1|18Af?<#<7xIe#i%SP53iS_*1qy;@|Zz?lJ%F^7FHJ1`7sd4{14o}X#bx3qB5jKp^)s@^vH$qoa`*o3;szAHl4{J zeH-F&Ac&)b7-Lg&9EM0^m|y~p%z`j9G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file_rules.mk +++ b/graphics_file_rules.mk @@ -238,6 +238,15 @@ $(FONTGFXDIR)/narrow.latfont: $(FONTGFXDIR)/latin_narrow.png $(FONTGFXDIR)/small_narrow.latfont: $(FONTGFXDIR)/latin_small_narrow.png $(GFX) $< $@ +$(FONTGFXDIR)/narrower.latfont: $(FONTGFXDIR)/latin_narrower.png + $(GFX) $< $@ + +$(FONTGFXDIR)/small_narrower.latfont: $(FONTGFXDIR)/latin_small_narrower.png + $(GFX) $< $@ + +$(FONTGFXDIR)/short_narrow.latfont: $(FONTGFXDIR)/latin_short_narrow.png + $(GFX) $< $@ + $(FONTGFXDIR)/small.hwjpnfont: $(FONTGFXDIR)/japanese_small.png $(GFX) $< $@ diff --git a/include/fonts.h b/include/fonts.h index c21c75942d..a6be35db98 100644 --- a/include/fonts.h +++ b/include/fonts.h @@ -15,5 +15,11 @@ extern const u16 gFontNarrowLatinGlyphs[]; extern const u8 gFontNarrowLatinGlyphWidths[]; extern const u16 gFontSmallNarrowLatinGlyphs[]; extern const u8 gFontSmallNarrowLatinGlyphWidths[]; +extern const u8 gFontNarrowerLatinGlyphWidths[]; +extern const u16 gFontNarrowerLatinGlyphs[]; +extern const u8 gFontSmallNarrowerLatinGlyphWidths[]; +extern const u16 gFontSmallNarrowerLatinGlyphs[]; +extern const u8 gFontShortNarrowLatinGlyphWidths[]; +extern const u16 gFontShortNarrowLatinGlyphs[]; #endif // GUARD_FONTS_H diff --git a/include/list_menu.h b/include/list_menu.h index 23caaf4b4c..1e6c0f95fa 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -40,8 +40,9 @@ struct ListMenuTemplate const struct ListMenuItem *items; void (* moveCursorFunc)(s32 itemIndex, bool8 onInit, struct ListMenu *list); void (* itemPrintFunc)(u8 windowId, u32 itemId, u8 y); - u16 totalItems; - u16 maxShowed; + u16 totalItems:12; + u16 maxShowed:12; + u16 textNarrowWidth:8; u8 windowId; u8 header_X; u8 item_X; diff --git a/src/fonts.c b/src/fonts.c index 72de054b73..92600fcf7e 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -180,6 +180,114 @@ ALIGNED(4) const u8 gFontNormalLatinGlyphWidths[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, }; +ALIGNED(4) const u16 gFontNarrowerLatinGlyphs[] = INCBIN_U16("graphics/fonts/narrower.latfont"); +ALIGNED(4) const u8 gFontNarrowerLatinGlyphWidths[] = { + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, + 8, 4, 4, 4, 5, 5, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, + 4, 4, 4, 4, 4, 6, 4, 4, 4, 5, 4, 5, 8, 6, 6, 3, + 3, 3, 3, 3, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 5, 4, 8, 8, 8, 7, 8, 8, 4, 4, 6, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 7, 7, 7, 7, 0, 0, 3, + 4, 5, 6, 7, 4, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 3, 5, 3, + 5, 5, 5, 3, 3, 5, 5, 6, 3, 6, 6, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, + 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, + 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, + 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 10, 10, 10, 10, 8, 8, 10, 8, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontSmallNarrowerLatinGlyphs[] = INCBIN_U16("graphics/fonts/small_narrower.latfont"); +ALIGNED(4) const u8 gFontSmallNarrowerLatinGlyphWidths[] = { + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, + 5, 4, 4, 4, 5, 4, 4, 4, 3, 4, 4, 4, 4, 4, 3, 3, + 4, 4, 4, 4, 4, 6, 4, 4, 4, 5, 4, 4, 7,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8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + ALIGNED(4) const u16 gFontSmallJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/small.hwjpnfont"); ALIGNED(4) const u16 gFontNormalJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/normal.hwjpnfont"); diff --git a/src/list_menu.c b/src/list_menu.c index e83f325161..aa65683edd 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -600,11 +600,14 @@ static void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y) u8 colors[3]; if (gListMenuOverride.enabled) { + u32 fontId = gListMenuOverride.fontId; + if (list->template.textNarrowWidth) + fontId = GetFontIdToFit(str, fontId, gListMenuOverride.lettersSpacing, list->template.textNarrowWidth); colors[0] = gListMenuOverride.fillValue; colors[1] = gListMenuOverride.cursorPal; colors[2] = gListMenuOverride.cursorShadowPal; AddTextPrinterParameterized4(list->template.windowId, - gListMenuOverride.fontId, + fontId, x, y, gListMenuOverride.lettersSpacing, 0, colors, TEXT_SKIP_DRAW, str); @@ -613,11 +616,14 @@ static void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y) } else { + u32 fontId = list->template.fontId; + if (list->template.textNarrowWidth) + fontId = GetFontIdToFit(str, fontId, list->template.lettersSpacing, list->template.textNarrowWidth); colors[0] = list->template.fillValue; colors[1] = list->template.cursorPal; colors[2] = list->template.cursorShadowPal; AddTextPrinterParameterized4(list->template.windowId, - list->template.fontId, + fontId, x, y, list->template.lettersSpacing, 0, colors, TEXT_SKIP_DRAW, str);