Skip to content

Commit 09ceeb5

Browse files
authored
Merge pull request #32 from wuwao1/master
fix CRenderEngine::DrawHtmlText
2 parents 43c89bd + 758649c commit 09ceeb5

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

DuiLib/Core/UIRender.cpp

+22-22
Original file line numberDiff line numberDiff line change
@@ -1768,11 +1768,11 @@ namespace DuiLib {
17681768
faw::string_t *pStr = (faw::string_t*) (sLinks + iLinkIndex);
17691769
pStr->clear ();
17701770
while (!pstrText.empty () && pstrText[0] != _T ('>') && pstrText[0] != _T ('}')) {
1771-
faw::string_t pstrTemp = pstrText.substr (1);
1772-
while (pstrText < pstrTemp) {
1771+
//faw::string_t pstrTemp = pstrText.substr (1);
1772+
//while (pstrText < pstrTemp) {
17731773
*pStr += pstrText[0];
17741774
pstrText = pstrText.substr (1);
1775-
}
1775+
//}
17761776
}
17771777
}
17781778

@@ -1845,21 +1845,21 @@ namespace DuiLib {
18451845
bool bUnderline = false;
18461846
bool bItalic = false;
18471847
while (!pstrText.empty () && pstrText[0] != _T ('>') && pstrText[0] != _T ('}') && pstrText[0] != _T (' ')) {
1848-
pstrTemp = pstrText.substr (1);
1849-
while (pstrText < pstrTemp) {
1848+
//pstrTemp = pstrText.substr (1);
1849+
//while (pstrText < pstrTemp) {
18501850
sFontName += pstrText[0];
18511851
pstrText = pstrText.substr (1);
1852-
}
1852+
//}
18531853
}
18541854
if (isdigit (pstrText[0])) {
18551855
iFontSize = FawTools::parse_dec (pstrText);
18561856
}
18571857
while (!pstrText.empty () && pstrText[0] != _T ('>') && pstrText[0] != _T ('}')) {
1858-
pstrTemp = pstrText.substr (1);
1859-
while (pstrText < pstrTemp) {
1858+
//pstrTemp = pstrText.substr (1);
1859+
//while (pstrText < pstrTemp) {
18601860
sFontAttr += pstrText[0];
18611861
pstrText = pstrText.substr (1);
1862-
}
1862+
//}
18631863
}
18641864
FawTools::lower (sFontAttr);
18651865
if (sFontAttr.find (_T ("bold")) != faw::string_t::npos) bBold = true;
@@ -1885,11 +1885,11 @@ namespace DuiLib {
18851885
const TImageInfo* pImageInfo = nullptr;
18861886
faw::string_t sName;
18871887
while (!pstrText.empty () && pstrText[0] != _T ('>') && pstrText[0] != _T ('}') && pstrText[0] != _T (' ')) {
1888-
faw::string_t pstrTemp = pstrText.substr (1);
1889-
while (pstrText < pstrTemp) {
1888+
//faw::string_t pstrTemp = pstrText.substr (1);
1889+
//while (pstrText < pstrTemp) {
18901890
sName += pstrText[0];
18911891
pstrText = pstrText.substr (1);
1892-
}
1892+
//}
18931893
}
18941894
if (sName.empty ()) { // Italic
18951895
pstrNextStart = _T ("");
@@ -1920,22 +1920,22 @@ namespace DuiLib {
19201920
sItem.clear ();
19211921
sValue.clear ();
19221922
while (pStrImage[0] != _T ('\0') && pStrImage[0] != _T ('=') && pStrImage[0] > _T (' ')) {
1923-
faw::string_t pstrTemp = pStrImage.substr (1);
1924-
while (pStrImage < pstrTemp) {
1923+
//faw::string_t pstrTemp = pStrImage.substr (1);
1924+
//while (pStrImage < pstrTemp) {
19251925
sItem += pStrImage[0];
19261926
pStrImage = pStrImage.substr (1);
1927-
}
1927+
//}
19281928
}
19291929
if (pStrImage[0] != _T ('=')) break;
19301930
pStrImage = pStrImage.substr (1);
19311931
if (pStrImage[0] != _T ('\'')) break;
19321932
pStrImage = pStrImage.substr (1);
19331933
while (pStrImage[0] != _T ('\0') && pStrImage[0] != _T ('\'')) {
1934-
faw::string_t pstrTemp = pStrImage.substr (1);
1935-
while (pStrImage < pstrTemp) {
1934+
//faw::string_t pstrTemp = pStrImage.substr (1);
1935+
//while (pStrImage < pstrTemp) {
19361936
sValue += pStrImage[0];
19371937
pStrImage = pStrImage.substr (1);
1938-
}
1938+
//}
19391939
}
19401940
if (pStrImage[0] != _T ('\'')) break;
19411941
pStrImage = pStrImage.substr (1);
@@ -2166,15 +2166,15 @@ namespace DuiLib {
21662166
}
21672167
pstrNext = p.substr (1);
21682168
cchChars++;
2169-
cchSize += (int) (pstrNext.data () - p.data ());
2169+
cchSize += (int) (p.size() - pstrNext.size());
21702170
szText.cx = cchChars * pTm->tmMaxCharWidth;
21712171
if (pt.x + szText.cx >= rc.right) {
21722172
::GetTextExtentPoint32 (hDC, pstrText.data (), cchSize, &szText);
21732173
}
21742174
if (pt.x + szText.cx > rc.right) {
21752175
if (pt.x + szText.cx > rc.right && pt.x != rc.left) {
21762176
cchChars--;
2177-
cchSize -= (int) (pstrNext.data () - p.data ());
2177+
cchSize -= (int) (p.size() - pstrNext.size());
21782178
}
21792179
if ((uStyle & DT_WORDBREAK) != 0 && cchLastGoodWord > 0) {
21802180
cchChars = cchLastGoodWord;
@@ -2186,9 +2186,9 @@ namespace DuiLib {
21862186
if (cchChars > 0) {
21872187
cchChars -= 1;
21882188
pstrPrev = &pstrPrev.data ()[-1];
2189-
cchSize -= (int) (p.data () - pstrPrev.data ());
2189+
cchSize -= (int) (p.size() - pstrNext.size());
21902190
} else
2191-
cchSize -= (int) (p.data () - pstrPrev.data ());
2191+
cchSize -= (int) (p.size() - pstrNext.size());
21922192
pt.x = rc.right;
21932193
}
21942194
bLineEnd = true;

0 commit comments

Comments
 (0)