| 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 "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 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; | 1461 FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; |
| 1462 if (bVerticalDoc) { | 1462 if (bVerticalDoc) { |
| 1463 pCharPos->m_OriginY += fOffset; | 1463 pCharPos->m_OriginY += fOffset; |
| 1464 } else { | 1464 } else { |
| 1465 pCharPos->m_OriginX += fOffset; | 1465 pCharPos->m_OriginX += fOffset; |
| 1466 } | 1466 } |
| 1467 } | 1467 } |
| 1468 if (chartype == FX_CHARTYPE_Combination) { | 1468 if (chartype == FX_CHARTYPE_Combination) { |
| 1469 CFX_Rect rtBBox; | 1469 CFX_Rect rtBBox; |
| 1470 rtBBox.Reset(); | 1470 rtBBox.Reset(); |
| 1471 if (pFont->GetCharBBox(wForm, rtBBox, false)) { | 1471 if (pFont->GetCharBBox(wForm, &rtBBox, false)) { |
| 1472 pCharPos->m_OriginY = | 1472 pCharPos->m_OriginY = |
| 1473 fYBase + fFontSize - | 1473 fYBase + fFontSize - |
| 1474 fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; | 1474 fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; |
| 1475 } | 1475 } |
| 1476 if (wForm == wch && wLast != 0xFEFF) { | 1476 if (wForm == wch && wLast != 0xFEFF) { |
| 1477 uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); | 1477 uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); |
| 1478 if ((dwLastProps & FX_CHARTYPEBITSMASK) == | 1478 if ((dwLastProps & FX_CHARTYPEBITSMASK) == |
| 1479 FX_CHARTYPE_Combination) { | 1479 FX_CHARTYPE_Combination) { |
| 1480 CFX_Rect rtBox; | 1480 CFX_Rect rtBox; |
| 1481 rtBox.Reset(); | 1481 rtBox.Reset(); |
| 1482 if (pFont->GetCharBBox(wLast, rtBox, false)) { | 1482 if (pFont->GetCharBBox(wLast, &rtBox, false)) { |
| 1483 pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; | 1483 pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; |
| 1484 } | 1484 } |
| 1485 } | 1485 } |
| 1486 } | 1486 } |
| 1487 } | 1487 } |
| 1488 CFX_PointF ptOffset; | 1488 CFX_PointF ptOffset; |
| 1489 bool bAdjusted = false; | 1489 bool bAdjusted = false; |
| 1490 if (pAdjustPos) { | 1490 if (pAdjustPos) { |
| 1491 bAdjusted = pAdjustPos(wForm, bCharCode, pFont, fFontSize, | 1491 bAdjusted = pAdjustPos(wForm, bCharCode, pFont, fFontSize, |
| 1492 bVerticalChar, ptOffset); | 1492 bVerticalChar, ptOffset); |
| 1493 } | 1493 } |
| 1494 if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) { | 1494 if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) { |
| 1495 CFX_Rect rtBBox; | 1495 CFX_Rect rtBBox; |
| 1496 rtBBox.Reset(); | 1496 rtBBox.Reset(); |
| 1497 if (pFont->GetCharBBox(wForm, rtBBox, false)) { | 1497 if (pFont->GetCharBBox(wForm, &rtBBox, false)) { |
| 1498 ptOffset.x = fFontSize * (850 - rtBBox.right()) / iMaxHeight; | 1498 ptOffset.x = fFontSize * (850 - rtBBox.right()) / iMaxHeight; |
| 1499 ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight; | 1499 ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight; |
| 1500 } | 1500 } |
| 1501 } | 1501 } |
| 1502 pCharPos->m_OriginX += ptOffset.x; | 1502 pCharPos->m_OriginX += ptOffset.x; |
| 1503 pCharPos->m_OriginY -= ptOffset.y; | 1503 pCharPos->m_OriginY -= ptOffset.y; |
| 1504 } | 1504 } |
| 1505 if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) { | 1505 if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) { |
| 1506 if (bVerticalDoc) { | 1506 if (bVerticalDoc) { |
| 1507 fY += fCharHeight; | 1507 fY += fCharHeight; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 FX_FLOAT fFontSize = pTxtRun->fFontSize; | 1603 FX_FLOAT fFontSize = pTxtRun->fFontSize; |
| 1604 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); | 1604 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); |
| 1605 FX_FLOAT fScale = fFontSize / 1000.0f; | 1605 FX_FLOAT fScale = fFontSize / 1000.0f; |
| 1606 CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; | 1606 CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; |
| 1607 if (!pFont) | 1607 if (!pFont) |
| 1608 bCharBBox = false; | 1608 bCharBBox = false; |
| 1609 | 1609 |
| 1610 CFX_Rect bbox; | 1610 CFX_Rect bbox; |
| 1611 bbox.Set(0, 0, 0, 0); | 1611 bbox.Set(0, 0, 0, 0); |
| 1612 if (bCharBBox) | 1612 if (bCharBBox) |
| 1613 bCharBBox = pFont->GetBBox(bbox); | 1613 bCharBBox = pFont->GetBBox(&bbox); |
| 1614 | 1614 |
| 1615 FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale); | 1615 FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale); |
| 1616 FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); | 1616 FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); |
| 1617 rtArray.RemoveAll(); | 1617 rtArray.RemoveAll(); |
| 1618 rtArray.SetSize(iLength); | 1618 rtArray.SetSize(iLength); |
| 1619 bool bVertical = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; | 1619 bool bVertical = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; |
| 1620 bool bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0; | 1620 bool bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0; |
| 1621 bool bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; | 1621 bool bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; |
| 1622 FX_WCHAR wch, wLineBreakChar = pTxtRun->wLineBreakChar; | 1622 FX_WCHAR wch, wLineBreakChar = pTxtRun->wLineBreakChar; |
| 1623 int32_t iCharSize; | 1623 int32_t iCharSize; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) | 1734 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) |
| 1735 : m_pLineChars(new CFX_TxtCharArray), | 1735 : m_pLineChars(new CFX_TxtCharArray), |
| 1736 m_pLinePieces(new CFX_TxtPieceArray(16)), | 1736 m_pLinePieces(new CFX_TxtPieceArray(16)), |
| 1737 m_iStart(0), | 1737 m_iStart(0), |
| 1738 m_iWidth(0), | 1738 m_iWidth(0), |
| 1739 m_iArabicChars(0) {} | 1739 m_iArabicChars(0) {} |
| 1740 | 1740 |
| 1741 CFX_TxtLine::~CFX_TxtLine() { | 1741 CFX_TxtLine::~CFX_TxtLine() { |
| 1742 RemoveAll(); | 1742 RemoveAll(); |
| 1743 } | 1743 } |
| OLD | NEW |