diff options
-rw-r--r-- | core/fpdfdoc/cpdf_variabletext.cpp | 33 | ||||
-rw-r--r-- | core/fpdfdoc/ctypeset.cpp | 6 | ||||
-rw-r--r-- | core/fpdfdoc/include/cpdf_variabletext.h | 44 |
3 files changed, 30 insertions, 53 deletions
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 082af3775c..a4f9d8923f 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -335,10 +335,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection( } CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place, - const FX_WCHAR* text, - int32_t charset, - const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pProps) { + const FX_WCHAR* text) { CFX_WideString swText = text; CPVT_WordPlace wp = place; for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { @@ -350,7 +347,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place, if (swText.GetAt(i + 1) == 0x0A) i += 1; - wp = InsertSection(wp, pSecProps, pProps); + wp = InsertSection(wp, nullptr, nullptr); } break; case 0x0A: @@ -358,13 +355,13 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place, if (swText.GetAt(i + 1) == 0x0D) i += 1; - wp = InsertSection(wp, pSecProps, pProps); + wp = InsertSection(wp, nullptr, nullptr); } break; case 0x09: word = 0x20; default: - wp = InsertWord(wp, word, charset, pProps); + wp = InsertWord(wp, word, FXFONT_DEFAULT_CHARSET, nullptr); break; } if (wp == oldwp) @@ -396,10 +393,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace& place) { return ClearLeftWord(AdjustLineHeader(place, TRUE)); } -void CPDF_VariableText::SetText(const FX_WCHAR* text, - int32_t charset, - const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pWordProps) { +void CPDF_VariableText::SetText(const FX_WCHAR* text) { DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); CFX_WideString swText = text; CPVT_WordPlace wp(0, 0, -1); @@ -441,7 +435,7 @@ void CPDF_VariableText::SetText(const FX_WCHAR* text, case 0x09: word = 0x20; default: - wp = InsertWord(wp, word, charset, pWordProps); + wp = InsertWord(wp, word, FXFONT_DEFAULT_CHARSET, nullptr); break; } nCharCount++; @@ -773,8 +767,7 @@ const CFX_FloatRect& CPDF_VariableText::GetPlateRect() const { return CPDF_EditContainer::GetPlateRect(); } -FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo, - FX_BOOL bFactFontSize) { +FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) { return GetFontSize(); } @@ -833,16 +826,12 @@ FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo, return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize); } -FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo, - FX_BOOL bFactFontSize) { - return GetFontAscent(GetWordFontIndex(WordInfo), - GetWordFontSize(WordInfo, bFactFontSize)); +FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) { + return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo)); } -FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo, - FX_BOOL bFactFontSize) { - return GetFontDescent(GetWordFontIndex(WordInfo), - GetWordFontSize(WordInfo, bFactFontSize)); +FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) { + return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo)); } FX_FLOAT CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) { diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp index 8c85e79922..57d3733dc3 100644 --- a/core/fpdfdoc/ctypeset.cpp +++ b/core/fpdfdoc/ctypeset.cpp @@ -300,10 +300,8 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { } if (pWord) { if (bTypeset) { - fLineAscent = - std::max(fLineAscent, m_pVT->GetWordAscent(*pWord, TRUE)); - fLineDescent = - std::min(fLineDescent, m_pVT->GetWordDescent(*pWord, TRUE)); + fLineAscent = std::max(fLineAscent, m_pVT->GetWordAscent(*pWord)); + fLineDescent = std::min(fLineDescent, m_pVT->GetWordDescent(*pWord)); fWordWidth = m_pVT->GetWordWidth(*pWord); } else { fLineAscent = diff --git a/core/fpdfdoc/include/cpdf_variabletext.h b/core/fpdfdoc/include/cpdf_variabletext.h index 7725612f89..c898b18ad8 100644 --- a/core/fpdfdoc/include/cpdf_variabletext.h +++ b/core/fpdfdoc/include/cpdf_variabletext.h @@ -92,15 +92,15 @@ class CPDF_VariableText : private CPDF_EditContainer { CFX_FloatRect GetContentRect() const override; const CFX_FloatRect& GetPlateRect() const override; - void SetAlignment(int32_t nFormat = 0) { m_nAlignment = nFormat; } - void SetPasswordChar(uint16_t wSubWord = '*') { m_wSubWord = wSubWord; } - void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; } - void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) { m_fCharSpace = fCharSpace; } - void SetMultiLine(FX_BOOL bMultiLine = TRUE) { m_bMultiLine = bMultiLine; } - void SetAutoReturn(FX_BOOL bAuto = TRUE) { m_bLimitWidth = bAuto; } + void SetAlignment(int32_t nFormat) { m_nAlignment = nFormat; } + void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; } + void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; } + void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; } + void SetMultiLine(FX_BOOL bMultiLine) { m_bMultiLine = bMultiLine; } + void SetAutoReturn(FX_BOOL bAuto) { m_bLimitWidth = bAuto; } void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } - void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; } - void SetAutoFontSize(FX_BOOL bAuto = TRUE) { m_bAutoFontSize = bAuto; } + void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; } + void SetAutoFontSize(FX_BOOL bAuto) { m_bAutoFontSize = bAuto; } void Initialize(); FX_BOOL IsValid() const { return m_bInitial; } @@ -108,22 +108,15 @@ class CPDF_VariableText : private CPDF_EditContainer { void RearrangeAll(); void RearrangePart(const CPVT_WordRange& PlaceRange); void ResetAll(); - void SetText(const FX_WCHAR* text, - int32_t charset = FXFONT_DEFAULT_CHARSET, - const CPVT_SecProps* pSecProps = nullptr, - const CPVT_WordProps* pWordProps = nullptr); + void SetText(const FX_WCHAR* text); CPVT_WordPlace InsertWord(const CPVT_WordPlace& place, uint16_t word, - int32_t charset = FXFONT_DEFAULT_CHARSET, - const CPVT_WordProps* pWordProps = nullptr); + int32_t charset, + const CPVT_WordProps* pWordProps); CPVT_WordPlace InsertSection(const CPVT_WordPlace& place, - const CPVT_SecProps* pSecProps = nullptr, - const CPVT_WordProps* pWordProps = nullptr); - CPVT_WordPlace InsertText(const CPVT_WordPlace& place, - const FX_WCHAR* text, - int32_t charset = FXFONT_DEFAULT_CHARSET, - const CPVT_SecProps* pSecProps = nullptr, - const CPVT_WordProps* pWordProps = nullptr); + const CPVT_SecProps* pSecProps, + const CPVT_WordProps* pWordProps); + CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const FX_WCHAR* text); CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange); CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place); CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place); @@ -184,8 +177,7 @@ class CPDF_VariableText : private CPDF_EditContainer { FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo); FX_BOOL GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo); - FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo, - FX_BOOL bFactFontSize = FALSE); + FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo); FX_FLOAT GetWordWidth(int32_t nFontIndex, uint16_t Word, uint16_t SubWord, @@ -197,10 +189,8 @@ class CPDF_VariableText : private CPDF_EditContainer { FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo); FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize); - FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, - FX_BOOL bFactFontSize = FALSE); - FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, - FX_BOOL bFactFontSize = FALSE); + FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo); + FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo); FX_FLOAT GetLineAscent(const CPVT_SectionInfo& SecInfo); FX_FLOAT GetLineDescent(const CPVT_SectionInfo& SecInfo); FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize); |