Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
FontGlyph::page_: make signed
Browse files Browse the repository at this point in the history
  • Loading branch information
1vanK committed Jun 2, 2022
1 parent dbe5261 commit 7a82c2f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Source/Urho3D/AngelScript/Generated_Members.h
Original file line number Diff line number Diff line change
Expand Up @@ -1561,8 +1561,8 @@ template <class T> void RegisterMembers_FontGlyph(asIScriptEngine* engine, const
// float FontGlyph::advanceX_
engine->RegisterObjectProperty(className, "float advanceX", offsetof(T, advanceX_));

// unsigned FontGlyph::page_
engine->RegisterObjectProperty(className, "uint page", offsetof(T, page_));
// i32 FontGlyph::page_
engine->RegisterObjectProperty(className, "int page", offsetof(T, page_));

// bool FontGlyph::used_
engine->RegisterObjectProperty(className, "bool used", offsetof(T, used_));
Expand Down
4 changes: 2 additions & 2 deletions Source/Urho3D/UI/FontFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ struct URHO3D_API FontGlyph
float offsetY_{};
/// Horizontal advance.
float advanceX_{};
/// Texture page. M_MAX_UNSIGNED if not yet resident on any texture.
unsigned page_{M_MAX_UNSIGNED};
/// Texture page. NINDEX if not yet resident on any texture.
i32 page_{NINDEX};
/// Used flag.
bool used_{};
};
Expand Down
5 changes: 3 additions & 2 deletions Source/Urho3D/UI/FontFaceBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ bool FontFaceBitmap::Load(const unsigned char* fontData, unsigned fontDataSize,
glyph.offsetX_ = (short)charElem.GetInt("xoffset");
glyph.offsetY_ = (short)charElem.GetInt("yoffset");
glyph.advanceX_ = (short)charElem.GetInt("xadvance");
glyph.page_ = charElem.GetUInt("page");
glyph.page_ = charElem.GetInt("page");
assert(glyph.page_ >= 0);

glyphMapping_[id] = glyph;

Expand Down Expand Up @@ -304,7 +305,7 @@ bool FontFaceBitmap::Save(Serializer& dest, int pointSize, const String& indenta
charElem.SetInt("xoffset", glyph.offsetX_);
charElem.SetInt("yoffset", glyph.offsetY_);
charElem.SetInt("xadvance", glyph.advanceX_);
charElem.SetUInt("page", glyph.page_);
charElem.SetInt("page", glyph.page_);
}

if (!kerningMapping_.Empty())
Expand Down
2 changes: 1 addition & 1 deletion Source/Urho3D/UI/Text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void Text::UpdateCharLocations()
if (glyph)
{
// Store glyph's location for rendering. Verify that glyph page is valid
if (glyph->page_ < pageGlyphLocations_.Size())
if (glyph->page_ != NINDEX && glyph->page_ < pageGlyphLocations_.Size())
pageGlyphLocations_[glyph->page_].Push(GlyphLocation(x, y, glyph));
x += glyph->advanceX_;
if (i < printText_.Size() - 1)
Expand Down

0 comments on commit 7a82c2f

Please sign in to comment.