From 08ddd44b634d4da78edd0964f539a310544c7883 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 3 Nov 2021 18:52:30 +0800 Subject: ! UI9Slicing --- Runtime/GUI/Font.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Runtime/GUI/Font.cpp') diff --git a/Runtime/GUI/Font.cpp b/Runtime/GUI/Font.cpp index 8a5acea..1993126 100644 --- a/Runtime/GUI/Font.cpp +++ b/Runtime/GUI/Font.cpp @@ -16,7 +16,7 @@ using namespace character; static std::string s_FontError; static std::vector s_PixelBuffer; -static int s_SizePerPixel = sizeof(unsigned char); +static const int s_SizePerPixel = sizeof(unsigned char); Font::Font(std::string path, TextGeneratingSettings settings) : LuaBind::NativeClass() @@ -98,7 +98,7 @@ Font::Font(LuaBind::VM* vm, DataBuffer* db, TextGeneratingSettings settings) } } -character::Hash Font::GetHash(Codepoint codepoint, int pixelSize) +character::Hash Font::GetHash(Unicode codepoint, int pixelSize) { character::Hash hash; hash.codepoint = codepoint; @@ -106,7 +106,7 @@ character::Hash Font::GetHash(Codepoint codepoint, int pixelSize) return hash; } -const Character* Font::GetCharacter(character::Codepoint codepoint, int pixelSize) +const Character* Font::GetCharacter(character::Unicode codepoint, int pixelSize) { character::Hash hash = GetHash(codepoint, pixelSize); auto iter = m_Characters.find(hash); @@ -125,7 +125,7 @@ const Character* Font::GetCharacter(character::Codepoint codepoint, int pixelSiz return &iter->second; } -void Font::RenderCharacters(character::Codepoint* codepoint, int n, int pixelSize) +void Font::RenderCharacters(character::Unicode* codepoint, int n, int pixelSize) { for (int i = 0; i < n; ++i) { @@ -133,7 +133,7 @@ void Font::RenderCharacters(character::Codepoint* codepoint, int n, int pixelSiz } } -void Font::RenderCharacters(std::vector& codepoint, int pixelSize) +void Font::RenderCharacters(std::vector& codepoint, int pixelSize) { int n = codepoint.size(); for (int i = 0; i < n; ++i) @@ -142,7 +142,7 @@ void Font::RenderCharacters(std::vector& codepoint, int pi } } -bool Font::RenderCharacter(character::Codepoint codepoint, int pixelSize) +bool Font::RenderCharacter(character::Unicode codepoint, int pixelSize) { character::Hash hash = GetHash(codepoint, pixelSize); if (m_Characters.count(hash) != 0) @@ -318,7 +318,7 @@ bool Font::HasEnoughSpace(GlyphAtals* atlas, Internal::Vector2 preferSize) return false; } -Character GetCharacter(character::Codepoint Codepoint, int pixelSize) +Character GetCharacter(character::Unicode Unicode, int pixelSize) { return Character(); } -- cgit v1.1-26-g67d0