1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00

Merged pull request #1968

This commit is contained in:
Marc Zinnschlag 2018-10-13 11:14:58 +02:00
commit 26f867d7c5
2 changed files with 8 additions and 5 deletions

View File

@ -506,7 +506,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
while (!stream.eof () && !ucsLineBreak (stream.peek ()) && ucsBreakingSpace (stream.peek ())) while (!stream.eof () && !ucsLineBreak (stream.peek ()) && ucsBreakingSpace (stream.peek ()))
{ {
MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek()); MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek());
if (info.codePoint >= 0) if (info.charFound)
space_width += static_cast<int>(info.advance + info.bearingX); space_width += static_cast<int>(info.advance + info.bearingX);
stream.consume (); stream.consume ();
} }
@ -516,7 +516,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
while (!stream.eof () && !ucsLineBreak (stream.peek ()) && !ucsBreakingSpace (stream.peek ())) while (!stream.eof () && !ucsLineBreak (stream.peek ()) && !ucsBreakingSpace (stream.peek ()))
{ {
MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek()); MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek());
if (info.codePoint >= 0) if (info.charFound)
word_width += static_cast<int>(info.advance + info.bearingX); word_width += static_cast<int>(info.advance + info.bearingX);
stream.consume (); stream.consume ();
} }
@ -765,7 +765,7 @@ namespace
{ {
MWGui::GlyphInfo info = GlyphInfo(mFont, ch); MWGui::GlyphInfo info = GlyphInfo(mFont, ch);
if (info.codePoint < 0) if (!info.charFound)
return; return;
MyGUI::FloatRect vr; MyGUI::FloatRect vr;
@ -787,7 +787,7 @@ namespace
{ {
MWGui::GlyphInfo info = GlyphInfo(mFont, ch); MWGui::GlyphInfo info = GlyphInfo(mFont, ch);
if (info.codePoint >= 0) if (info.charFound)
mCursor.left += static_cast<int>(info.bearingX + info.advance); mCursor.left += static_cast<int>(info.bearingX + info.advance);
} }

View File

@ -43,6 +43,7 @@ namespace MWGui
float advance; float advance;
float bearingX; float bearingX;
float bearingY; float bearingY;
bool charFound;
MyGUI::FloatRect uvRect; MyGUI::FloatRect uvRect;
GlyphInfo(MyGUI::IFont* font, MyGUI::Char ch) GlyphInfo(MyGUI::IFont* font, MyGUI::Char ch)
@ -61,15 +62,17 @@ namespace MWGui
height = (int) gi->height / scale; height = (int) gi->height / scale;
advance = (int) gi->advance / scale; advance = (int) gi->advance / scale;
uvRect = gi->uvRect; uvRect = gi->uvRect;
charFound = true;
} }
else else
{ {
codePoint = -1; codePoint = 0;
bearingX = 0; bearingX = 0;
bearingY = 0; bearingY = 0;
width = 0; width = 0;
height = 0; height = 0;
advance = 0; advance = 0;
charFound = false;
} }
} }
}; };