Commit 6ea0fabd authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Исправлен баг в парсере Indices, переделано чтение символов через новый парсер.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63461 954022d7-b5bf-4e40-9824-e11837661b57
parent 060eea09
......@@ -286,6 +286,9 @@ namespace XPS
}
else if (L"UnicodeString" == wsAttrName)
{
// TODO:
// 1. {}
// 2. unsigned short*, wchar_t*
wsUnicodeString.create(oReader.GetText(), true);
pUnicodesPtr = NSStringExt::CConverter::GetUtf32FromUnicode(wsUnicodeString.c_str(), unTextLen);
......@@ -371,14 +374,50 @@ namespace XPS
TIndicesEntry oEntry;
int nIndicesPos = 0, nIndicesLen = wsIndices.size();
int nUtf16Pos = 0, nUtf16Len = wsUnicodeString.size();
bool bRtoL = (nBidiLevel % 2 ? true : false);
m_pFontManager->LoadFontFromFile(wsFontPath, 0, (float)(dFontSize * 0.75), 96, 96);
while (GetNextGlyph(wsIndices.c_str(), nIndicesPos, nIndicesLen, (unsigned short*)wsUnicodeString.c_str(), nUtf16Pos, nUtf16Len, oEntry))
{
int k = 10;
k++;
double dAdvance;
if (oEntry.bAdvance)
dAdvance = oEntry.dAdvance * dFontSize / 100;
else
{
if (oEntry.bGid)
{
std::wstring wsChar;
wsChar += wchar_t(oEntry.nGid);
m_pFontManager->SetStringGID(TRUE);
m_pFontManager->LoadString1(wsChar, 0, 0);
}
else
{
std::wstring wsChar = NSStringExt::CConverter::GetUnicodeFromUTF32((const unsigned int*)(&(oEntry.nUnicode)), 1);
m_pFontManager->SetStringGID(FALSE);
m_pFontManager->LoadString1(wsChar, 0, 0);
}
TBBox oBox = m_pFontManager->MeasureString2();
dAdvance = (oBox.fMaxX - oBox.fMinX);
}
if (bRtoL)
dX -= dAdvance;
std::wstring wsChar = NSStringExt::CConverter::GetUnicodeFromUTF32((const unsigned int*)(&(oEntry.nUnicode)), 1);
unsigned int unGid = oEntry.nGid;
std::wstring wsGid = oEntry.bGid ? NSStringExt::CConverter::GetUnicodeFromUTF32((const unsigned int*)(&(unGid)), 1) : L"";
if (oEntry.bHorOffset || oEntry.bVerOffset)
pRenderer->CommandDrawTextEx(wsChar, wsGid, xpsUnitToMM(dX + oEntry.dHorOffset), xpsUnitToMM(dY + oEntry.dVerOffset), 0, 0, 0, 0);
else
pRenderer->CommandDrawTextEx(wsChar, wsGid, xpsUnitToMM(dX), xpsUnitToMM(dY), 0, 0, 0, 0);
if (!bRtoL)
dX += dAdvance;
}
std::vector<std::vector<std::wstring>> arrElements = Split(wsIndicies, L';', L',');
bool bRtoL = (nBidiLevel % 2 ? true : false);
/*std::vector<std::vector<std::wstring>> arrElements = Split(wsIndicies, L';', L',');
m_pFontManager->LoadFontFromFile(wsFontPath, 0, (float)(dFontSize * 0.75), 96, 96);
if (pUnicodesPtr)
{
......@@ -422,7 +461,7 @@ namespace XPS
}
delete[] pUnicodesPtr;
}
}*/
if (bClip)
pState->PopClip();
......
......@@ -979,7 +979,7 @@ namespace XPS
wchar_t wChar = LookChar(wsIndices, nIndicesPos);
int nCodeUnitCount = -1, nGlyphCount = -1;
int nCodeUnitCount = 1, nGlyphCount = 1;
if ('(' == wChar)
{
nIndicesPos++;
......@@ -1021,6 +1021,7 @@ namespace XPS
nIndicesPos++;
}
if (nCodeUnitCount > 0 && nGlyphCount > 0)
{
oEntry.vRemainUnicodes.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment