Switch to ARIALUNI

This commit is contained in:
Grinch_ 2022-06-20 14:50:04 +06:00
parent ca325a4c2d
commit 6e427c7815
7 changed files with 14 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
archives/ archives/
build/ build/
tools/pack/ tools/pack/
archive/
.gitignore .gitignore
CheatMenuVC.7z CheatMenuVC.7z
CheatMenuIII.7z CheatMenuIII.7z

Binary file not shown.

View File

@ -139,8 +139,8 @@ void D3dHook::ProcessFrame(void* ptr)
ImGui_ImplWin32_EnableDpiAwareness(); ImGui_ImplWin32_EnableDpiAwareness();
// Loading fonts // Loading fonts
io.FontDefault = FontMgr::Load("text", 1.1f); io.FontDefault = FontMgr::Load("text", "C:/Windows/Fonts/ARIALUNI.TTF", 1.15f);
FontMgr::Load("title", 2.0f); FontMgr::Load("title", PLUGIN_PATH((char*)FILE_NAME "/fonts/title.ttf"), 2.0f);
io.IniFilename = nullptr; io.IniFilename = nullptr;
io.LogFilename = nullptr; io.LogFilename = nullptr;

View File

@ -9,7 +9,7 @@
#define MENU_NAME "Cheat Menu" #define MENU_NAME "Cheat Menu"
#define MENU_VERSION_NUMBER "3.3" #define MENU_VERSION_NUMBER "3.3"
#define MENU_VERSION MENU_VERSION_NUMBER"-beta" #define MENU_VERSION MENU_VERSION_NUMBER"-beta"
#define BUILD_NUMBER "20220618" #define BUILD_NUMBER "20220620"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION #define MENU_TITLE MENU_NAME " v" MENU_VERSION
#ifdef GTASA #ifdef GTASA

View File

@ -1,11 +1,11 @@
#include "fontmgr.h" #include "fontmgr.h"
#include "pch.h" #include "pch.h"
ImFont* FontMgr::Get(const char* fontName) ImFont* FontMgr::Get(const char* fontID)
{ {
for (auto &data : m_vecFonts) for (auto &data : m_vecFonts)
{ {
if (!strcmp(data.m_path.c_str(), fontName)) if (!strcmp(data.m_ID.c_str(), fontID))
{ {
return data.m_pFont; return data.m_pFont;
} }
@ -39,16 +39,14 @@ const ImWchar* FontMgr::GetGlyphRanges()
return &ranges[0]; return &ranges[0];
} }
ImFont* FontMgr::Load(const char* fontName, float fontMul) ImFont* FontMgr::Load(const char* fontID, const char* path, float fontMul)
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
size_t fontSize = static_cast<int>(screen::GetScreenHeight() / 54.85f) * fontMul; size_t fontSize = static_cast<int>(screen::GetScreenHeight() / 54.85f) * fontMul;
std::string fullPath = std::format("{}{}.ttf", PLUGIN_PATH((char*)FILE_NAME "/fonts/"), fontName); ImFont *pFont = io.Fonts->AddFontFromFileTTF(path, fontSize, NULL, GetGlyphRanges());
ImFont *pFont = io.Fonts->AddFontFromFileTTF(fullPath.c_str(), fontSize, NULL, GetGlyphRanges());
m_vecFonts.push_back({pFont, fontSize, fontMul, std::string(fontName)}); m_vecFonts.push_back({pFont, fontSize, fontMul, std::string(fontID), std::string(path)});
io.Fonts->Build(); io.Fonts->Build();
return pFont; return pFont;
} }
@ -65,8 +63,7 @@ void FontMgr::ReloadAll()
for (auto &data : m_vecFonts) for (auto &data : m_vecFonts)
{ {
size_t fontSize = static_cast<int>(screen::GetScreenHeight() / 54.85f) * data.m_fMul; size_t fontSize = static_cast<int>(screen::GetScreenHeight() / 54.85f) * data.m_fMul;
std::string fullPath = PLUGIN_PATH((char*)FILE_NAME "/fonts/") + data.m_path + ".ttf"; data.m_pFont = io.Fonts->AddFontFromFileTTF(data.m_path.c_str(), data.m_nSize, NULL, GetGlyphRanges());
data.m_pFont = io.Fonts->AddFontFromFileTTF(fullPath.c_str(), data.m_nSize, NULL, GetGlyphRanges());
} }
io.FontDefault = Get("text"); io.FontDefault = Get("text");
io.Fonts->Build(); io.Fonts->Build();

View File

@ -12,6 +12,7 @@ private:
ImFont *m_pFont; ImFont *m_pFont;
size_t m_nSize; size_t m_nSize;
float m_fMul; float m_fMul;
std::string m_ID;
std::string m_path; std::string m_path;
}; };
static inline std::vector<FontInfo> m_vecFonts; static inline std::vector<FontInfo> m_vecFonts;
@ -21,10 +22,10 @@ public:
FontMgr(FontMgr&) = delete; FontMgr(FontMgr&) = delete;
// Returns font pointer from name // Returns font pointer from name
static ImFont* Get(const char* fontName); static ImFont* Get(const char* fontID);
// Loads a font into memory // Loads a font into memory
static ImFont* Load(const char* fontName, float fontMul = 1.0f); static ImFont* Load(const char* fontID, const char* path = 0, float fontMul = 1.0f);
// Get the glyph ranges for our needed fonts // Get the glyph ranges for our needed fonts
static const ImWchar* GetGlyphRanges(); static const ImWchar* GetGlyphRanges();

View File

@ -39,6 +39,6 @@ xcopy /s %folderpath% "pack\%~1\" /K /D /H /Y
xcopy /s "..\resource\common\" "pack\%~1\" /K /D /H /Y xcopy /s "..\resource\common\" "pack\%~1\" /K /D /H /Y
@REM Guessing we have 7zip installed already, well I have @REM Guessing we have 7zip installed already, well I have
"C:\Program Files\7-Zip\7z.exe" a -t7z %archivePath% ".\pack\*" "C:\Program Files\7-Zip\7z.exe" a -t7z %archivePath% ".\pack\*" -mx=9 -v7M
@REM ------------------------------------------------------ @REM ------------------------------------------------------