OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "xfa/src/foxitlib.h" | 9 #include "xfa/src/foxitlib.h" |
10 #include "xfa/src/fxfa/src/common/xfa_common.h" | 10 #include "xfa/src/fxfa/src/common/xfa_common.h" |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 } | 788 } |
789 if (fLineWidth < 0) { | 789 if (fLineWidth < 0) { |
790 fLineWidth = fStart; | 790 fLineWidth = fStart; |
791 } | 791 } |
792 fStartPos = fStart; | 792 fStartPos = fStart; |
793 FX_FLOAT fIndent = para.GetTextIndent(); | 793 FX_FLOAT fIndent = para.GetTextIndent(); |
794 if (fIndent > 0) { | 794 if (fIndent > 0) { |
795 fStartPos += fIndent; | 795 fStartPos += fIndent; |
796 } | 796 } |
797 } | 797 } |
798 m_pBreak->SetLineWidth(fStart, fLineWidth); | 798 m_pBreak->SetLineBoundary(fStart, fLineWidth); |
799 m_pBreak->SetLinePos(fStartPos); | 799 m_pBreak->SetLineStartPos(fStartPos); |
800 if (font.IsExistInXML()) { | 800 if (font.IsExistInXML()) { |
801 m_pBreak->SetHorizontalScale((int32_t)font.GetHorizontalScale()); | 801 m_pBreak->SetHorizontalScale((int32_t)font.GetHorizontalScale()); |
802 m_pBreak->SetVerticalScale((int32_t)font.GetVerticalScale()); | 802 m_pBreak->SetVerticalScale((int32_t)font.GetVerticalScale()); |
803 m_pBreak->SetCharSpace(font.GetLetterSpacing()); | 803 m_pBreak->SetCharSpace(font.GetLetterSpacing()); |
804 } | 804 } |
805 FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, NULL); | 805 FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, NULL); |
806 m_pBreak->SetFontSize(fFontSize); | 806 m_pBreak->SetFontSize(fFontSize); |
807 m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, NULL)); | 807 m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, NULL)); |
808 m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f); | 808 m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f); |
809 } | 809 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 } | 861 } |
862 } | 862 } |
863 FDE_CSSRECT pNewRect; | 863 FDE_CSSRECT pNewRect; |
864 pNewRect.left.Set(FDE_CSSLENGTHUNIT_Point, fStart); | 864 pNewRect.left.Set(FDE_CSSLENGTHUNIT_Point, fStart); |
865 pNewRect.right.Set(FDE_CSSLENGTHUNIT_Point, pRect->right.GetValue()); | 865 pNewRect.right.Set(FDE_CSSLENGTHUNIT_Point, pRect->right.GetValue()); |
866 pNewRect.top.Set(FDE_CSSLENGTHUNIT_Point, pRect->top.GetValue()); | 866 pNewRect.top.Set(FDE_CSSLENGTHUNIT_Point, pRect->top.GetValue()); |
867 pNewRect.bottom.Set(FDE_CSSLENGTHUNIT_Point, pRect->bottom.GetValue()); | 867 pNewRect.bottom.Set(FDE_CSSLENGTHUNIT_Point, pRect->bottom.GetValue()); |
868 pStyle->GetBoundaryStyles()->SetMarginWidth(pNewRect); | 868 pStyle->GetBoundaryStyles()->SetMarginWidth(pNewRect); |
869 } | 869 } |
870 } | 870 } |
871 m_pBreak->SetLineWidth(fStart, fLineWidth); | 871 m_pBreak->SetLineBoundary(fStart, fLineWidth); |
872 FX_FLOAT fIndent = pParaStyle->GetTextIndent().GetValue(); | 872 FX_FLOAT fIndent = pParaStyle->GetTextIndent().GetValue(); |
873 if (fIndent > 0) { | 873 if (fIndent > 0) { |
874 fStart += fIndent; | 874 fStart += fIndent; |
875 } | 875 } |
876 m_pBreak->SetLinePos(fStart); | 876 m_pBreak->SetLineStartPos(fStart); |
877 m_pBreak->SetTabWidth(m_textParser.GetTabInterval(pStyle)); | 877 m_pBreak->SetTabWidth(m_textParser.GetTabInterval(pStyle)); |
878 if (m_pTabstopContext == NULL) { | 878 if (m_pTabstopContext == NULL) { |
879 m_pTabstopContext = new CXFA_TextTabstopsContext; | 879 m_pTabstopContext = new CXFA_TextTabstopsContext; |
880 } | 880 } |
881 m_textParser.GetTabstops(pStyle, m_pTabstopContext); | 881 m_textParser.GetTabstops(pStyle, m_pTabstopContext); |
882 for (int32_t i = 0; i < m_pTabstopContext->m_iTabCount; i++) { | 882 for (int32_t i = 0; i < m_pTabstopContext->m_iTabCount; i++) { |
883 XFA_TABSTOPS* pTab = m_pTabstopContext->m_tabstops.GetDataPtr(i); | 883 XFA_TABSTOPS* pTab = m_pTabstopContext->m_tabstops.GetDataPtr(i); |
884 m_pBreak->AddPositionedTab(pTab->fTabstops); | 884 m_pBreak->AddPositionedTab(pTab->fTabstops); |
885 } | 885 } |
886 } | 886 } |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 if (para.IsExistInXML()) { | 1833 if (para.IsExistInXML()) { |
1834 FX_FLOAT fStartPos = para.GetMarginLeft(); | 1834 FX_FLOAT fStartPos = para.GetMarginLeft(); |
1835 FX_FLOAT fIndent = para.GetTextIndent(); | 1835 FX_FLOAT fIndent = para.GetTextIndent(); |
1836 if (fIndent > 0) { | 1836 if (fIndent > 0) { |
1837 fStartPos += fIndent; | 1837 fStartPos += fIndent; |
1838 } | 1838 } |
1839 FX_FLOAT fSpaceBelow = para.GetSpaceBelow(); | 1839 FX_FLOAT fSpaceBelow = para.GetSpaceBelow(); |
1840 if (fSpaceBelow < 0.1f) { | 1840 if (fSpaceBelow < 0.1f) { |
1841 fSpaceBelow = 0; | 1841 fSpaceBelow = 0; |
1842 } | 1842 } |
1843 m_pBreak->SetLinePos(fStartPos); | 1843 m_pBreak->SetLineStartPos(fStartPos); |
1844 fLinePos += fSpaceBelow; | 1844 fLinePos += fSpaceBelow; |
1845 } | 1845 } |
1846 } | 1846 } |
1847 } | 1847 } |
1848 if (pStyle) { | 1848 if (pStyle) { |
1849 FX_FLOAT fStart = 0; | 1849 FX_FLOAT fStart = 0; |
1850 const FDE_CSSRECT* pRect = pStyle->GetBoundaryStyles()->GetMarginWidth(); | 1850 const FDE_CSSRECT* pRect = pStyle->GetBoundaryStyles()->GetMarginWidth(); |
1851 if (pRect) { | 1851 if (pRect) { |
1852 fStart = pRect->left.GetValue(); | 1852 fStart = pRect->left.GetValue(); |
1853 } | 1853 } |
1854 FX_FLOAT fTextIndent = | 1854 FX_FLOAT fTextIndent = |
1855 pStyle->GetParagraphStyles()->GetTextIndent().GetValue(); | 1855 pStyle->GetParagraphStyles()->GetTextIndent().GetValue(); |
1856 if (fTextIndent < 0) { | 1856 if (fTextIndent < 0) { |
1857 fStart -= fTextIndent; | 1857 fStart -= fTextIndent; |
1858 } | 1858 } |
1859 m_pBreak->SetLinePos(fStart); | 1859 m_pBreak->SetLineStartPos(fStart); |
1860 pStyle->Release(); | 1860 pStyle->Release(); |
1861 } | 1861 } |
1862 m_iLines++; | 1862 m_iLines++; |
1863 } | 1863 } |
1864 void CXFA_TextLayout::RenderString(IFDE_RenderDevice* pDevice, | 1864 void CXFA_TextLayout::RenderString(IFDE_RenderDevice* pDevice, |
1865 IFDE_SolidBrush* pBrush, | 1865 IFDE_SolidBrush* pBrush, |
1866 CXFA_PieceLine* pPieceLine, | 1866 CXFA_PieceLine* pPieceLine, |
1867 int32_t iPiece, | 1867 int32_t iPiece, |
1868 FXTEXT_CHARPOS* pCharPos, | 1868 FXTEXT_CHARPOS* pCharPos, |
1869 const CFX_Matrix& tmDoc2Device) { | 1869 const CFX_Matrix& tmDoc2Device) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 tr.iLength = iLength; | 2013 tr.iLength = iLength; |
2014 tr.fFontSize = pPiece->fFontSize; | 2014 tr.fFontSize = pPiece->fFontSize; |
2015 tr.iBidiLevel = pPiece->iBidiLevel; | 2015 tr.iBidiLevel = pPiece->iBidiLevel; |
2016 tr.iCharRotation = 0; | 2016 tr.iCharRotation = 0; |
2017 tr.wLineBreakChar = L'\n'; | 2017 tr.wLineBreakChar = L'\n'; |
2018 tr.iVerticalScale = pPiece->iVerScale; | 2018 tr.iVerticalScale = pPiece->iVerScale; |
2019 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 2019 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
2020 tr.iHorizontalScale = pPiece->iHorScale; | 2020 tr.iHorizontalScale = pPiece->iHorScale; |
2021 return TRUE; | 2021 return TRUE; |
2022 } | 2022 } |
OLD | NEW |