Skip to content

Commit

Permalink
optimisation, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
val-andrushko committed Apr 2, 2018
1 parent dce8203 commit 05907d1
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions OrionUO/Managers/FontsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,33 +999,38 @@ WISP_GEOMETRY::CPoint2Di CFontsManager::GetCaretPosW(const uchar &font, const ws

puint table = (puint)m_UnicodeFontAddress[font];

//loop throgh lines to get width and height
while (info != NULL)
{
p.X = 0;
int len = info->CharCount;
if (info->CharStart == pos)
return p;

IFOR(i, 0, len)
//if pos is not in this line, just skip this
if (pos <= info->CharStart + len)
{
//collect data about width of each character
const wchar_t &ch = info->Data[i].item;
uint offset = table[ch];

if (offset && offset != 0xFFFFFFFF)
IFOR(i, 0, len)
{
puchar cptr = (puchar)((size_t)table + offset);
p.X += ((char)cptr[0] + (char)cptr[2] + 1);
}
else if (ch == L' ')
p.X += UNICODE_SPACE_WIDTH;
//collect data about width of each character
const wchar_t &ch = info->Data[i].item;
uint offset = table[ch];

if (offset && offset != 0xFFFFFFFF)
{
puchar cptr = (puchar)((size_t)table + offset);
p.X += ((char)cptr[0] + (char)cptr[2] + 1);
}
else if (ch == L' ')
p.X += UNICODE_SPACE_WIDTH;

if (info->CharStart + i + 1 == pos)
return p;
if (info->CharStart + i + 1 == pos)
return p;

}
}
//add height if there's another line

//add to height if there's another line
if (info->m_Next != NULL)
p.Y += info->MaxHeight;

Expand Down

0 comments on commit 05907d1

Please sign in to comment.