Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: xfa/fgas/layout/fgas_textbreak.cpp

Issue 2362063003: Clean up xfa_fontmgr.cpp. (Closed)
Patch Set: nits Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "xfa/fgas/layout/fgas_textbreak.h" 7 #include "xfa/fgas/layout/fgas_textbreak.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 return std::max(dwRet1, dwRet2); 636 return std::max(dwRet1, dwRet2);
637 } 637 }
638 638
639 void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { 639 void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
640 ASSERT(m_bArabicShapes); 640 ASSERT(m_bArabicShapes);
641 int32_t iCount = m_pCurLine->CountChars(); 641 int32_t iCount = m_pCurLine->CountChars();
642 if (iCount < 2) { 642 if (iCount < 2) {
643 return; 643 return;
644 } 644 }
645 int32_t& iLineWidth = m_pCurLine->m_iWidth; 645 int32_t& iLineWidth = m_pCurLine->m_iWidth;
646 CFX_Char *pCur, *pNext; 646 CFX_Char* pCur = m_pCurLine->GetCharPtr(0);
647 pCur = m_pCurLine->GetCharPtr(0);
648 FX_BOOL bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; 647 FX_BOOL bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
649 pCur = m_pCurLine->GetCharPtr(1); 648 pCur = m_pCurLine->GetCharPtr(1);
650 FX_WCHAR wch, wForm; 649 FX_WCHAR wch, wForm;
651 FX_BOOL bNextNum; 650 FX_BOOL bNextNum;
652 int32_t i = 1, iCharWidth, iRotation; 651 int32_t i = 1;
652 int32_t iCharWidth;
653 int32_t iRotation;
654 CFX_Char* pNext;
653 do { 655 do {
654 i++; 656 i++;
655 if (i < iCount) { 657 if (i < iCount) {
656 pNext = m_pCurLine->GetCharPtr(i); 658 pNext = m_pCurLine->GetCharPtr(i);
657 bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; 659 bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
658 } else { 660 } else {
659 pNext = nullptr; 661 pNext = nullptr;
660 bNextNum = FALSE; 662 bNextNum = FALSE;
661 } 663 }
662 wch = pCur->m_wCharCode; 664 wch = pCur->m_wCharCode;
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 if (bRTLPiece) { 1664 if (bRTLPiece) {
1663 rect.left -= fCharSize; 1665 rect.left -= fCharSize;
1664 fStart -= fCharSize; 1666 fStart -= fCharSize;
1665 } else { 1667 } else {
1666 fStart += fCharSize; 1668 fStart += fCharSize;
1667 } 1669 }
1668 rect.width = fCharSize; 1670 rect.width = fCharSize;
1669 } 1671 }
1670 if (bCharBBox && !bRet) { 1672 if (bCharBBox && !bRet) {
1671 int32_t iCharWidth = 1000; 1673 int32_t iCharWidth = 1000;
1672 pFont->GetCharWidth(wch, iCharWidth); 1674 pFont->GetCharWidth(wch, iCharWidth, false);
1673 FX_FLOAT fRTLeft = 0, fCharWidth = 0; 1675 FX_FLOAT fRTLeft = 0, fCharWidth = 0;
1674 if (iCharWidth > 0) { 1676 if (iCharWidth > 0) {
1675 fCharWidth = iCharWidth * fScale; 1677 fCharWidth = iCharWidth * fScale;
1676 fRTLeft = fLeft; 1678 fRTLeft = fLeft;
1677 if (bCombText) { 1679 if (bCombText) {
1678 fRTLeft = (rect.width - fCharWidth) / 2.0f; 1680 fRTLeft = (rect.width - fCharWidth) / 2.0f;
1679 } 1681 }
1680 } 1682 }
1681 CFX_RectF rtBBoxF; 1683 CFX_RectF rtBBoxF;
1682 if (bVertical) { 1684 if (bVertical) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) 1739 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize)
1738 : m_pLineChars(new CFX_TxtCharArray), 1740 : m_pLineChars(new CFX_TxtCharArray),
1739 m_pLinePieces(new CFX_TxtPieceArray(16)), 1741 m_pLinePieces(new CFX_TxtPieceArray(16)),
1740 m_iStart(0), 1742 m_iStart(0),
1741 m_iWidth(0), 1743 m_iWidth(0),
1742 m_iArabicChars(0) {} 1744 m_iArabicChars(0) {}
1743 1745
1744 CFX_TxtLine::~CFX_TxtLine() { 1746 CFX_TxtLine::~CFX_TxtLine() {
1745 RemoveAll(); 1747 RemoveAll();
1746 } 1748 }
OLDNEW
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698