summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp46
-rw-r--r--core/fpdfdoc/cpdf_variabletext.h21
-rw-r--r--core/fpdfdoc/csection.cpp2
-rw-r--r--core/fpdfdoc/ctypeset.cpp28
4 files changed, 39 insertions, 58 deletions
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index d3de6129f1..753e7eaf9b 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -191,7 +191,7 @@ bool CPDF_VariableText::Iterator::GetWord(CPVT_Word& word) const {
if (pWord->pWordProps)
word.WordProps = *pWord->pWordProps;
word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
- word.fFontSize = m_pVT->GetWordFontSize(*pWord);
+ word.fFontSize = m_pVT->GetWordFontSize();
return true;
}
@@ -302,8 +302,7 @@ void CPDF_VariableText::ResetAll() {
CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace& place,
uint16_t word,
- int32_t charset,
- const CPVT_WordProps* pWordProps) {
+ int32_t charset) {
int32_t nTotalWords = GetTotalWords();
if (m_nLimitChar > 0 && nTotalWords >= m_nLimitChar)
return place;
@@ -318,10 +317,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace& place,
return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, nullptr));
}
-CPVT_WordPlace CPDF_VariableText::InsertSection(
- const CPVT_WordPlace& place,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps) {
+CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace& place) {
int32_t nTotalWords = GetTotalWords();
if (m_nLimitChar > 0 && nTotalWords >= m_nLimitChar)
return place;
@@ -365,7 +361,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
if (swText[i + 1] == 0x0A)
i += 1;
- wp = InsertSection(wp, nullptr, nullptr);
+ wp = InsertSection(wp);
}
break;
case 0x0A:
@@ -373,13 +369,13 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
if (swText[i + 1] == 0x0D)
i += 1;
- wp = InsertSection(wp, nullptr, nullptr);
+ wp = InsertSection(wp);
}
break;
case 0x09:
word = 0x20;
default:
- wp = InsertWord(wp, word, FX_CHARSET_Default, nullptr);
+ wp = InsertWord(wp, word, FX_CHARSET_Default);
break;
}
if (wp == oldwp)
@@ -447,7 +443,7 @@ void CPDF_VariableText::SetText(const WideString& swText) {
case 0x09:
word = 0x20;
default:
- wp = InsertWord(wp, word, FX_CHARSET_Default, nullptr);
+ wp = InsertWord(wp, word, FX_CHARSET_Default);
break;
}
nCharCount++;
@@ -780,7 +776,7 @@ const CFX_FloatRect& CPDF_VariableText::GetPlateRect() const {
return m_rcPlate;
}
-float CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetWordFontSize() {
return GetFontSize();
}
@@ -803,15 +799,15 @@ float CPDF_VariableText::GetWordWidth(int32_t nFontIndex,
float CPDF_VariableText::GetWordWidth(const CPVT_WordInfo& WordInfo) {
return GetWordWidth(GetWordFontIndex(WordInfo), WordInfo.Word, GetSubWord(),
- GetCharSpace(WordInfo), GetHorzScale(WordInfo),
- GetWordFontSize(WordInfo), WordInfo.fWordTail);
+ GetCharSpace(), GetHorzScale(), GetWordFontSize(),
+ WordInfo.fWordTail);
}
-float CPDF_VariableText::GetLineAscent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineAscent() {
return GetFontAscent(GetDefaultFontIndex(), GetFontSize());
}
-float CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineDescent() {
return GetFontDescent(GetDefaultFontIndex(), GetFontSize());
}
@@ -834,33 +830,25 @@ float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo,
}
float CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) {
- return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo));
+ return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize());
}
float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) {
- return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo));
+ return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize());
}
-float CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineLeading() {
return m_fLineLeading;
}
-float CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineIndent() {
return 0.0f;
}
-int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) {
+int32_t CPDF_VariableText::GetAlignment() {
return m_nAlignment;
}
-float CPDF_VariableText::GetCharSpace(const CPVT_WordInfo& WordInfo) {
- return m_fCharSpace;
-}
-
-int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo& WordInfo) {
- return m_nHorzScale;
-}
-
void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) {
CPVT_WordPlace wordplace = AdjustLineHeader(place, true);
if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index 2319df7cb9..9daf56e668 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -109,11 +109,8 @@ class CPDF_VariableText {
void SetText(const WideString& text);
CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
uint16_t word,
- int32_t charset,
- const CPVT_WordProps* pWordProps);
- CPVT_WordPlace InsertSection(const CPVT_WordPlace& place,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps);
+ int32_t charset);
+ CPVT_WordPlace InsertSection(const CPVT_WordPlace& place);
CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const wchar_t* text);
CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange);
CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place);
@@ -165,8 +162,8 @@ class CPDF_VariableText {
float GetFontAscent(int32_t nFontIndex, float fFontSize);
float GetFontDescent(int32_t nFontIndex, float fFontSize);
int32_t GetDefaultFontIndex();
- float GetLineLeading(const CPVT_SectionInfo& SecInfo);
- int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
+ float GetLineLeading();
+ int32_t GetAlignment();
float GetWordWidth(const CPVT_WordInfo& WordInfo);
float GetWordWidth(int32_t nFontIndex,
uint16_t Word,
@@ -179,9 +176,9 @@ class CPDF_VariableText {
float GetWordDescent(const CPVT_WordInfo& WordInfo);
float GetWordAscent(const CPVT_WordInfo& WordInfo, float fFontSize);
float GetWordDescent(const CPVT_WordInfo& WordInfo, float fFontSize);
- float GetLineAscent(const CPVT_SectionInfo& SecInfo);
- float GetLineDescent(const CPVT_SectionInfo& SecInfo);
- float GetLineIndent(const CPVT_SectionInfo& SecInfo);
+ float GetLineAscent();
+ float GetLineDescent();
+ float GetLineIndent();
private:
int32_t GetCharWidth(int32_t nFontIndex, uint16_t Word, uint16_t SubWord);
@@ -200,10 +197,8 @@ class CPDF_VariableText {
bool SetWordInfo(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo);
bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
bool GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo);
- float GetWordFontSize(const CPVT_WordInfo& WordInfo);
+ float GetWordFontSize();
int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
- float GetCharSpace(const CPVT_WordInfo& WordInfo);
- int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
void ClearSectionRightWords(const CPVT_WordPlace& place);
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index 0c8c02585f..1f2bef43c3 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -133,7 +133,7 @@ CPVT_WordPlace CSection::SearchWordPlace(const CFX_PointF& point) const {
while (nLeft <= nRight) {
CLine* pLine = m_LineArray[nMid].get();
float fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent -
- m_pVT->GetLineLeading(m_SecInfo);
+ m_pVT->GetLineLeading();
float fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
if (IsFloatBigger(point.y, fTop))
bUp = false;
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index 920ac03a18..856377e598 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -191,10 +191,10 @@ CPVT_FloatRect CTypeset::CharArray() {
float fLineDescent =
m_pVT->GetFontDescent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
float x = 0.0f;
- float y = m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent;
+ float y = m_pVT->GetLineLeading() + fLineAscent;
int32_t nStart = 0;
CLine* pLine = m_pSection->m_LineArray.front().get();
- switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+ switch (m_pVT->GetAlignment()) {
case 0:
pLine->m_LineInfo.fLineX = fNodeWidth * VARIABLETEXT_HALF;
break;
@@ -289,9 +289,8 @@ void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
int32_t nCharIndex = 0;
CPVT_LineInfo line;
float fWordWidth = 0;
- float fTypesetWidth = std::max(
- m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo),
- 0.0f);
+ float fTypesetWidth =
+ std::max(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(), 0.0f);
int32_t nTotalWords =
pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
bool bOpened = false;
@@ -366,7 +365,7 @@ void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
line.fLineDescent = fLineDescent;
m_pSection->AddLine(line);
}
- fMaxY += (fLineAscent + m_pVT->GetLineLeading(m_pSection->m_SecInfo));
+ fMaxY += (fLineAscent + m_pVT->GetLineLeading());
fMaxY -= fLineDescent;
fMaxX = std::max(fLineWidth, fMaxX);
nLineHead = i;
@@ -392,14 +391,14 @@ void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
line.fLineDescent = fLineDescent;
m_pSection->AddLine(line);
}
- fMaxY += (fLineAscent + m_pVT->GetLineLeading(m_pSection->m_SecInfo));
+ fMaxY += (fLineAscent + m_pVT->GetLineLeading());
fMaxY -= fLineDescent;
fMaxX = std::max(fLineWidth, fMaxX);
}
} else {
if (bTypeset) {
- fLineAscent = m_pVT->GetLineAscent(m_pSection->m_SecInfo);
- fLineDescent = m_pVT->GetLineDescent(m_pSection->m_SecInfo);
+ fLineAscent = m_pVT->GetLineAscent();
+ fLineDescent = m_pVT->GetLineDescent();
} else {
fLineAscent =
m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), fFontSize);
@@ -415,8 +414,7 @@ void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
line.fLineDescent = fLineDescent;
m_pSection->AddLine(line);
}
- fMaxY += m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent -
- fLineDescent;
+ fMaxY += m_pVT->GetLineLeading() + fLineAscent - fLineDescent;
}
m_rcRet = CPVT_FloatRect(0, 0, fMaxX, fMaxY);
}
@@ -426,9 +424,9 @@ void CTypeset::OutputLines() {
ASSERT(m_pSection);
float fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f;
float fPosX = 0.0f, fPosY = 0.0f;
- float fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo);
+ float fLineIndent = m_pVT->GetLineIndent();
float fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f);
- switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+ switch (m_pVT->GetAlignment()) {
default:
case 0:
fMinX = 0.0f;
@@ -449,7 +447,7 @@ void CTypeset::OutputLines() {
m_pSection->m_SecInfo.nTotalLine = nTotalLines;
for (int32_t l = 0; l < nTotalLines; l++) {
CLine* pLine = m_pSection->m_LineArray[l].get();
- switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+ switch (m_pVT->GetAlignment()) {
default:
case 0:
fPosX = 0;
@@ -463,7 +461,7 @@ void CTypeset::OutputLines() {
break;
}
fPosX += fLineIndent;
- fPosY += m_pVT->GetLineLeading(m_pSection->m_SecInfo);
+ fPosY += m_pVT->GetLineLeading();
fPosY += pLine->m_LineInfo.fLineAscent;
pLine->m_LineInfo.fLineX = fPosX - fMinX;
pLine->m_LineInfo.fLineY = fPosY - fMinY;