summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/cfx_breakline.cpp2
-rw-r--r--xfa/fgas/layout/cfx_breakpiece.cpp2
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak.cpp34
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.cpp61
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.h1
5 files changed, 35 insertions, 65 deletions
diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp
index 562f984ffe..9eb0211119 100644
--- a/xfa/fgas/layout/cfx_breakline.cpp
+++ b/xfa/fgas/layout/cfx_breakline.cpp
@@ -39,7 +39,7 @@ void CFX_BreakLine::GetString(CFX_WideString& wsStr) const {
int32_t iCount = pdfium::CollectionSize<int32_t>(m_LineChars);
wchar_t* pBuf = wsStr.GetBuffer(iCount);
for (int32_t i = 0; i < iCount; i++)
- *pBuf++ = static_cast<wchar_t>(m_LineChars[i].m_wCharCode);
+ *pBuf++ = static_cast<wchar_t>(m_LineChars[i].char_code());
wsStr.ReleaseBuffer(iCount);
}
diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp
index 605b900a6e..70ac66e8ba 100644
--- a/xfa/fgas/layout/cfx_breakpiece.cpp
+++ b/xfa/fgas/layout/cfx_breakpiece.cpp
@@ -38,7 +38,7 @@ CFX_WideString CFX_BreakPiece::GetString() const {
CFX_WideString ret;
ret.Reserve(m_iChars);
for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
- ret += static_cast<wchar_t>((*m_pChars)[i].m_wCharCode);
+ ret += static_cast<wchar_t>((*m_pChars)[i].char_code());
return ret;
}
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index 353bdbacdf..45acae5bc4 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -68,16 +68,10 @@ CFX_BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
uint32_t dwProps = FX_GetUnicodeProperties(wch);
FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
- m_pCurLine->m_LineChars.emplace_back();
-
+ m_pCurLine->m_LineChars.emplace_back(wch, dwProps, m_iHorizontalScale,
+ m_iVerticalScale);
CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_dwStatus = CFX_BreakType::None;
- pCurChar->m_wCharCode = wch;
- pCurChar->m_dwCharProps = dwProps;
pCurChar->m_iFontSize = m_iFontSize;
- pCurChar->m_iHorizontalScale = m_iHorizontalScale;
- pCurChar->m_iVerticalScale = m_iVerticalScale;
- pCurChar->m_iCharWidth = 0;
pCurChar->m_dwIdentity = m_dwIdentity;
pCurChar->m_pUserData = m_pUserData;
@@ -127,7 +121,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
void CFX_RTFBreak::AppendChar_Combination(CFX_Char* pCurChar) {
int32_t iCharWidth = 0;
- if (!m_pFont->GetCharWidth(pCurChar->m_wCharCode, iCharWidth, false))
+ if (!m_pFont->GetCharWidth(pCurChar->char_code(), iCharWidth, false))
iCharWidth = 0;
iCharWidth *= m_iFontSize;
@@ -160,7 +154,7 @@ void CFX_RTFBreak::AppendChar_Tab(CFX_Char* pCurChar) {
CFX_BreakType CFX_RTFBreak::AppendChar_Control(CFX_Char* pCurChar) {
CFX_BreakType dwRet2 = CFX_BreakType::None;
- switch (pCurChar->m_wCharCode) {
+ switch (pCurChar->char_code()) {
case L'\v':
case 0x2028:
dwRet2 = CFX_BreakType::Line;
@@ -172,7 +166,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Control(CFX_Char* pCurChar) {
dwRet2 = CFX_BreakType::Paragraph;
break;
default:
- if (pCurChar->m_wCharCode == m_wParagraphBreakChar)
+ if (pCurChar->char_code() == m_wParagraphBreakChar)
dwRet2 = CFX_BreakType::Paragraph;
break;
}
@@ -197,7 +191,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef);
if (!m_pFont->GetCharWidth(wForm, iCharWidth, false) &&
- !m_pFont->GetCharWidth(pLastChar->m_wCharCode, iCharWidth, false)) {
+ !m_pFont->GetCharWidth(pLastChar->char_code(), iCharWidth, false)) {
iCharWidth = m_iDefChar;
}
@@ -212,7 +206,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? nullptr : pLastChar,
nullptr);
if (!m_pFont->GetCharWidth(wForm, iCharWidth, false) &&
- !m_pFont->GetCharWidth(pCurChar->m_wCharCode, iCharWidth, false)) {
+ !m_pFont->GetCharWidth(pCurChar->char_code(), iCharWidth, false)) {
iCharWidth = m_iDefChar;
}
@@ -229,7 +223,7 @@ CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
CFX_BreakType CFX_RTFBreak::AppendChar_Others(CFX_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
- wchar_t wForm = pCurChar->m_wCharCode;
+ wchar_t wForm = pCurChar->char_code();
int32_t iCharWidth = 0;
if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
iCharWidth = m_iDefChar;
@@ -335,8 +329,8 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine,
tp.m_iWidth = 0;
tp.m_dwStatus = pTC->m_dwStatus;
tp.m_iFontSize = pTC->m_iFontSize;
- tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVerticalScale;
+ tp.m_iHorizontalScale = pTC->horizonal_scale();
+ tp.m_iVerticalScale = pTC->vertical_scale();
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData.As<CXFA_TextUserData>();
@@ -408,8 +402,8 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_iBidiLevel = iBidiLevel;
tp.m_iBidiPos = pTC->m_iBidiOrder;
tp.m_iFontSize = pTC->m_iFontSize;
- tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVerticalScale;
+ tp.m_iHorizontalScale = pTC->horizonal_scale();
+ tp.m_iVerticalScale = pTC->vertical_scale();
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData.As<CXFA_TextUserData>();
@@ -558,7 +552,7 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
if (bAllChars)
pCur->m_nBreakType = FX_LBT_UNKNOWN;
- uint32_t nCodeProp = pCur->m_dwCharProps;
+ uint32_t nCodeProp = pCur->char_props();
uint32_t nNext = nCodeProp & 0x003F;
int32_t iCharWidth = pCur->m_iCharWidth;
if (iCharWidth > 0)
@@ -566,7 +560,7 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
while (iLength >= 0) {
pCur = pCharArray + iLength;
- nCodeProp = pCur->m_dwCharProps;
+ nCodeProp = pCur->char_props();
uint32_t nCur = nCodeProp & 0x003F;
bool bNeedBreak = false;
FX_LINEBREAKTYPE eType;
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp
index a5a5822d1c..9e4e445e0a 100644
--- a/xfa/fgas/layout/cfx_txtbreak.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -45,13 +45,8 @@ void CFX_TxtBreak::SetCombWidth(float fCombWidth) {
m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f);
}
-void CFX_TxtBreak::AppendChar_PageLoad(CFX_Char* pCurChar) {
- pCurChar->m_dwStatus = CFX_BreakType::None;
- pCurChar->m_dwCharStyles = m_iAlignment | (1 << 8);
-}
-
void CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) {
- wchar_t wch = pCurChar->m_wCharCode;
+ wchar_t wch = pCurChar->char_code();
wchar_t wForm;
int32_t iCharWidth = 0;
pCurChar->m_iCharWidth = -1;
@@ -64,13 +59,13 @@ void CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) {
(pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
bool bShadda = false;
if (wch == 0x0651) {
- wchar_t wLast = pLastChar->m_wCharCode;
+ wchar_t wLast = pLastChar->char_code();
if (wLast >= 0x064C && wLast <= 0x0650) {
wForm = FX_GetArabicFromShaddaTable(wLast);
bShadda = true;
}
} else if (wch >= 0x064C && wch <= 0x0650) {
- if (pLastChar->m_wCharCode == 0x0651) {
+ if (pLastChar->char_code() == 0x0651) {
wForm = FX_GetArabicFromShaddaTable(wch);
bShadda = true;
}
@@ -98,7 +93,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar) {
m_eCharType = FX_CHARTYPE_Control;
CFX_BreakType dwRet = CFX_BreakType::None;
if (!m_bSingleLine) {
- wchar_t wch = pCurChar->m_wCharCode;
+ wchar_t wch = pCurChar->char_code();
switch (wch) {
case L'\v':
case 0x2028:
@@ -180,7 +175,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) {
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth = 0;
m_eCharType = chartype;
- wchar_t wch = pCurChar->m_wCharCode;
+ wchar_t wch = pCurChar->char_code();
wchar_t wForm = wch;
if (m_bCombText) {
@@ -207,22 +202,11 @@ CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) {
CFX_BreakType CFX_TxtBreak::AppendChar(wchar_t wch) {
uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)];
FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
- m_pCurLine->m_LineChars.emplace_back();
-
+ m_pCurLine->m_LineChars.emplace_back(wch, dwProps, m_iHorizontalScale,
+ m_iVerticalScale);
CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_wCharCode = static_cast<uint16_t>(wch);
- pCurChar->m_dwCharProps = dwProps;
- pCurChar->m_dwCharStyles = 0;
- pCurChar->m_iCharWidth = 0;
- pCurChar->m_iHorizontalScale = m_iHorizontalScale;
- pCurChar->m_iVerticalScale = m_iVerticalScale;
- pCurChar->m_dwStatus = CFX_BreakType::None;
- pCurChar->m_iBidiClass = 0;
- pCurChar->m_iBidiLevel = 0;
- pCurChar->m_iBidiPos = 0;
- pCurChar->m_iBidiOrder = 0;
-
- AppendChar_PageLoad(pCurChar);
+ pCurChar->m_dwCharStyles = m_iAlignment | (1 << 8);
+
CFX_BreakType dwRet1 = CFX_BreakType::None;
if (chartype != FX_CHARTYPE_Combination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
@@ -333,8 +317,8 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_iBidiLevel = iBidiLevel;
tp.m_iBidiPos = pTC->m_iBidiOrder;
tp.m_dwCharStyles = pTC->m_dwCharStyles;
- tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVerticalScale;
+ tp.m_iHorizontalScale = pTC->horizonal_scale();
+ tp.m_iVerticalScale = pTC->vertical_scale();
tp.m_dwStatus = CFX_BreakType::Piece;
}
if (iBidiLevel != pTC->m_iBidiLevel ||
@@ -393,8 +377,8 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_pChars = &m_pCurLine->m_LineChars;
pTC = &chars[0];
tp.m_dwCharStyles = pTC->m_dwCharStyles;
- tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVerticalScale;
+ tp.m_iHorizontalScale = pTC->horizonal_scale();
+ tp.m_iVerticalScale = pTC->vertical_scale();
m_pCurLine->m_LinePieces.push_back(tp);
tpos->push_back({0, 0});
}
@@ -546,7 +530,7 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_Char>& ca,
if (bAllChars)
pCur->m_nBreakType = FX_LBT_UNKNOWN;
- nCodeProp = pCur->m_dwCharProps;
+ nCodeProp = pCur->char_props();
nNext = nCodeProp & 0x003F;
int32_t iCharWidth = pCur->m_iCharWidth;
if (iCharWidth > 0)
@@ -554,19 +538,12 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_Char>& ca,
while (iLength >= 0) {
pCur = &ca[iLength];
- nCodeProp = pCur->m_dwCharProps;
+ nCodeProp = pCur->char_props();
nCur = nCodeProp & 0x003F;
- if (nCur == FX_CBP_SP) {
- if (nNext == FX_CBP_SP)
- eType = FX_LBT_PROHIBITED_BRK;
- else
- eType = gs_FX_LineBreak_PairTable[nCur][nNext];
- } else {
- if (nNext == FX_CBP_SP)
- eType = FX_LBT_PROHIBITED_BRK;
- else
- eType = gs_FX_LineBreak_PairTable[nCur][nNext];
- }
+ if (nNext == FX_CBP_SP)
+ eType = FX_LBT_PROHIBITED_BRK;
+ else
+ eType = gs_FX_LineBreak_PairTable[nCur][nNext];
if (bAllChars)
pCur->m_nBreakType = static_cast<uint8_t>(eType);
if (!bOnlyBrk) {
diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h
index 3cb483c84e..0529c2656c 100644
--- a/xfa/fgas/layout/cfx_txtbreak.h
+++ b/xfa/fgas/layout/cfx_txtbreak.h
@@ -76,7 +76,6 @@ class CFX_TxtBreak : public CFX_Break {
private:
void AppendChar_Combination(CFX_Char* pCurChar);
void AppendChar_Tab(CFX_Char* pCurChar);
- void AppendChar_PageLoad(CFX_Char* pCurChar);
CFX_BreakType AppendChar_Control(CFX_Char* pCurChar);
CFX_BreakType AppendChar_Arabic(CFX_Char* pCurChar);
CFX_BreakType AppendChar_Others(CFX_Char* pCurChar);