mirror of
https://github.com/pret/pokefirered.git
synced 2026-09-28 03:49:31 -05:00
added 5 narrow fonts from expansion
This commit is contained in:
@@ -461,6 +461,11 @@ FONT_NORMAL = FC 06 02
|
||||
FONT_NORMAL_COPY_2 = FC 06 03
|
||||
FONT_MALE = FC 06 04
|
||||
FONT_FEMALE = FC 06 05
|
||||
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
|
||||
|
||||
|
||||
535
gflib/text.c
535
gflib/text.c
@@ -24,12 +24,22 @@ static void DecompressGlyph_NormalCopy1(u16 glyphId, bool32 isJapanese);
|
||||
static void DecompressGlyph_NormalCopy2(u16 glyphId, bool32 isJapanese);
|
||||
static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese);
|
||||
static void DecompressGlyph_Bold(u16 glyphId);
|
||||
static s32 GetGlyphWidth_Small(u16 glyphId, bool32 isJapanese);
|
||||
static s32 GetGlyphWidth_NormalCopy1(u16 glyphId, bool32 isJapanese);
|
||||
static s32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese);
|
||||
static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese);
|
||||
static s32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese);
|
||||
static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese);
|
||||
static void DecompressGlyph_Narrow(u16, bool32);
|
||||
static void DecompressGlyph_SmallNarrow(u16, bool32);
|
||||
static void DecompressGlyph_Narrower(u16, bool32);
|
||||
static void DecompressGlyph_SmallNarrower(u16, bool32);
|
||||
static void DecompressGlyph_ShortNarrow(u16, bool32);
|
||||
static u32 GetGlyphWidth_Small(u16 glyphId, bool32 isJapanese);
|
||||
static u32 GetGlyphWidth_NormalCopy1(u16 glyphId, bool32 isJapanese);
|
||||
static u32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese);
|
||||
static u32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese);
|
||||
static u32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese);
|
||||
static u32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese);
|
||||
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 void SpriteCB_TextCursor(struct Sprite *sprite);
|
||||
|
||||
TextFlags gTextFlags;
|
||||
@@ -55,7 +65,12 @@ static const struct GlyphWidthFunc sGlyphWidthFuncs[] = {
|
||||
{ FONT_NORMAL_COPY_2, GetGlyphWidth_NormalCopy2 },
|
||||
{ FONT_MALE, GetGlyphWidth_Male },
|
||||
{ FONT_FEMALE, GetGlyphWidth_Female },
|
||||
{ FONT_BRAILLE, GetGlyphWidth_Braille }
|
||||
{ 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 },
|
||||
};
|
||||
|
||||
static const struct SpriteSheet sSpriteSheets_TextCursor[] =
|
||||
@@ -390,6 +405,187 @@ static const u8 sFontFemaleJapaneseGlyphWidths[] =
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0
|
||||
};
|
||||
|
||||
ALIGNED(4) const u16 gFontSmallNarrowLatinGlyphs[] = INCBIN_U16("graphics/fonts/small_narrow.latfont");
|
||||
ALIGNED(4) const u8 g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 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, 5, 6, 3,
|
||||
3, 3, 3, 3, 8, 0, 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, 4, 3, 7, 7, 7, 8, 8, 8, 8, 4, 5, 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, 8, 8, 8, 8, 0, 0, 3,
|
||||
4, 5, 6, 7, 4, 5, 5, 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, 3, 4, 3, 4, 4,
|
||||
5, 5, 5, 3, 3, 5, 5, 5, 4, 5, 5, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4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
|
||||
|
||||
ALIGNED(4) const u16 gFontShortNarrowLatinGlyphs[] = INCBIN_U16("graphics/fonts/short_narrow.latfont");
|
||||
ALIGNED(4) const u8 gFontShortNarrowLatinGlyphWidths[] = {
|
||||
3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5,
|
||||
8, 5, 5, 5, 5, 6, 5, 5, 3, 5, 5, 5, 5, 5, 4, 3,
|
||||
4, 4, 5, 5, 5, 8, 5, 5, 5, 5, 6, 6, 9, 6, 6, 3,
|
||||
3, 3, 3, 3, 10, 8, 5, 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,
|
||||
6, 6, 6, 8, 8, 8, 8, 8, 8, 4, 6, 8, 5, 5, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 6,
|
||||
3, 3, 3, 3, 3, 3, 3, 6, 3, 12, 12, 12, 12, 0, 0, 3,
|
||||
4, 5, 6, 7, 8, 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,
|
||||
8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5,
|
||||
6, 6, 6, 3, 3, 6, 6, 8, 5, 9, 6, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5,
|
||||
5, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5,
|
||||
4, 6, 5, 5, 5, 5, 5, 5, 4, 5, 5, 6, 4, 5, 5, 8,
|
||||
5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
12, 12, 12, 12, 8, 10, 10, 10, 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,
|
||||
};
|
||||
|
||||
|
||||
static const u16 sFontBoldJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/japanese_bold.fwjpnfont");
|
||||
|
||||
u16 FontFunc_Small(struct TextPrinter *textPrinter)
|
||||
@@ -464,6 +660,66 @@ u16 FontFunc_Female(struct TextPrinter *textPrinter)
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
|
||||
u16 FontFunc_Narrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = FONT_NARROW;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
|
||||
u16 FontFunc_SmallNarrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = FONT_SMALL_NARROW;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
|
||||
u16 FontFunc_Narrower(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = FONT_NARROWER;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
|
||||
u16 FontFunc_SmallNarrower(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = FONT_SMALL_NARROWER;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
|
||||
u16 FontFunc_ShortNarrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->subUnion.sub.glyphId = FONT_SHORT_NARROW;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
|
||||
void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
|
||||
@@ -843,6 +1099,21 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
case FONT_FEMALE:
|
||||
DecompressGlyph_Female(currChar, textPrinter->japanese);
|
||||
break;
|
||||
case FONT_NARROW:
|
||||
DecompressGlyph_Narrow(currChar, textPrinter->japanese);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
|
||||
CopyGlyphToWindow(textPrinter);
|
||||
@@ -923,7 +1194,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
return RENDER_FINISH;
|
||||
}
|
||||
|
||||
s32 (*GetFontWidthFunc(u8 glyphId))(u16 _glyphId, bool32 _isJapanese)
|
||||
u32 (*GetFontWidthFunc(u8 glyphId))(u16 _glyphId, bool32 _isJapanese)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
@@ -940,7 +1211,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
|
||||
{
|
||||
bool8 isJapanese;
|
||||
int minGlyphWidth;
|
||||
s32 (*func)(u16 glyphId, bool32 isJapanese);
|
||||
u32 (*func)(u16 glyphId, bool32 isJapanese);
|
||||
int localLetterSpacing;
|
||||
u32 lineWidth;
|
||||
const u8 *bufferPointer;
|
||||
@@ -1304,7 +1575,7 @@ void DecompressGlyph_Small(u16 glyphId, bool32 isJapanese)
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetGlyphWidth_Small(u16 glyphId, bool32 isJapanese)
|
||||
static u32 GetGlyphWidth_Small(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
return 8;
|
||||
@@ -1338,7 +1609,7 @@ static void DecompressGlyph_NormalCopy1(u16 glyphId, bool32 isJapanese)
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetGlyphWidth_NormalCopy1(u16 glyphId, bool32 isJapanese)
|
||||
static u32 GetGlyphWidth_NormalCopy1(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
return 8;
|
||||
@@ -1404,7 +1675,7 @@ void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese)
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese)
|
||||
static u32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
@@ -1454,7 +1725,7 @@ static void DecompressGlyph_NormalCopy2(u16 glyphId, bool32 isJapanese)
|
||||
DecompressGlyph_Normal(glyphId, isJapanese);
|
||||
}
|
||||
|
||||
static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese)
|
||||
static u32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
return 10;
|
||||
@@ -1520,7 +1791,7 @@ static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese)
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese)
|
||||
static u32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
@@ -1591,7 +1862,7 @@ void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese)
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese)
|
||||
static u32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
@@ -1613,21 +1884,241 @@ static void DecompressGlyph_Bold(u16 glyphId)
|
||||
gGlyphInfo.height = 12;
|
||||
}
|
||||
|
||||
static void DecompressGlyph_Narrow(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
const u16 *glyphs;
|
||||
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
glyphs = sFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10));
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
gGlyphInfo.width = 8;
|
||||
gGlyphInfo.height = 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
glyphs = gFontNarrowLatinGlyphs + (0x20 * glyphId);
|
||||
gGlyphInfo.width = gFontNarrowLatinGlyphWidths[glyphId];
|
||||
|
||||
if (gGlyphInfo.width <= 8)
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
}
|
||||
else
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
}
|
||||
|
||||
gGlyphInfo.height = 15;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetGlyphWidth_Narrow(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
return 8;
|
||||
else
|
||||
return gFontNarrowLatinGlyphWidths[glyphId];
|
||||
}
|
||||
|
||||
static void DecompressGlyph_SmallNarrow(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
const u16 *glyphs;
|
||||
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
glyphs = sFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
gGlyphInfo.width = 8;
|
||||
gGlyphInfo.height = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
glyphs = gFontSmallNarrowLatinGlyphs + (0x20 * glyphId);
|
||||
gGlyphInfo.width = gFontSmallNarrowLatinGlyphWidths[glyphId];
|
||||
|
||||
if (gGlyphInfo.width <= 8)
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
}
|
||||
else
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
}
|
||||
|
||||
gGlyphInfo.height = 12;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetGlyphWidth_SmallNarrow(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
return 8;
|
||||
else
|
||||
return gFontSmallNarrowLatinGlyphWidths[glyphId];
|
||||
}
|
||||
|
||||
static void DecompressGlyph_Narrower(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
const u16 *glyphs;
|
||||
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
glyphs = sFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10));
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
gGlyphInfo.width = 8;
|
||||
gGlyphInfo.height = 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
glyphs = gFontNarrowerLatinGlyphs + (0x20 * glyphId);
|
||||
gGlyphInfo.width = gFontNarrowerLatinGlyphWidths[glyphId];
|
||||
|
||||
if (gGlyphInfo.width <= 8)
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
}
|
||||
else
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
}
|
||||
|
||||
gGlyphInfo.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 = sFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10));
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
gGlyphInfo.width = 8;
|
||||
gGlyphInfo.height = 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
glyphs = gFontSmallNarrowerLatinGlyphs + (0x20 * glyphId);
|
||||
gGlyphInfo.width = gFontSmallNarrowerLatinGlyphWidths[glyphId];
|
||||
|
||||
if (gGlyphInfo.width <= 8)
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
}
|
||||
else
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
}
|
||||
|
||||
gGlyphInfo.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 = sFontNormalJapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
gGlyphInfo.width = sFontNormalJapaneseGlyphWidths[glyphId];
|
||||
gGlyphInfo.height = 14;
|
||||
}
|
||||
else
|
||||
{
|
||||
glyphs = gFontShortNarrowLatinGlyphs + (0x20 * glyphId);
|
||||
gGlyphInfo.width = gFontShortNarrowLatinGlyphWidths[glyphId];
|
||||
|
||||
if (gGlyphInfo.width <= 8)
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
}
|
||||
else
|
||||
{
|
||||
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
|
||||
}
|
||||
|
||||
gGlyphInfo.height = 14;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetGlyphWidth_ShortNarrow(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
if (isJapanese == TRUE)
|
||||
return sFontNormalJapaneseGlyphWidths[glyphId];
|
||||
else
|
||||
return gFontShortNarrowLatinGlyphWidths[glyphId];
|
||||
}
|
||||
|
||||
static const s8 sNarrowerFontIds[] =
|
||||
{
|
||||
[FONT_SMALL] = -1, // FONT_SMALL_NARROW,
|
||||
[FONT_NORMAL] = -1, // FONT_NARROW,
|
||||
[FONT_SMALL] = FONT_SMALL_NARROW, // FONT_SMALL_NARROW,
|
||||
[FONT_NORMAL] = FONT_NARROW, // 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_NARROW] = FONT_NARROWER,
|
||||
[FONT_SMALL_NARROW] = FONT_SMALL_NARROWER,
|
||||
[FONT_BOLD] = -1,
|
||||
// [FONT_NARROWER] = -1,
|
||||
// [FONT_SMALL_NARROWER] = -1,
|
||||
// [FONT_SHORT_NARROW] = -1,
|
||||
[FONT_NARROWER] = -1,
|
||||
[FONT_SMALL_NARROWER] = -1,
|
||||
[FONT_SHORT_NARROW] = -1,
|
||||
[FONT_MALE] = FONT_NORMAL,
|
||||
[FONT_FEMALE] = FONT_NORMAL,
|
||||
};
|
||||
|
||||
// If the narrowest font ID doesn't fit the text, we still return that
|
||||
|
||||
17
gflib/text.h
17
gflib/text.h
@@ -20,6 +20,11 @@ enum {
|
||||
FONT_FEMALE,
|
||||
FONT_BRAILLE,
|
||||
FONT_BOLD,
|
||||
FONT_NARROW,
|
||||
FONT_SMALL_NARROW, // Very similar to FONT_SMALL, some glyphs are narrower
|
||||
FONT_NARROWER,
|
||||
FONT_SMALL_NARROWER,
|
||||
FONT_SHORT_NARROW,
|
||||
};
|
||||
|
||||
// Return values for font functions
|
||||
@@ -125,7 +130,7 @@ extern const struct FontInfo *gFonts;
|
||||
struct GlyphWidthFunc
|
||||
{
|
||||
u32 fontId;
|
||||
s32 (*func)(u16 glyphId, bool32 isJapanese);
|
||||
u32 (*func)(u16 glyphId, bool32 isJapanese);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -166,6 +171,11 @@ u16 FontFunc_NormalCopy2(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_Male(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_Female(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_Braille(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_Narrow(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_SmallNarrow(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_Narrower(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_SmallNarrower(struct TextPrinter *textPrinter);
|
||||
u16 FontFunc_ShortNarrow(struct TextPrinter *textPrinter);
|
||||
|
||||
void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter);
|
||||
void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter);
|
||||
@@ -175,7 +185,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
|
||||
bool16 TextPrinterWait(struct TextPrinter *textPrinter);
|
||||
void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex);
|
||||
u16 RenderText(struct TextPrinter *textPrinter);
|
||||
s32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
|
||||
u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
|
||||
s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
|
||||
u8 RenderTextHandleBold(u8 *pixels, u8 fontId, u8 *str);
|
||||
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
|
||||
@@ -187,10 +197,11 @@ u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension);
|
||||
void DecompressGlyph_Small(u16 glyphId, bool32 isJapanese);
|
||||
void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese);
|
||||
void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese);
|
||||
s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese);
|
||||
u32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese);
|
||||
u8 CreateTextCursorSprite(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority);
|
||||
void DestroyTextCursorSprite(u8 spriteId);
|
||||
|
||||
u32 GetFontIdToFit(const u8 *string, u32 widestFontId, u32 letterSpacing, u32 widthPx);
|
||||
u8 *PrependFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width);
|
||||
|
||||
#endif // GUARD_TEXT_H
|
||||
|
||||
BIN
graphics/fonts/latin_narrow.png
Normal file
BIN
graphics/fonts/latin_narrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
BIN
graphics/fonts/latin_narrower.png
Normal file
BIN
graphics/fonts/latin_narrower.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
BIN
graphics/fonts/latin_short_narrow.png
Normal file
BIN
graphics/fonts/latin_short_narrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
BIN
graphics/fonts/latin_small_narrow.png
Normal file
BIN
graphics/fonts/latin_small_narrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
BIN
graphics/fonts/latin_small_narrower.png
Normal file
BIN
graphics/fonts/latin_small_narrower.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
@@ -36,6 +36,23 @@ JPCONTESTGFXDIR := graphics/contest/japanese
|
||||
types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark
|
||||
contest_types := cool beauty cute smart tough
|
||||
|
||||
|
||||
### Fonts ###
|
||||
$(FONTGFXDIR)/narrow.latfont: $(FONTGFXDIR)/latin_narrow.png
|
||||
$(GFX) $< $@
|
||||
|
||||
$(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)/latin_small.latfont: $(FONTGFXDIR)/latin_small.png
|
||||
$(GFX) $< $@
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ extern struct BagPocket gBagPockets[];
|
||||
|
||||
void GetBerryCountString(u8 *dst, const u8 *berryName, u32 quantity);
|
||||
void CopyItemName(u16 itemId, u8 *string);
|
||||
void CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity);
|
||||
u8 *CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity);
|
||||
bool8 IsBagPocketNonEmpty(u8 pocket);
|
||||
bool8 CheckBagHasItem(u16 itemId, u16 count);
|
||||
bool8 CheckBagHasSpace(u16 itemId, u16 count);
|
||||
|
||||
@@ -3829,6 +3829,15 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) {
|
||||
printerTemplate.fgColor = sTextOnWindowsInfo_Normal[windowId].fgColor;
|
||||
printerTemplate.bgColor = sTextOnWindowsInfo_Normal[windowId].bgColor;
|
||||
printerTemplate.shadowColor = sTextOnWindowsInfo_Normal[windowId].shadowColor;
|
||||
|
||||
if (B_WIN_MOVE_NAME_1 <= windowId && windowId <= B_WIN_MOVE_NAME_4)
|
||||
{
|
||||
// We cannot check the actual width of the window because
|
||||
// B_WIN_MOVE_NAME_1 and B_WIN_MOVE_NAME_3 are 16 wide for
|
||||
// Z-move details.
|
||||
printerTemplate.fontId = GetFontIdToFit(text, printerTemplate.fontId, printerTemplate.letterSpacing, 8 * TILE_WIDTH);
|
||||
}
|
||||
|
||||
if (windowId == B_WIN_OAK_OLD_MAN)
|
||||
gTextFlags.useAlternateDownArrow = FALSE;
|
||||
else
|
||||
|
||||
@@ -206,7 +206,7 @@ static void DecompressGlyph_Braille(u16 glyph)
|
||||
gGlyphInfo.height = 16;
|
||||
}
|
||||
|
||||
s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese)
|
||||
u32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese)
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
31
src/item.c
31
src/item.c
@@ -19,6 +19,8 @@
|
||||
EWRAM_DATA struct BagPocket gBagPockets[NUM_BAG_POCKETS] = {};
|
||||
|
||||
void SortAndCompactBagPocket(struct BagPocket * pocket);
|
||||
static const u8 *ItemId_GetPluralName(u16);
|
||||
static bool32 DoesItemHavePluralName(u16);
|
||||
|
||||
// Item descriptions and data
|
||||
#include "constants/moves.h"
|
||||
@@ -83,6 +85,25 @@ void CopyItemName(u16 itemId, u8 * dest)
|
||||
StringCopy(dest, ItemId_GetName(itemId));
|
||||
}
|
||||
|
||||
const u8 sText_s[] =_("s");
|
||||
|
||||
u8 *CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity)
|
||||
{
|
||||
if (quantity == 1)
|
||||
{
|
||||
return StringCopy(dst, ItemId_GetName(itemId));
|
||||
}
|
||||
else if (DoesItemHavePluralName(itemId))
|
||||
{
|
||||
return StringCopy(dst, ItemId_GetPluralName(itemId));
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 *end = StringCopy(dst, ItemId_GetName(itemId));
|
||||
return StringCopy(end, sText_s);
|
||||
}
|
||||
}
|
||||
|
||||
s8 BagPocketGetFirstEmptySlot(u8 pocketId)
|
||||
{
|
||||
u16 i;
|
||||
@@ -617,6 +638,16 @@ u16 ItemId_GetPrice(u16 itemId)
|
||||
return gItemsInfo[SanitizeItemId(itemId)].price;
|
||||
}
|
||||
|
||||
static bool32 DoesItemHavePluralName(u16 itemId)
|
||||
{
|
||||
return (gItemsInfo[SanitizeItemId(itemId)].pluralName[0] != '\0');
|
||||
}
|
||||
|
||||
static const u8 *ItemId_GetPluralName(u16 itemId)
|
||||
{
|
||||
return gItemsInfo[SanitizeItemId(itemId)].pluralName;
|
||||
}
|
||||
|
||||
u8 ItemId_GetHoldEffect(u16 itemId)
|
||||
{
|
||||
return gItemsInfo[SanitizeItemId(itemId)].holdEffect;
|
||||
|
||||
@@ -137,7 +137,57 @@ static const struct FontInfo gFontInfos[] =
|
||||
.fgColor = 1,
|
||||
.bgColor = 2,
|
||||
.shadowColor = 15,
|
||||
}
|
||||
},
|
||||
[FONT_NARROW] = {
|
||||
.fontFunction = FontFunc_Narrow,
|
||||
.maxLetterWidth = 5,
|
||||
.maxLetterHeight = 16,
|
||||
.letterSpacing = 0,
|
||||
.lineSpacing = 0,
|
||||
.fgColor = 2,
|
||||
.bgColor = 1,
|
||||
.shadowColor = 3,
|
||||
},
|
||||
[FONT_SMALL_NARROW] = {
|
||||
.fontFunction = FontFunc_SmallNarrow,
|
||||
.maxLetterWidth = 5,
|
||||
.maxLetterHeight = 8,
|
||||
.letterSpacing = 0,
|
||||
.lineSpacing = 0,
|
||||
.fgColor = 2,
|
||||
.bgColor = 1,
|
||||
.shadowColor = 3,
|
||||
},
|
||||
[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 gMenuCursorDimensions[][2] =
|
||||
|
||||
1040
test/text.c
1040
test/text.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user