void CFDE_TextOut::ReplaceWidthEllipsis() { LoadEllipsis(); int32_t iLength = m_wsEllipsis.GetLength(); if (iLength < 1) { return; } int32_t iLines = m_ttoLines.GetSize(); for (int32_t i = 0; i < iLines; i++) { CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); if (!pLine->m_bNewReload) { continue; } int32_t iEllipsisCharIndex = iLength - 1; int32_t iCharWidth = 0; int32_t iCharCount = 0; int32_t iPiece = pLine->GetSize(); while (iPiece-- > 0) { FDE_TTOPIECE* pPiece = pLine->GetPtrAt(iPiece); if (!pPiece) break; for (int32_t j = pPiece->iChars - 1; j >= 0; j--) { if (iEllipsisCharIndex < 0) { break; } int32_t index = pPiece->iStartChar + j; iCharWidth += m_CharWidths[index]; iCharCount++; if (iCharCount <= iLength) { m_wsText.SetAt(index, m_wsEllipsis.GetAt(iEllipsisCharIndex)); m_CharWidths[index] = m_EllCharWidths[iEllipsisCharIndex]; } else if (iCharWidth <= m_iEllipsisWidth) { m_wsText.SetAt(index, 0); m_CharWidths[index] = 0; } iEllipsisCharIndex--; } if (iEllipsisCharIndex < 0) { break; } } } }
void CFDE_TextOut::ReplaceWidthEllipsis() { LoadEllipsis(); int32_t iLength = m_wsEllipsis.GetLength(); if (iLength < 1) return; for (auto& line : m_ttoLines) { if (!line.GetNewReload()) continue; int32_t iEllipsisCharIndex = iLength - 1; int32_t iCharWidth = 0; int32_t iCharCount = 0; int32_t iPiece = line.GetSize(); while (iPiece-- > 0) { FDE_TTOPIECE* pPiece = line.GetPtrAt(iPiece); if (!pPiece) break; for (int32_t j = pPiece->iChars - 1; j >= 0; j--) { if (iEllipsisCharIndex < 0) break; int32_t index = pPiece->iStartChar + j; iCharWidth += m_CharWidths[index]; iCharCount++; if (iCharCount <= iLength) { m_wsText.SetAt(index, m_wsEllipsis.GetAt(iEllipsisCharIndex)); m_CharWidths[index] = m_EllCharWidths[iEllipsisCharIndex]; } else if (iCharWidth <= m_iEllipsisWidth) { m_wsText.SetAt(index, 0); m_CharWidths[index] = 0; } iEllipsisCharIndex--; } if (iEllipsisCharIndex < 0) break; } } }