| 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_rtfbreak.h" | 7 #include "xfa/fgas/layout/fgas_rtfbreak.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 if (!bEmptyChar) { | 1312 if (!bEmptyChar) { |
| 1313 CFX_PointF ptOffset; | 1313 CFX_PointF ptOffset; |
| 1314 bool bAdjusted = false; | 1314 bool bAdjusted = false; |
| 1315 if (pAdjustPos) { | 1315 if (pAdjustPos) { |
| 1316 bAdjusted = pAdjustPos(wForm, bMBCSCode, pFont, fFontSize, | 1316 bAdjusted = pAdjustPos(wForm, bMBCSCode, pFont, fFontSize, |
| 1317 bVerticalChar, ptOffset); | 1317 bVerticalChar, ptOffset); |
| 1318 } | 1318 } |
| 1319 if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) { | 1319 if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) { |
| 1320 CFX_Rect rtBBox; | 1320 CFX_Rect rtBBox; |
| 1321 rtBBox.Reset(); | 1321 rtBBox.Reset(); |
| 1322 if (pFont->GetCharBBox(wForm, rtBBox, bMBCSCode)) { | 1322 if (pFont->GetCharBBox(wForm, &rtBBox, bMBCSCode)) { |
| 1323 ptOffset.x = fFontSize * (850 - rtBBox.right()) / 1000.0f; | 1323 ptOffset.x = fFontSize * (850 - rtBBox.right()) / 1000.0f; |
| 1324 ptOffset.y = fFontSize * (1000 - rtBBox.height) / 2000.0f; | 1324 ptOffset.y = fFontSize * (1000 - rtBBox.height) / 2000.0f; |
| 1325 } | 1325 } |
| 1326 } | 1326 } |
| 1327 pCharPos->m_OriginX = fX + ptOffset.x; | 1327 pCharPos->m_OriginX = fX + ptOffset.x; |
| 1328 pCharPos->m_OriginY = fY - ptOffset.y; | 1328 pCharPos->m_OriginY = fY - ptOffset.y; |
| 1329 } | 1329 } |
| 1330 if (!bRTLPiece && dwCharType != FX_CHARTYPE_Combination) { | 1330 if (!bRTLPiece && dwCharType != FX_CHARTYPE_Combination) { |
| 1331 if (bVerticalDoc) { | 1331 if (bVerticalDoc) { |
| 1332 fY += fCharHeight; | 1332 fY += fCharHeight; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 FX_FLOAT fFontSize = pText->fFontSize; | 1429 FX_FLOAT fFontSize = pText->fFontSize; |
| 1430 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); | 1430 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); |
| 1431 FX_FLOAT fScale = fFontSize / 1000.0f; | 1431 FX_FLOAT fScale = fFontSize / 1000.0f; |
| 1432 CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont; | 1432 CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont; |
| 1433 if (!pFont) | 1433 if (!pFont) |
| 1434 bCharBBox = false; | 1434 bCharBBox = false; |
| 1435 | 1435 |
| 1436 CFX_Rect bbox; | 1436 CFX_Rect bbox; |
| 1437 bbox.Set(0, 0, 0, 0); | 1437 bbox.Set(0, 0, 0, 0); |
| 1438 if (bCharBBox) | 1438 if (bCharBBox) |
| 1439 bCharBBox = pFont->GetBBox(bbox); | 1439 bCharBBox = pFont->GetBBox(&bbox); |
| 1440 | 1440 |
| 1441 FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale); | 1441 FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale); |
| 1442 FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); | 1442 FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); |
| 1443 rtArray.RemoveAll(); | 1443 rtArray.RemoveAll(); |
| 1444 rtArray.SetSize(iLength); | 1444 rtArray.SetSize(iLength); |
| 1445 uint32_t dwStyles = pText->dwLayoutStyles; | 1445 uint32_t dwStyles = pText->dwLayoutStyles; |
| 1446 bool bVertical = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0; | 1446 bool bVertical = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0; |
| 1447 bool bSingleLine = (dwStyles & FX_RTFLAYOUTSTYLE_SingleLine) != 0; | 1447 bool bSingleLine = (dwStyles & FX_RTFLAYOUTSTYLE_SingleLine) != 0; |
| 1448 bool bCombText = (dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; | 1448 bool bCombText = (dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; |
| 1449 FX_WCHAR wch, wLineBreakChar = pText->wLineBreakChar; | 1449 FX_WCHAR wch, wLineBreakChar = pText->wLineBreakChar; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 fFontSize(12.0f), | 1559 fFontSize(12.0f), |
| 1560 dwLayoutStyles(0), | 1560 dwLayoutStyles(0), |
| 1561 iCharRotation(0), | 1561 iCharRotation(0), |
| 1562 iBidiLevel(0), | 1562 iBidiLevel(0), |
| 1563 pRect(nullptr), | 1563 pRect(nullptr), |
| 1564 wLineBreakChar(L'\n'), | 1564 wLineBreakChar(L'\n'), |
| 1565 iHorizontalScale(100), | 1565 iHorizontalScale(100), |
| 1566 iVerticalScale(100) {} | 1566 iVerticalScale(100) {} |
| 1567 | 1567 |
| 1568 FX_RTFTEXTOBJ::~FX_RTFTEXTOBJ() {} | 1568 FX_RTFTEXTOBJ::~FX_RTFTEXTOBJ() {} |
| OLD | NEW |