void CPDF_TextPage::AddCharInfoByRLDirection(wchar_t wChar, const PAGECHAR_INFO& info) { PAGECHAR_INFO info2 = info; if (IsControlChar(info2)) { info2.m_Index = -1; m_CharList.push_back(info2); return; } info2.m_Index = m_TextBuf.GetLength(); wChar = FX_GetMirrorChar(wChar); size_t nCount = Unicode_GetNormalization(wChar, nullptr); if (nCount == 0) { info2.m_Unicode = wChar; m_TextBuf.AppendChar(info2.m_Unicode); m_CharList.push_back(info2); return; } std::unique_ptr<wchar_t, FxFreeDeleter> pDst(FX_Alloc(wchar_t, nCount)); Unicode_GetNormalization(wChar, pDst.get()); for (size_t nIndex = 0; nIndex < nCount; ++nIndex) { info2.m_Unicode = pDst.get()[nIndex]; info2.m_Flag = FPDFTEXT_CHAR_PIECE; m_TextBuf.AppendChar(info2.m_Unicode); m_CharList.push_back(info2); } }
void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest) { wChar = FX_GetMirrorChar(wChar, TRUE, FALSE); FX_LPWSTR pDst = NULL; FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); if (nCount < 1 ) { sDest += wChar; return; } pDst = new FX_WCHAR[nCount]; FX_Unicode_GetNormalization(wChar, pDst); for (int nIndex = 0; nIndex < nCount; nIndex++) { sDest += pDst[nIndex]; } delete[] pDst; }