mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-23 04:12:02 +00:00
fatal: Add font scaling support
This commit is contained in:
parent
1bface09d5
commit
f16423c413
3 changed files with 9 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
|||
static u16 *g_fb = nullptr;
|
||||
static u32 (*g_unswizzle_func)(u32, u32) = nullptr;
|
||||
static u16 g_font_color = 0xFFFF;
|
||||
static float g_font_sz = 16.0f;
|
||||
static u32 g_cur_x = 0, g_cur_y = 0;
|
||||
|
||||
static PlFontData g_font;
|
||||
|
@ -132,6 +133,11 @@ void FontManager::SetPosition(u32 x, u32 y) {
|
|||
g_cur_y = y;
|
||||
}
|
||||
|
||||
void FontManager::SetFontSize(float fsz) {
|
||||
g_font_sz = fsz;
|
||||
g_ft_err = FT_Set_Char_Size(g_face, 0, static_cast<u32>(g_font_sz * 64.0f), 96, 96);
|
||||
}
|
||||
|
||||
void FontManager::AddSpacingLines(float num_lines) {
|
||||
g_cur_y += static_cast<u32>((static_cast<float>(g_face->size->metrics.height) * num_lines) / 64.0f);
|
||||
}
|
||||
|
@ -159,6 +165,6 @@ Result FontManager::InitializeSharedFont() {
|
|||
g_ft_err = FT_New_Memory_Face(g_library, reinterpret_cast<const FT_Byte *>(g_font.address), g_font.size, 0, &g_face);
|
||||
if (g_ft_err) return g_ft_err;
|
||||
|
||||
g_ft_err = FT_Set_Char_Size(g_face, 0, 8*64, 300, 300);
|
||||
g_ft_err = FT_Set_Char_Size(g_face, 0, static_cast<u32>(g_font_sz * 64.0f), 96, 96);
|
||||
return g_ft_err;
|
||||
}
|
|
@ -31,6 +31,7 @@ class FontManager {
|
|||
|
||||
static void SetFontColor(u16 color);
|
||||
static void SetPosition(u32 x, u32 y);
|
||||
static void SetFontSize(float fsz);
|
||||
static void AddSpacingLines(float num_lines);
|
||||
static void PrintLine(const char *str);
|
||||
static void PrintFormatLine(const char *format, ...);
|
||||
|
|
|
@ -207,7 +207,7 @@ Result ShowFatalTask::ShowFatal() {
|
|||
FontManager::PrintFormatLine(u8"Firmware: %s (Atmosphère %u.%u.%u-%s)", GetFatalConfig()->firmware_version.display_version,
|
||||
CURRENT_ATMOSPHERE_VERSION, GetAtmosphereGitRevision());
|
||||
|
||||
|
||||
|
||||
/* Enqueue the buffer. */
|
||||
framebufferEnd(&fb);
|
||||
|
||||
|
|
Loading…
Reference in a new issue