From a2c06e4a667a45a267f9382d0d90ab689c89d0cf Mon Sep 17 00:00:00 2001 From: weili Date: Fri, 20 May 2016 17:09:48 -0700 Subject: Use enum type for char type variables The mixed use of enum and uint32_t causes warnings. And it is more meaningful to use enum for char type variables. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/2001733002 --- core/fxcrt/fx_arabic.cpp | 2 +- core/fxcrt/include/fx_ucd.h | 7 +++- xfa/fgas/layout/fgas_rtfbreak.cpp | 42 +++++++++++---------- xfa/fgas/layout/fgas_rtfbreak.h | 4 +- xfa/fgas/layout/fgas_textbreak.cpp | 76 +++++++++++++++++++------------------- xfa/fgas/layout/fgas_textbreak.h | 4 +- 6 files changed, 71 insertions(+), 64 deletions(-) diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 01a1a2a15e..cf0056ede2 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -122,7 +122,7 @@ const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, wChar = 0xFEFF; return nullptr; } - eType = (FX_CHARTYPE)pTC->GetCharType(); + eType = pTC->GetCharType(); wChar = (FX_WCHAR)pTC->m_wCharCode; const FX_ARBFORMTABLE* pFT = FX_GetArabicFormTable(wChar); if (!pFT || eType >= FX_CHARTYPE_ArabicNormal) diff --git a/core/fxcrt/include/fx_ucd.h b/core/fxcrt/include/fx_ucd.h index 90f89486f1..0eb159d703 100644 --- a/core/fxcrt/include/fx_ucd.h +++ b/core/fxcrt/include/fx_ucd.h @@ -107,6 +107,9 @@ enum FX_CHARTYPE { FX_CHARTYPE_ArabicForm = (11 << FX_CHARTYPEBITS), FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), }; +inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { + return static_cast(prop & FX_CHARTYPEBITSMASK); +} FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, @@ -133,7 +136,9 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - uint32_t GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } + + FX_CHARTYPE GetCharType() const { return GetCharTypeFromProp(m_dwCharProps); } + uint16_t m_wCharCode; uint8_t m_nBreakType; int8_t m_nRotation; diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index aaef7aec61..c6a43d3b56 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -42,7 +42,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) m_bRTL(FALSE), m_iAlignment(FX_RTFLINEALIGNMENT_Left), m_pUserData(NULL), - m_dwCharType(0), + m_eCharType(FX_CHARTYPE_Unknown), m_dwIdentity(0), m_RTFLine1(), m_RTFLine2(), @@ -306,8 +306,9 @@ CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces(FX_BOOL bReady) const { } return &pRTFLine->m_LinePieces; } -inline uint32_t CFX_RTFBreak::GetUnifiedCharType(uint32_t dwType) const { - return dwType >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : dwType; +inline FX_CHARTYPE CFX_RTFBreak::GetUnifiedCharType( + FX_CHARTYPE chartype) const { + return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype; } int32_t CFX_RTFBreak::GetLastPositionedTab() const { int32_t iCount = m_PositionedTabs.GetSize(); @@ -345,7 +346,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) { return AppendChar_CharCode(wch); } uint32_t dwProps = kTextLayoutCodeProperties[(uint16_t)wch]; - uint32_t dwType = (dwProps & FX_CHARTYPEBITSMASK); + FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); CFX_RTFCharArray& tca = m_pCurLine->m_LineChars; CFX_RTFChar* pCurChar = tca.AddSpace(); pCurChar->m_dwStatus = 0; @@ -365,11 +366,12 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) { } pCurChar->m_pUserData = m_pUserData; uint32_t dwRet1 = FX_RTFBREAK_None; - if (dwType != FX_CHARTYPE_Combination && - GetUnifiedCharType(m_dwCharType) != GetUnifiedCharType(dwType)) { - if (!m_bSingleLine && !m_bOrphanLine && m_dwCharType > 0 && + if (chartype != FX_CHARTYPE_Combination && + GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype)) { + if (!m_bSingleLine && !m_bOrphanLine && + m_eCharType != FX_CHARTYPE_Unknown && m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) { - if (m_dwCharType != FX_CHARTYPE_Space || dwType != FX_CHARTYPE_Control) { + if (m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control) { dwRet1 = EndBreak(FX_RTFBREAK_LineBreak); int32_t iCount = m_pCurLine->CountChars(); if (iCount > 0) { @@ -383,9 +385,9 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) { iRotation = (iRotation + 1) % 4; } uint32_t dwRet2 = - (this->*g_FX_RTFBreak_lpfAppendChar[dwType >> FX_CHARTYPEBITS])( + (this->*g_FX_RTFBreak_lpfAppendChar[chartype >> FX_CHARTYPEBITS])( pCurChar, iRotation); - m_dwCharType = dwType; + m_eCharType = chartype; return std::max(dwRet1, dwRet2); } uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) { @@ -423,7 +425,7 @@ uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) { iCharWidth += m_iCharSpace; pCurChar->m_iCharWidth = iCharWidth; m_pCurLine->m_iWidth += iCharWidth; - m_dwCharType = 0; + m_eCharType = FX_CHARTYPE_Unknown; if (!m_bSingleLine && m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) { return EndBreak(FX_RTFBREAK_LineBreak); @@ -447,7 +449,7 @@ uint32_t CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar, if (pLastChar != NULL && pLastChar->GetCharType() > FX_CHARTYPE_Combination) { iCharWidth = -iCharWidth; } else { - m_dwCharType = FX_CHARTYPE_Combination; + m_eCharType = FX_CHARTYPE_Combination; } pCurChar->m_iCharWidth = iCharWidth; if (iCharWidth > 0) { @@ -511,8 +513,8 @@ uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar, int32_t iCharWidth = 0; FX_WCHAR wForm; FX_BOOL bAlef = FALSE; - if (m_dwCharType >= FX_CHARTYPE_ArabicAlef && - m_dwCharType <= FX_CHARTYPE_ArabicDistortion) { + if (m_eCharType >= FX_CHARTYPE_ArabicAlef && + m_eCharType <= FX_CHARTYPE_ArabicDistortion) { pLastChar = GetLastChar(1); if (pLastChar != NULL) { iLineWidth -= pLastChar->m_iCharWidth; @@ -564,9 +566,9 @@ uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar, } uint32_t CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar, int32_t iRotation) { - uint32_t dwType = (pCurChar->m_dwCharProps & FX_CHARTYPEBITSMASK); + FX_CHARTYPE chartype = pCurChar->GetCharType(); FX_WCHAR wForm; - if (dwType == FX_CHARTYPE_Numeric) { + if (chartype == FX_CHARTYPE_Numeric) { if (m_dwLayoutStyles & FX_RTFLAYOUTSTYLE_ArabicNumber) { wForm = pCurChar->m_wCharCode + 0x0630; } else { @@ -589,12 +591,12 @@ uint32_t CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar, iCharWidth *= m_iFontSize; iCharWidth = iCharWidth * m_iHorizontalScale / 100; iCharWidth += m_iCharSpace; - if (dwType == FX_CHARTYPE_Space && m_bWordSpace) { + if (chartype == FX_CHARTYPE_Space && m_bWordSpace) { iCharWidth += m_iWordSpace; } pCurChar->m_iCharWidth = iCharWidth; m_pCurLine->m_iWidth += iCharWidth; - FX_BOOL bBreak = (dwType != FX_CHARTYPE_Space || + FX_BOOL bBreak = (chartype != FX_CHARTYPE_Space || (m_dwPolicies & FX_RTFBREAKPOLICY_SpaceBreak) != 0); if (!m_bSingleLine && !m_bOrphanLine && bBreak && m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) { @@ -660,7 +662,7 @@ EndBreak_Ret: m_pCurLine = pNextLine; m_pCurLine->m_iStart = m_iBoundaryStart; CFX_RTFChar* pTC = GetLastChar(0); - m_dwCharType = pTC == NULL ? 0 : pTC->GetCharType(); + m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown; return dwStatus; } FX_BOOL CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, @@ -1166,7 +1168,7 @@ void CFX_RTFBreak::ClearBreakPieces() { m_iReady = 0; } void CFX_RTFBreak::Reset() { - m_dwCharType = 0; + m_eCharType = FX_CHARTYPE_Unknown; m_RTFLine1.RemoveAll(TRUE); m_RTFLine2.RemoveAll(TRUE); } diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index d595ad38d1..966950f26c 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -319,7 +319,7 @@ class CFX_RTFBreak { FX_BOOL m_bRTL; int32_t m_iAlignment; IFX_Unknown* m_pUserData; - uint32_t m_dwCharType; + FX_CHARTYPE m_eCharType; uint32_t m_dwIdentity; CFX_RTFLine m_RTFLine1; CFX_RTFLine m_RTFLine2; @@ -331,7 +331,7 @@ class CFX_RTFBreak { CFX_RTFChar* GetLastChar(int32_t index) const; CFX_RTFLine* GetRTFLine(FX_BOOL bReady) const; CFX_RTFPieceArray* GetRTFPieces(FX_BOOL bReady) const; - uint32_t GetUnifiedCharType(uint32_t dwType) const; + FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; int32_t GetLastPositionedTab() const; FX_BOOL GetPositionedTab(int32_t& iTabPos) const; int32_t GetBreakPos(CFX_RTFCharArray& tca, diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index 6f018b3c25..c5a1c2fdcc 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -40,7 +40,7 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) m_dwContextCharStyles(0), m_iCombWidth(360000), m_pUserData(NULL), - m_dwCharType(0), + m_eCharType(FX_CHARTYPE_Unknown), m_bArabicNumber(FALSE), m_bArabicComma(FALSE), m_pCurLine(NULL), @@ -281,8 +281,9 @@ CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const { } return pTxtLine->m_pLinePieces; } -inline uint32_t CFX_TxtBreak::GetUnifiedCharType(uint32_t dwType) const { - return dwType >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : dwType; +inline FX_CHARTYPE CFX_TxtBreak::GetUnifiedCharType( + FX_CHARTYPE chartype) const { + return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype; } void CFX_TxtBreak::ResetArabicContext() { if (m_bArabicContext) { @@ -390,7 +391,7 @@ uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar, return FX_TXTBREAK_None; } uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation) { - m_dwCharType = FX_CHARTYPE_Tab; + m_eCharType = FX_CHARTYPE_Tab; if ((m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ExpandTab) == 0) { return FX_TXTBREAK_None; } @@ -418,7 +419,7 @@ uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation) { } uint32_t CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation) { - m_dwCharType = FX_CHARTYPE_Control; + m_eCharType = FX_CHARTYPE_Control; uint32_t dwRet = FX_TXTBREAK_None; if (!m_bSingleLine) { FX_WCHAR wch = pCurChar->m_wCharCode; @@ -447,14 +448,14 @@ uint32_t CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar, } uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation) { - uint32_t dwType = (pCurChar->m_dwCharProps & FX_CHARTYPEBITSMASK); + FX_CHARTYPE chartype = pCurChar->GetCharType(); int32_t& iLineWidth = m_pCurLine->m_iWidth; FX_WCHAR wForm; int32_t iCharWidth = 0; CFX_Char* pLastChar = NULL; FX_BOOL bAlef = FALSE; - if (!m_bCombText && m_dwCharType >= FX_CHARTYPE_ArabicAlef && - m_dwCharType <= FX_CHARTYPE_ArabicDistortion) { + if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef && + m_eCharType <= FX_CHARTYPE_ArabicDistortion) { pLastChar = GetLastChar(1); if (pLastChar != NULL) { iCharWidth = pLastChar->m_iCharWidth; @@ -484,7 +485,7 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar, iCharWidth = 0; } } - m_dwCharType = dwType; + m_eCharType = chartype; wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? NULL : pLastChar, NULL); if (m_bCombText) { iCharWidth = m_iCombWidth; @@ -511,13 +512,13 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar, uint32_t CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation) { uint32_t dwProps = pCurChar->m_dwCharProps; - uint32_t dwType = (dwProps & FX_CHARTYPEBITSMASK); + FX_CHARTYPE chartype = pCurChar->GetCharType(); int32_t& iLineWidth = m_pCurLine->m_iWidth; int32_t iCharWidth = 0; - m_dwCharType = dwType; + m_eCharType = chartype; FX_WCHAR wch = pCurChar->m_wCharCode; FX_WCHAR wForm = wch; - if (dwType == FX_CHARTYPE_Numeric) { + if (chartype == FX_CHARTYPE_Numeric) { if (m_bArabicNumber) { wForm = wch + 0x0630; pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicIndic; @@ -544,7 +545,7 @@ uint32_t CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar, iCharWidth += m_iCharSpace; pCurChar->m_iCharWidth = iCharWidth; iLineWidth += iCharWidth; - FX_BOOL bBreak = (dwType != FX_CHARTYPE_Space || + FX_BOOL bBreak = (chartype != FX_CHARTYPE_Space || (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0); if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance) { return EndBreak(FX_TXTBREAK_LineBreak); @@ -565,7 +566,7 @@ static const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = { }; uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) { uint32_t dwProps = kTextLayoutCodeProperties[(uint16_t)wch]; - uint32_t dwType = (dwProps & FX_CHARTYPEBITSMASK); + FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); CFX_TxtChar* pCurChar = m_pCurLine->m_pLineChars->AddSpace(); pCurChar->m_wCharCode = (uint16_t)wch; pCurChar->m_nRotation = m_iCharRotation; @@ -582,11 +583,11 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) { pCurChar->m_pUserData = NULL; AppendChar_PageLoad(pCurChar, dwProps); uint32_t dwRet1 = FX_TXTBREAK_None; - if (dwType != FX_CHARTYPE_Combination && - GetUnifiedCharType(m_dwCharType) != GetUnifiedCharType(dwType)) { - if (m_dwCharType > 0 && + if (chartype != FX_CHARTYPE_Combination && + GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype)) { + if (m_eCharType != FX_CHARTYPE_Unknown && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance && !m_bSingleLine) { - if (m_dwCharType != FX_CHARTYPE_Space || dwType != FX_CHARTYPE_Control) { + if (m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control) { dwRet1 = EndBreak(FX_TXTBREAK_LineBreak); int32_t iCount = m_pCurLine->CountChars(); if (iCount > 0) { @@ -600,7 +601,7 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) { iRotation = (iRotation + 1) % 4; } uint32_t dwRet2 = - (this->*g_FX_TxtBreak_lpfAppendChar[dwType >> FX_CHARTYPEBITS])( + (this->*g_FX_TxtBreak_lpfAppendChar[chartype >> FX_CHARTYPEBITS])( pCurChar, iRotation); return std::max(dwRet1, dwRet2); } @@ -696,7 +697,7 @@ FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, tp.m_iVerticalScale = pTC->m_iVertialScale; pCurPieces->Add(tp); m_pCurLine = pNextLine; - m_dwCharType = 0; + m_eCharType = FX_CHARTYPE_Unknown; return TRUE; } if (bAllChars && !bDone) { @@ -822,7 +823,7 @@ void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, FX_BOOL bFind = FALSE; FX_TPO tpo; CFX_TxtChar* pTC; - uint32_t dwCharType; + FX_CHARTYPE chartype; for (i = iCount - 1; i > -1; i--) { tpo = tpos.GetAt(i); CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index); @@ -837,9 +838,8 @@ void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, iGapChars++; } if (!bFind || !bAllChars) { - dwCharType = pTC->GetCharType(); - if (dwCharType == FX_CHARTYPE_Space || - dwCharType == FX_CHARTYPE_Control) { + chartype = pTC->GetCharType(); + if (chartype == FX_CHARTYPE_Space || chartype == FX_CHARTYPE_Control) { if (!bFind) { iCharWidth = pTC->m_iCharWidth; if (bAllChars && iCharWidth > 0) { @@ -963,7 +963,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) { EndBreak_Ret: m_pCurLine = pNextLine; pTC = GetLastChar(0, FALSE); - m_dwCharType = pTC == NULL ? 0 : pTC->GetCharType(); + m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown; if (dwStatus == FX_TXTBREAK_ParagraphBreak) { m_iArabicContext = m_iCurArabicContext = 1; ResetArabicContext(); @@ -1148,7 +1148,7 @@ void CFX_TxtBreak::ClearBreakPieces() { m_iReady = 0; } void CFX_TxtBreak::Reset() { - m_dwCharType = 0; + m_eCharType = FX_CHARTYPE_Unknown; m_iArabicContext = m_iCurArabicContext = 1; ResetArabicContext(); m_pTxtLine1->RemoveAll(TRUE); @@ -1231,13 +1231,13 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, iWidth = *pWidths++; } uint32_t dwProps = FX_GetUnicodeProperties(wch); - uint32_t dwCharType = (dwProps & FX_CHARTYPEBITSMASK); - if (dwCharType == FX_CHARTYPE_ArabicAlef && iWidth == 0) { + FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); + if (chartype == FX_CHARTYPE_ArabicAlef && iWidth == 0) { wPrev = 0xFEFF; wLast = wch; continue; } - if (dwCharType >= FX_CHARTYPE_ArabicAlef) { + if (chartype >= FX_CHARTYPE_ArabicAlef) { if (i < iLength) { if (pAccess != NULL) { iNext = i + 1; @@ -1271,7 +1271,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } wForm = pdfium::arabic::GetFormChar(wch, wPrev, wNext); bLam = (wPrev == 0x0644 && wch == 0x0644 && wNext == 0x0647); - } else if (dwCharType == FX_CHARTYPE_Combination) { + } else if (chartype == FX_CHARTYPE_Combination) { wForm = wch; if (wch >= 0x064C && wch <= 0x0651) { if (bShadda) { @@ -1304,7 +1304,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } else { bShadda = FALSE; } - } else if (dwCharType == FX_CHARTYPE_Numeric) { + } else if (chartype == FX_CHARTYPE_Numeric) { wForm = wch; if (bArabicNumber) { wForm += 0x0630; @@ -1337,10 +1337,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } else { wForm = wch; } - if (dwCharType != FX_CHARTYPE_Combination) { + if (chartype != FX_CHARTYPE_Combination) { bShadda = FALSE; } - if (dwCharType < FX_CHARTYPE_ArabicAlef) { + if (chartype < FX_CHARTYPE_ArabicAlef) { bLam = FALSE; } dwProps = FX_GetUnicodeProperties(wForm); @@ -1350,7 +1350,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } iCharRotation %= 4; FX_BOOL bEmptyChar = - (dwCharType >= FX_CHARTYPE_Tab && dwCharType <= FX_CHARTYPE_Control); + (chartype >= FX_CHARTYPE_Tab && chartype <= FX_CHARTYPE_Control); if (wForm == 0xFEFF) { bEmptyChar = TRUE; } @@ -1385,7 +1385,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, wForm = (FX_WCHAR)formChars[j].wForm; iCharWidth = formChars[j].iWidth; if (j > 0) { - dwCharType = FX_CHARTYPE_Combination; + chartype = FX_CHARTYPE_Combination; wch = wForm; wLast = (FX_WCHAR)formChars[j - 1].wForm; } @@ -1407,7 +1407,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } fCharWidth = fFontSize * iCharWidth / 1000.0f; fCharHeight = fFontSize * iCharHeight / 1000.0f; - if (bRTLPiece && dwCharType != FX_CHARTYPE_Combination) { + if (bRTLPiece && chartype != FX_CHARTYPE_Combination) { if (bVerticalDoc) { fY -= fCharHeight; } else { @@ -1427,7 +1427,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, pCharPos->m_OriginX += fOffset; } } - if (dwCharType == FX_CHARTYPE_Combination) { + if (chartype == FX_CHARTYPE_Combination) { CFX_Rect rtBBox; rtBBox.Reset(); if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) { @@ -1464,7 +1464,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, pCharPos->m_OriginX += ptOffset.x; pCharPos->m_OriginY -= ptOffset.y; } - if (!bRTLPiece && dwCharType != FX_CHARTYPE_Combination) { + if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) { if (bVerticalDoc) { fY += fCharHeight; } else { diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index b076f40289..3c6810d774 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -271,7 +271,7 @@ class CFX_TxtBreak { CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const; CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const; CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const; - uint32_t GetUnifiedCharType(uint32_t dwType) const; + FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const; void ResetArabicContext(); void ResetContextCharStyles(); void EndBreak_UpdateArabicShapes(); @@ -316,7 +316,7 @@ class CFX_TxtBreak { uint32_t m_dwContextCharStyles; int32_t m_iCombWidth; void* m_pUserData; - uint32_t m_dwCharType; + FX_CHARTYPE m_eCharType; FX_BOOL m_bCurRTL; int32_t m_iCurAlignment; FX_BOOL m_bArabicNumber; -- cgit v1.2.3