summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp90
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h9
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp38
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h5
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.cpp1
5 files changed, 23 insertions, 120 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index a564301ec7..9791a5f20f 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -31,9 +31,6 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwLayoutStyles)
m_iHorizontalScale(100),
m_iVerticalScale(100),
m_iCharSpace(0),
- m_bWordSpace(false),
- m_iWordSpace(0),
- m_bRTL(false),
m_iAlignment(CFX_RTFLineAlignment::Left),
m_pUserData(nullptr),
m_eCharType(FX_CHARTYPE_Unknown),
@@ -103,85 +100,48 @@ void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) {
}
}
}
+
void CFX_RTFBreak::SetTabWidth(FX_FLOAT fTabWidth) {
m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f);
}
+
void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) {
int32_t iLineEnd = m_iBoundaryEnd;
int32_t iTabPos = FXSYS_round(fTabPos * 20000.0f) + m_iBoundaryStart;
- if (iTabPos > iLineEnd) {
+ if (iTabPos > iLineEnd)
iTabPos = iLineEnd;
- }
- if (m_PositionedTabs.Find(iTabPos, 0) > -1) {
+ if (m_PositionedTabs.Find(iTabPos, 0) > -1)
return;
- }
+
int32_t iCount = m_PositionedTabs.GetSize();
int32_t iFind = 0;
for (; iFind < iCount; iFind++) {
- if (m_PositionedTabs[iFind] > iTabPos) {
+ if (m_PositionedTabs[iFind] > iTabPos)
break;
- }
}
m_PositionedTabs.InsertAt(iFind, iTabPos);
}
-void CFX_RTFBreak::SetPositionedTabs(const std::vector<FX_FLOAT>& tabs) {
- m_PositionedTabs.RemoveAll();
- int32_t iCount = pdfium::CollectionSize<int32_t>(tabs);
- m_PositionedTabs.SetSize(iCount);
- int32_t iLineEnd = m_iBoundaryEnd;
- int32_t iTabPos;
- for (int32_t i = 0; i < iCount; i++) {
- iTabPos = FXSYS_round(tabs[i] * 20000.0f) + m_iBoundaryStart;
- if (iTabPos > iLineEnd) {
- iTabPos = iLineEnd;
- }
- m_PositionedTabs[i] = iTabPos;
- }
-}
-
-void CFX_RTFBreak::ClearPositionedTabs() {
- m_PositionedTabs.RemoveAll();
-}
-
-void CFX_RTFBreak::SetDefaultChar(FX_WCHAR wch) {
- m_wDefChar = wch;
- m_iDefChar = 0;
- if (m_wDefChar != 0xFEFF && m_pFont) {
- m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
- if (m_iDefChar < 0) {
- m_iDefChar = 0;
- } else {
- m_iDefChar *= m_iFontSize;
- }
- }
-}
-void CFX_RTFBreak::SetLineBreakChar(FX_WCHAR wch) {
- if (wch != L'\r' && wch != L'\n') {
- return;
- }
- m_wLineBreakChar = wch;
-}
void CFX_RTFBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) {
m_iTolerance = FXSYS_round(fTolerance * 20000.0f);
}
+
void CFX_RTFBreak::SetHorizontalScale(int32_t iScale) {
- if (iScale < 0) {
+ if (iScale < 0)
iScale = 0;
- }
- if (m_iHorizontalScale == iScale) {
+ if (m_iHorizontalScale == iScale)
return;
- }
+
SetBreakStatus();
m_iHorizontalScale = iScale;
}
+
void CFX_RTFBreak::SetVerticalScale(int32_t iScale) {
- if (iScale < 0) {
+ if (iScale < 0)
iScale = 0;
- }
- if (m_iVerticalScale == iScale) {
+ if (m_iVerticalScale == iScale)
return;
- }
+
SetBreakStatus();
m_iVerticalScale = iScale;
}
@@ -189,13 +149,6 @@ void CFX_RTFBreak::SetVerticalScale(int32_t iScale) {
void CFX_RTFBreak::SetCharSpace(FX_FLOAT fCharSpace) {
m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
}
-void CFX_RTFBreak::SetWordSpace(bool bDefault, FX_FLOAT fWordSpace) {
- m_bWordSpace = !bDefault;
- m_iWordSpace = FXSYS_round(fWordSpace * 20000.0f);
-}
-void CFX_RTFBreak::SetReadingOrder(bool bRTL) {
- m_bRTL = bRTL;
-}
void CFX_RTFBreak::SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData) {
if (m_pUserData == pUserData)
@@ -299,7 +252,7 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_iFontSize = m_iFontSize;
pCurChar->m_iFontHeight = m_iFontHeight;
pCurChar->m_iHorizontalScale = m_iHorizontalScale;
- pCurChar->m_iVertialScale = m_iVerticalScale;
+ pCurChar->m_iVerticalScale = m_iVerticalScale;
pCurChar->m_iCharWidth = 0;
pCurChar->m_dwIdentity = m_dwIdentity;
pCurChar->m_pUserData = m_pUserData;
@@ -434,9 +387,6 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
FX_WCHAR wForm;
if (chartype == FX_CHARTYPE_Numeric) {
wForm = pCurChar->m_wCharCode;
- } else if (m_bRTL) {
- wForm = FX_GetMirrorChar(pCurChar->m_wCharCode, pCurChar->m_dwCharProps,
- m_bRTL, false);
} else {
wForm = pCurChar->m_wCharCode;
}
@@ -448,8 +398,6 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
iCharWidth *= m_iFontSize;
iCharWidth *= m_iHorizontalScale / 100;
iCharWidth += m_iCharSpace;
- if (chartype == FX_CHARTYPE_Space && m_bWordSpace)
- iCharWidth += m_iWordSpace;
pCurChar->m_iCharWidth = iCharWidth;
m_pCurLine->m_iWidth += iCharWidth;
@@ -555,7 +503,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
tp.m_iFontSize = pTC->m_iFontSize;
tp.m_iFontHeight = pTC->m_iFontHeight;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVertialScale;
+ tp.m_iVerticalScale = pTC->m_iVerticalScale;
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData;
@@ -594,7 +542,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos,
int32_t i, j;
std::vector<CFX_RTFChar>& chars = m_pCurLine->m_LineChars;
int32_t iCount = m_pCurLine->CountChars();
- bool bDone = (!m_bPagination && (m_pCurLine->m_iArabicChars > 0 || m_bRTL));
+ bool bDone = (!m_bPagination && m_pCurLine->m_iArabicChars > 0);
if (bDone) {
int32_t iBidiNum = 0;
for (i = 0; i < iCount; i++) {
@@ -607,7 +555,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos,
pTC->m_iBidiLevel = 1;
}
}
- FX_BidiLine(chars, iBidiNum + 1, m_bRTL ? 1 : 0);
+ FX_BidiLine(chars, iBidiNum + 1, 0);
} else {
for (i = 0; i < iCount; i++) {
pTC = &chars[i];
@@ -638,7 +586,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos,
tp.m_iFontSize = pTC->m_iFontSize;
tp.m_iFontHeight = pTC->m_iFontHeight;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVertialScale;
+ tp.m_iVerticalScale = pTC->m_iVerticalScale;
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData;
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index ad501fd054..be3c180513 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -183,16 +183,10 @@ class CFX_RTFBreak {
void SetFontSize(FX_FLOAT fFontSize);
void SetTabWidth(FX_FLOAT fTabWidth);
void AddPositionedTab(FX_FLOAT fTabPos);
- void SetPositionedTabs(const std::vector<FX_FLOAT>& tabs);
- void ClearPositionedTabs();
- void SetDefaultChar(FX_WCHAR wch);
- void SetLineBreakChar(FX_WCHAR wch);
void SetLineBreakTolerance(FX_FLOAT fTolerance);
void SetHorizontalScale(int32_t iScale);
void SetVerticalScale(int32_t iScale);
void SetCharSpace(FX_FLOAT fCharSpace);
- void SetWordSpace(bool bDefault, FX_FLOAT fWordSpace);
- void SetReadingOrder(bool bRTL = false);
void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; }
void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData);
CFX_RTFBreakType AppendChar(FX_WCHAR wch);
@@ -252,9 +246,6 @@ class CFX_RTFBreak {
int32_t m_iHorizontalScale;
int32_t m_iVerticalScale;
int32_t m_iCharSpace;
- bool m_bWordSpace;
- int32_t m_iWordSpace;
- bool m_bRTL;
CFX_RTFLineAlignment m_iAlignment;
CFX_RetainPtr<CFX_Retainable> m_pUserData;
FX_CHARTYPE m_eCharType;
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index ea07400c6d..fa38897eca 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -67,7 +67,6 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
m_iReady(0),
m_iTolerance(0),
m_iHorScale(100),
- m_iVerScale(100),
m_iCharSpace(0) {
m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0;
int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar);
@@ -207,19 +206,6 @@ void CFX_TxtBreak::ResetContextCharStyles() {
m_dwContextCharStyles |= (m_iArabicContext << 8);
}
-uint32_t CFX_TxtBreak::GetContextCharStyles() const {
- return m_dwContextCharStyles;
-}
-
-void CFX_TxtBreak::SetContextCharStyles(uint32_t dwCharStyles) {
- m_iCurAlignment = dwCharStyles & 0x0F;
- m_bArabicNumber = (dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0;
- m_bArabicComma = (dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0;
- m_bCurRTL = (dwCharStyles & FX_TXTCHARSTYLE_RTLReadingOrder) != 0;
- m_iCurArabicContext = m_iArabicContext = ((dwCharStyles & 0x0300) >> 8);
- ResetContextCharStyles();
-}
-
void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) {
m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f);
}
@@ -257,17 +243,6 @@ void CFX_TxtBreak::SetHorizontalScale(int32_t iScale) {
m_iHorScale = iScale;
}
-void CFX_TxtBreak::SetVerticalScale(int32_t iScale) {
- if (iScale < 0) {
- iScale = 0;
- }
- if (iScale == m_iHorScale) {
- return;
- }
- SetBreakStatus();
- m_iVerScale = iScale;
-}
-
void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) {
m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
}
@@ -602,7 +577,7 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_dwCharStyles = 0;
pCurChar->m_iCharWidth = 0;
pCurChar->m_iHorizontalScale = m_iHorScale;
- pCurChar->m_iVertialScale = m_iVerScale;
+ pCurChar->m_iVerticalScale = 100;
pCurChar->m_dwStatus = 0;
pCurChar->m_iBidiClass = 0;
pCurChar->m_iBidiLevel = 0;
@@ -726,7 +701,7 @@ bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine,
pTC = m_pCurLine->GetCharPtr(0);
tp.m_dwCharStyles = pTC->m_dwCharStyles;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVertialScale;
+ tp.m_iVerticalScale = pTC->m_iVerticalScale;
pCurPieces->Add(tp);
m_pCurLine = pNextLine;
m_eCharType = FX_CHARTYPE_Unknown;
@@ -779,7 +754,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
tp.m_dwCharStyles = pTC->m_dwCharStyles;
tp.m_pUserData = pTC->m_pUserData;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVertialScale;
+ tp.m_iVerticalScale = pTC->m_iVerticalScale;
tp.m_dwStatus = FX_TXTBREAK_PieceBreak;
}
if (iBidiLevel != pTC->m_iBidiLevel || pTC->m_dwStatus != 0) {
@@ -840,7 +815,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
pTC = &chars[0];
tp.m_dwCharStyles = pTC->m_dwCharStyles;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVertialScale;
+ tp.m_iVerticalScale = pTC->m_iVerticalScale;
pCurPieces->Add(tp);
tpo.index = 0;
tpo.pos = 0;
@@ -1149,11 +1124,6 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
pNextLine->m_iWidth = iWidth;
}
-int32_t CFX_TxtBreak::CountBreakChars() const {
- CFX_TxtLine* pTxtLine = GetTxtLine(true);
- return pTxtLine ? pTxtLine->CountChars() : 0;
-}
-
int32_t CFX_TxtBreak::CountBreakPieces() const {
CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(true);
return pTxtPieces ? pTxtPieces->GetSize() : 0;
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index 19f1050039..54ded7ded2 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -213,17 +213,13 @@ class CFX_TxtBreak {
void SetParagraphBreakChar(FX_WCHAR wch);
void SetLineBreakTolerance(FX_FLOAT fTolerance);
void SetHorizontalScale(int32_t iScale);
- void SetVerticalScale(int32_t iScale);
void SetCharRotation(int32_t iCharRotation);
void SetCharSpace(FX_FLOAT fCharSpace);
void SetAlignment(int32_t iAlignment);
- uint32_t GetContextCharStyles() const;
- void SetContextCharStyles(uint32_t dwCharStyles);
void SetCombWidth(FX_FLOAT fCombWidth);
void SetUserData(void* pUserData);
uint32_t AppendChar(FX_WCHAR wch);
uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
- int32_t CountBreakChars() const;
int32_t CountBreakPieces() const;
const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
void ClearBreakPieces();
@@ -305,7 +301,6 @@ class CFX_TxtBreak {
int32_t m_iReady;
int32_t m_iTolerance;
int32_t m_iHorScale;
- int32_t m_iVerScale;
int32_t m_iCharSpace;
};
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp
index 9b7e2455a6..9735dc7b13 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -95,7 +95,6 @@ CFX_RTFBreak* CXFA_TextLayout::CreateBreak(bool bDefault) {
dwStyle |= FX_RTFLAYOUTSTYLE_Pagination;
CFX_RTFBreak* pBreak = new CFX_RTFBreak(dwStyle);
- pBreak->SetLineBreakChar(L'\n');
pBreak->SetLineBreakTolerance(1);
pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr));
pBreak->SetFontSize(m_textParser.GetFontSize(m_pTextProvider, nullptr));