diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-04 21:13:59 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-04 21:13:59 +0000 |
commit | 7cabaf136b2aa671768c9d8ee3645c9444afc700 (patch) | |
tree | 4aec57e31e1a7207e8009e9d33c9b738a3e8288b /fpdfsdk | |
parent | ce6eb642dbaf96fc2a9d4e97a205a0a12e7154a4 (diff) | |
download | pdfium-7cabaf136b2aa671768c9d8ee3645c9444afc700.tar.xz |
CPDF_VariableText::m_nHorzScale is always 100
Remove the member and simplify logic in all the places this
is passed.
Change-Id: I39b979793fe84f0dc460261223655dd7f50555cc
Reviewed-on: https://pdfium-review.googlesource.com/c/43474
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/pwl/cpwl_appstream.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit_impl.cpp | 34 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit_impl.h | 1 |
3 files changed, 10 insertions, 35 deletions
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp index 4175b8ef2a..aa007b8d6f 100644 --- a/fpdfsdk/pwl/cpwl_appstream.cpp +++ b/fpdfsdk/pwl/cpwl_appstream.cpp @@ -68,7 +68,6 @@ const char kSetNonZeroWindingClipOperator[] = "W"; const char kSetRGBOperator[] = "rg"; const char kSetRGBStrokedOperator[] = "RG"; const char kSetTextFontAndSizeOperator[] = "Tf"; -const char kSetTextScaleHorizontalOperator[] = "Tz"; const char kShowTextOperator[] = "Tj"; const char kStateRestoreOperator[] = "Q"; const char kStateSaveOperator[] = "q"; @@ -667,16 +666,9 @@ ByteString GetEditAppStream(CPWL_EditImpl* pEdit, std::ostringstream sAppStream; if (sEditStream.tellp() > 0) { - int32_t nHorzScale = pEdit->GetHorzScale(); - if (nHorzScale != 100) { - sAppStream << nHorzScale << " " << kSetTextScaleHorizontalOperator - << "\n"; - } - float fCharSpace = pEdit->GetCharSpace(); - if (!IsFloatZero(fCharSpace)) { + if (!IsFloatZero(fCharSpace)) sAppStream << fCharSpace << " " << kSetCharacterSpacingOperator << "\n"; - } sAppStream << sEditStream.str(); } diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index fb0e8afa16..c0eccfec8e 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp @@ -43,26 +43,17 @@ void DrawTextString(CFX_RenderDevice* pDevice, float fFontSize, const CFX_Matrix& mtUser2Device, const ByteString& str, - FX_ARGB crTextFill, - int32_t nHorzScale) { + FX_ARGB crTextFill) { if (!pFont) return; CFX_PointF pos = mtUser2Device.Transform(pt); - CFX_Matrix mt; - if (nHorzScale == 100) { - mt = mtUser2Device; - } else { - mt = CFX_Matrix(nHorzScale / 100.0f, 0, 0, 1, 0, 0); - mt.Concat(mtUser2Device); - } - CPDF_RenderOptions ro; ro.SetFlags(RENDER_CLEARTYPE); - ro.SetColorMode(CPDF_RenderOptions::kNormal); CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize, - &mt, str, crTextFill, nullptr, &ro); + mtUser2Device, str, crTextFill, nullptr, + &ro); } } // namespace @@ -437,11 +428,8 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, uint16_t SubWord = pEdit->GetPasswordChar(); float fFontSize = pEdit->GetFontSize(); CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); - int32_t nHorzScale = pEdit->GetHorzScale(); - FX_COLORREF crCurFill = crTextFill; FX_COLORREF crOldFill = crCurFill; - bool bSelect = false; const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); @@ -504,10 +492,10 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || crOldFill != crCurFill) { if (sTextBuf.tellp() > 0) { - DrawTextString( - pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device, - ByteString(sTextBuf), crOldFill, nHorzScale); + DrawTextString(pDevice, + CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pFontMap->GetPDFFont(nFontIndex), fFontSize, + mtUser2Device, ByteString(sTextBuf), crOldFill); sTextBuf.str(""); } @@ -524,7 +512,7 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, CFX_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y), pFontMap->GetPDFFont(word.nFontIndex), fFontSize, mtUser2Device, pEdit->GetPDFWordString(word.nFontIndex, word.Word, SubWord), - crCurFill, nHorzScale); + crCurFill); } oldplace = place; } @@ -534,7 +522,7 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, DrawTextString(pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device, - ByteString(sTextBuf), crOldFill, nHorzScale); + ByteString(sTextBuf), crOldFill); } } @@ -829,10 +817,6 @@ CFX_FloatRect CPWL_EditImpl::GetContentRect() const { return VTToEdit(m_pVT->GetContentRect()); } -int32_t CPWL_EditImpl::GetHorzScale() const { - return m_pVT->GetHorzScale(); -} - float CPWL_EditImpl::GetCharSpace() const { return m_pVT->GetCharSpace(); } diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h index 743afae6b6..7f14ade66a 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.h +++ b/fpdfsdk/pwl/cpwl_edit_impl.h @@ -303,7 +303,6 @@ class CPWL_EditImpl { int32_t GetCharArray() const; CFX_FloatRect GetContentRect() const; WideString GetRangeText(const CPVT_WordRange& range) const; - int32_t GetHorzScale() const; float GetCharSpace() const; void SetSelection(int32_t nStartChar, int32_t nEndChar); void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const; |