diff options
-rw-r--r-- | core/fpdfapi/render/cpdf_charposlist.cpp | 32 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 4 | ||||
-rw-r--r-- | core/fxge/apple/fx_apple_platform.cpp | 8 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.h | 10 | ||||
-rw-r--r-- | core/fxge/ge/cfx_renderdevice.cpp | 24 | ||||
-rw-r--r-- | core/fxge/ifx_renderdevicedriver.h | 2 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 9 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.h | 2 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device_unittest.cpp | 3 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 2 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.h | 2 | ||||
-rw-r--r-- | core/fxge/win32/win32_int.h | 2 | ||||
-rw-r--r-- | xfa/fde/fde_visualset.h | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.cpp | 102 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_textbreak.cpp | 44 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OneDimWriter.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 34 | ||||
-rw-r--r-- | xfa/fxgraphics/cfx_graphics.cpp | 6 |
18 files changed, 150 insertions, 144 deletions
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp index 64176fb054..639bdcf17b 100644 --- a/core/fpdfapi/render/cpdf_charposlist.cpp +++ b/core/fpdfapi/render/cpdf_charposlist.cpp @@ -32,10 +32,12 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes, uint32_t CharCode = charCodes[iChar]; if (CharCode == static_cast<uint32_t>(-1)) continue; + bool bVert = false; FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++]; if (pCIDFont) charpos.m_bFontStyle = true; + charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert); if (charpos.m_GlyphIndex != static_cast<uint32_t>(-1)) { charpos.m_FallbackFontPosition = -1; @@ -45,39 +47,41 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes, charpos.m_GlyphIndex = pFont->FallbackGlyphFromCharcode( charpos.m_FallbackFontPosition, CharCode); } + // TODO(npm): Figure out how this affects m_ExtGID #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode); #endif - if (!pFont->IsEmbedded() && !pFont->IsCIDFont()) { + if (!pFont->IsEmbedded() && !pFont->IsCIDFont()) charpos.m_FontCharWidth = pFont->GetCharWidthF(CharCode); - } else { + else charpos.m_FontCharWidth = 0; - } - charpos.m_OriginX = iChar ? charPos[iChar - 1] : 0; - charpos.m_OriginY = 0; + + charpos.m_Origin = CFX_PointF(iChar ? charPos[iChar - 1] : 0, 0); charpos.m_bGlyphAdjust = false; - if (!pCIDFont) { + if (!pCIDFont) continue; - } + uint16_t CID = pCIDFont->CIDFromCharCode(CharCode); if (bVertWriting) { - charpos.m_OriginY = charpos.m_OriginX; - charpos.m_OriginX = 0; - short vx, vy; + charpos.m_Origin = CFX_PointF(0, charpos.m_Origin.x); + + short vx; + short vy; pCIDFont->GetVertOrigin(CID, vx, vy); - charpos.m_OriginX -= FontSize * vx / 1000; - charpos.m_OriginY -= FontSize * vy / 1000; + charpos.m_Origin.x -= FontSize * vx / 1000; + charpos.m_Origin.y -= FontSize * vy / 1000; } + const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID); if (pTransform && !bVert) { charpos.m_AdjustMatrix[0] = pCIDFont->CIDTransformToFloat(pTransform[0]); charpos.m_AdjustMatrix[2] = pCIDFont->CIDTransformToFloat(pTransform[2]); charpos.m_AdjustMatrix[1] = pCIDFont->CIDTransformToFloat(pTransform[1]); charpos.m_AdjustMatrix[3] = pCIDFont->CIDTransformToFloat(pTransform[3]); - charpos.m_OriginX += + charpos.m_Origin.x += pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; - charpos.m_OriginY += + charpos.m_Origin.y += pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; charpos.m_bGlyphAdjust = true; } diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 60b57600c2..fd44d42484 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -2001,8 +2001,8 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); } - matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_OriginX, - charpos.m_OriginY)); + matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_Origin.x, + charpos.m_Origin.y)); path.m_Path.Append(pPath, &matrix); path.m_Matrix = *pTextMatrix; path.m_bStroke = bStroke; diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index d6867384e6..f576eb0ba2 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -39,9 +39,7 @@ bool CGDrawGlyphRun(CGContextRef pContext, if (bNegSize) font_size = -font_size; - FX_FLOAT ori_x = pCharPos[0].m_OriginX, ori_y = pCharPos[0].m_OriginY; CFX_Matrix new_matrix; - new_matrix.TransformPoint(ori_x, ori_y); if (pObject2Device) new_matrix.Concat(*pObject2Device); @@ -63,10 +61,10 @@ bool CGDrawGlyphRun(CGContextRef pContext, glyph_indices[i] = pCharPos[i].m_ExtGID ? pCharPos[i].m_ExtGID : pCharPos[i].m_GlyphIndex; if (bNegSize) - glyph_positions[i].x = -pCharPos[i].m_OriginX; + glyph_positions[i].x = -pCharPos[i].m_Origin.x; else - glyph_positions[i].x = pCharPos[i].m_OriginX; - glyph_positions[i].y = pCharPos[i].m_OriginY; + glyph_positions[i].x = pCharPos[i].m_Origin.x; + glyph_positions[i].y = pCharPos[i].m_Origin.y; } if (bNegSize) { new_matrix.a = -new_matrix.a; diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 2144206e19..2e9abf9963 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -62,10 +62,14 @@ class IFX_RenderDeviceDriver; enum class FXPT_TYPE : uint8_t { LineTo, BezierTo, MoveTo }; -struct FXTEXT_CHARPOS { +class FXTEXT_CHARPOS { + public: + FXTEXT_CHARPOS(); + FXTEXT_CHARPOS(const FXTEXT_CHARPOS&); + ~FXTEXT_CHARPOS(); + FX_FLOAT m_AdjustMatrix[4]; - FX_FLOAT m_OriginX; - FX_FLOAT m_OriginY; + CFX_PointF m_Origin; uint32_t m_GlyphIndex; int32_t m_FontCharWidth; #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index d2c677ecc2..f2bf48912c 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -346,6 +346,21 @@ bool ShouldDrawDeviceText(const CFX_Font* pFont, uint32_t text_flags) { } // namespace +FXTEXT_CHARPOS::FXTEXT_CHARPOS() + : m_GlyphIndex(0), + m_FontCharWidth(0), +#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ + m_ExtGID(0), +#endif + m_FallbackFontPosition(0), + m_bGlyphAdjust(false), + m_bFontStyle(false) { +} + +FXTEXT_CHARPOS::FXTEXT_CHARPOS(const FXTEXT_CHARPOS&) = default; + +FXTEXT_CHARPOS::~FXTEXT_CHARPOS(){}; + CFX_RenderDevice::CFX_RenderDevice() : m_pBitmap(nullptr), m_Width(0), @@ -912,8 +927,9 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, for (size_t i = 0; i < glyphs.size(); ++i) { FXTEXT_GLYPHPOS& glyph = glyphs[i]; const FXTEXT_CHARPOS& charpos = pCharPos[i]; - glyph.m_fOriginX = charpos.m_OriginX; - glyph.m_fOriginY = charpos.m_OriginY; + glyph.m_fOriginX = charpos.m_Origin.x; + glyph.m_fOriginY = charpos.m_Origin.y; + text2Device.TransformPoint(glyph.m_fOriginX, glyph.m_fOriginY); if (anti_alias < FXFT_RENDER_MODE_LCD) glyph.m_OriginX = FXSYS_round(glyph.m_fOriginX); @@ -1069,8 +1085,8 @@ bool CFX_RenderDevice::DrawTextPath(int nChars, charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); } - matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_OriginX, - charpos.m_OriginY)); + matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_Origin.x, + charpos.m_Origin.y)); const CFX_PathData* pPath = pFont->LoadGlyphPath(charpos.m_GlyphIndex, charpos.m_FontCharWidth); if (!pPath) diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h index 6a5b63ba32..fd35149e42 100644 --- a/core/fxge/ifx_renderdevicedriver.h +++ b/core/fxge/ifx_renderdevicedriver.h @@ -16,8 +16,8 @@ class CFX_GraphStateData; class CFX_Matrix; class CFX_PathData; class CPDF_ShadingPattern; +class FXTEXT_CHARPOS; class IFX_Pause; -struct FXTEXT_CHARPOS; struct FX_RECT; class IFX_RenderDeviceDriver { diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 8263cf66f5..431491d826 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -802,8 +802,9 @@ class SkiaState { vFlip *= -1; for (int index = 0; index < nChars; ++index) { const FXTEXT_CHARPOS& cp = pCharPos[index]; - m_positions[index + count] = {cp.m_OriginX * flip, cp.m_OriginY * vFlip}; - m_glyphs[index + count] = (uint16_t)cp.m_GlyphIndex; + m_positions[index + count] = {cp.m_Origin.x * flip, + cp.m_Origin.y * vFlip}; + m_glyphs[index + count] = static_cast<uint16_t>(cp.m_GlyphIndex); } SkPoint delta; if (MatrixOffset(pMatrix, &delta)) { @@ -1289,8 +1290,8 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, glyphs.setCount(nChars); for (int index = 0; index < nChars; ++index) { const FXTEXT_CHARPOS& cp = pCharPos[index]; - positions[index] = {cp.m_OriginX * flip, cp.m_OriginY * vFlip}; - glyphs[index] = (uint16_t)cp.m_GlyphIndex; + positions[index] = {cp.m_Origin.x * flip, cp.m_Origin.y * vFlip}; + glyphs[index] = static_cast<uint16_t>(cp.m_GlyphIndex); } #ifdef _SKIA_SUPPORT_PATHS_ m_pBitmap->PreMultiply(); diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index ff81daef46..ecb1104518 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -13,13 +13,13 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/ifx_renderdevicedriver.h" +class FXTEXT_CHARPOS; class SkCanvas; class SkMatrix; class SkPaint; class SkPath; class SkPictureRecorder; class SkiaState; -struct FXTEXT_CHARPOS; struct SkIRect; class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp index 3b799e6190..afd47780d7 100644 --- a/core/fxge/skia/fx_skia_device_unittest.cpp +++ b/core/fxge/skia/fx_skia_device_unittest.cpp @@ -36,8 +36,7 @@ void EmptyTest(CFX_SkiaDeviceDriver* driver, const State&) { void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) { FXTEXT_CHARPOS charPos[1]; - charPos[0].m_OriginX = 0; - charPos[0].m_OriginY = 1; + charPos[0].m_Origin = CFX_PointF(0, 1); charPos[0].m_GlyphIndex = 1; charPos[0].m_FontCharWidth = 4; diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index d5f1f4d91c..32da090ed6 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -662,7 +662,7 @@ bool CFX_PSRenderer::DrawText(int nChars, buf << "/X" << ps_fontnum << " Ff " << font_size << " Fs Sf "; last_fontnum = ps_fontnum; } - buf << pCharPos[i].m_OriginX << " " << pCharPos[i].m_OriginY << " m"; + buf << pCharPos[i].m_Origin.x << " " << pCharPos[i].m_Origin.y << " m"; CFX_ByteString hex; hex.Format("<%02X>", ps_glyphindex); buf << hex.AsStringC() << "Tj\n"; diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h index e941739f44..163c6180af 100644 --- a/core/fxge/win32/cfx_psrenderer.h +++ b/core/fxge/win32/cfx_psrenderer.h @@ -22,7 +22,7 @@ class CFX_FontCache; class CFX_Matrix; class CFX_PathData; class CPSFont; -struct FXTEXT_CHARPOS; +class FXTEXT_CHARPOS; class CFX_PSRenderer { public: diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index 974a1200e6..f8eae87308 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -17,7 +17,7 @@ #include "core/fxge/win32/cpsoutput.h" #include "core/fxge/win32/dwrite_int.h" -struct FXTEXT_CHARPOS; +class FXTEXT_CHARPOS; struct WINDIB_Open_Args_; typedef HANDLE(__stdcall* FuncType_GdiAddFontMemResourceEx)(PVOID pbFont, diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h index 0c6341fead..3260caee79 100644 --- a/xfa/fde/fde_visualset.h +++ b/xfa/fde/fde_visualset.h @@ -17,7 +17,7 @@ #include "xfa/fde/fde_object.h" #include "xfa/fgas/font/cfgas_fontmgr.h" -struct FXTEXT_CHARPOS; +class FXTEXT_CHARPOS; enum FDE_VISUALOBJTYPE { FDE_VISUALOBJ_Canvas = 0x00, diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 62e33fe9c2..24436ecf1f 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -1307,76 +1307,62 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, ptOffset.y = fFontSize * (1000 - rtBBox.height) / 2000.0f; } } - pCharPos->m_OriginX = fX + ptOffset.x; - pCharPos->m_OriginY = fY - ptOffset.y; + pCharPos->m_Origin = CFX_PointF(fX + ptOffset.x, fY - ptOffset.y); } if (!bRTLPiece && dwCharType != FX_CHARTYPE_Combination) { - if (bVerticalDoc) { + if (bVerticalDoc) fY += fCharHeight; - } else { + else fX += fCharWidth; - } } if (!bEmptyChar) { pCharPos->m_bGlyphAdjust = true; + + if (iCharRotation == 0) { + pCharPos->m_AdjustMatrix[0] = -1; + pCharPos->m_AdjustMatrix[1] = 0; + pCharPos->m_AdjustMatrix[2] = 0; + pCharPos->m_AdjustMatrix[3] = 1; + pCharPos->m_Origin.y += fAscent * iVerScale / 100.0f; + } else if (iCharRotation == 1) { + pCharPos->m_AdjustMatrix[0] = 0; + pCharPos->m_AdjustMatrix[1] = -1; + pCharPos->m_AdjustMatrix[2] = -1; + pCharPos->m_AdjustMatrix[3] = 0; + pCharPos->m_Origin.x -= fDescent; + } else if (iCharRotation == 2) { + pCharPos->m_AdjustMatrix[0] = 1; + pCharPos->m_AdjustMatrix[1] = 0; + pCharPos->m_AdjustMatrix[2] = 0; + pCharPos->m_AdjustMatrix[3] = -1; + pCharPos->m_Origin.x += fCharWidth; + } else { + pCharPos->m_AdjustMatrix[0] = 0; + pCharPos->m_AdjustMatrix[1] = 1; + pCharPos->m_AdjustMatrix[2] = 1; + pCharPos->m_AdjustMatrix[3] = 0; + } + if (bVerticalDoc) { - if (iCharRotation == 0) { - pCharPos->m_AdjustMatrix[0] = -1; - pCharPos->m_AdjustMatrix[1] = 0; - pCharPos->m_AdjustMatrix[2] = 0; - pCharPos->m_AdjustMatrix[3] = 1; - pCharPos->m_OriginY += fAscent * iVerScale / 100.0f; - } else if (iCharRotation == 1) { - pCharPos->m_AdjustMatrix[0] = 0; - pCharPos->m_AdjustMatrix[1] = -1; - pCharPos->m_AdjustMatrix[2] = -1; - pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX -= - fDescent + fAscent * iVerScale / 100.0f - fAscent; + if (iCharRotation == 1) { + pCharPos->m_Origin.x -= fAscent * iVerScale / 100.0f - fAscent; } else if (iCharRotation == 2) { - pCharPos->m_AdjustMatrix[0] = 1; - pCharPos->m_AdjustMatrix[1] = 0; - pCharPos->m_AdjustMatrix[2] = 0; - pCharPos->m_AdjustMatrix[3] = -1; - pCharPos->m_OriginX += fCharWidth; - pCharPos->m_OriginY += fAscent; - } else { - pCharPos->m_AdjustMatrix[0] = 0; - pCharPos->m_AdjustMatrix[1] = 1; - pCharPos->m_AdjustMatrix[2] = 1; - pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX += fAscent; - pCharPos->m_OriginY += fCharWidth; + pCharPos->m_Origin.y += fAscent; + } else if (iCharRotation != 0) { + pCharPos->m_Origin.x += fAscent; + pCharPos->m_Origin.y += fCharWidth; } } else { - if (iCharRotation == 0) { - pCharPos->m_AdjustMatrix[0] = -1; - pCharPos->m_AdjustMatrix[1] = 0; - pCharPos->m_AdjustMatrix[2] = 0; - pCharPos->m_AdjustMatrix[3] = 1; - pCharPos->m_OriginY += fAscent * iVerScale / 100.0f - fAscent; - } else if (iCharRotation == 1) { - pCharPos->m_AdjustMatrix[0] = 0; - pCharPos->m_AdjustMatrix[1] = -1; - pCharPos->m_AdjustMatrix[2] = -1; - pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX -= fDescent; - pCharPos->m_OriginY -= fAscent + fDescent; - } else if (iCharRotation == 2) { - pCharPos->m_AdjustMatrix[0] = 1; - pCharPos->m_AdjustMatrix[1] = 0; - pCharPos->m_AdjustMatrix[2] = 0; - pCharPos->m_AdjustMatrix[3] = -1; - pCharPos->m_OriginX += fCharWidth; - pCharPos->m_OriginY -= fAscent; - } else { - pCharPos->m_AdjustMatrix[0] = 0; - pCharPos->m_AdjustMatrix[1] = 1; - pCharPos->m_AdjustMatrix[2] = 1; - pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX += fAscent * iVerScale / 100.0f; - } + if (iCharRotation == 0) + pCharPos->m_Origin.y -= fAscent; + else if (iCharRotation == 1) + pCharPos->m_Origin.y -= fAscent + fDescent; + else if (iCharRotation == 2) + pCharPos->m_Origin.y -= fAscent; + else + pCharPos->m_Origin.x += fAscent * iVerScale / 100.0f; } + if (iHorScale != 100 || iVerScale != 100) { pCharPos->m_AdjustMatrix[0] = pCharPos->m_AdjustMatrix[0] * iHorScale / 100.0f; diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index 69773f8eb0..79af4707ed 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -1447,22 +1447,21 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, } } if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { - pCharPos->m_OriginX = fX; - pCharPos->m_OriginY = fY; + pCharPos->m_Origin = CFX_PointF(fX, fY); if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) { int32_t iFormWidth = iCharWidth; pFont->GetCharWidth(wForm, iFormWidth, false); FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; - if (bVerticalDoc) { - pCharPos->m_OriginY += fOffset; - } else { - pCharPos->m_OriginX += fOffset; - } + if (bVerticalDoc) + pCharPos->m_Origin.y += fOffset; + else + pCharPos->m_Origin.x += fOffset; } + if (chartype == FX_CHARTYPE_Combination) { CFX_Rect rtBBox; if (pFont->GetCharBBox(wForm, &rtBBox, false)) { - pCharPos->m_OriginY = + pCharPos->m_Origin.y = fYBase + fFontSize - fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; } @@ -1471,9 +1470,8 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if ((dwLastProps & FX_CHARTYPEBITSMASK) == FX_CHARTYPE_Combination) { CFX_Rect rtBox; - if (pFont->GetCharBBox(wLast, &rtBox, false)) { - pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; - } + if (pFont->GetCharBBox(wLast, &rtBox, false)) + pCharPos->m_Origin.y -= fFontSize * rtBox.height / iMaxHeight; } } } @@ -1490,8 +1488,8 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight; } } - pCharPos->m_OriginX += ptOffset.x; - pCharPos->m_OriginY -= ptOffset.y; + pCharPos->m_Origin.x += ptOffset.x; + pCharPos->m_Origin.y -= ptOffset.y; } if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) { if (bVerticalDoc) { @@ -1508,26 +1506,26 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, pCharPos->m_AdjustMatrix[1] = 0; pCharPos->m_AdjustMatrix[2] = 0; pCharPos->m_AdjustMatrix[3] = 1; - pCharPos->m_OriginY += fAscent; + pCharPos->m_Origin.y += fAscent; } else if (iCharRotation == 1) { pCharPos->m_AdjustMatrix[0] = 0; pCharPos->m_AdjustMatrix[1] = -1; pCharPos->m_AdjustMatrix[2] = -1; pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX -= fDescent; + pCharPos->m_Origin.x -= fDescent; } else if (iCharRotation == 2) { pCharPos->m_AdjustMatrix[0] = 1; pCharPos->m_AdjustMatrix[1] = 0; pCharPos->m_AdjustMatrix[2] = 0; pCharPos->m_AdjustMatrix[3] = -1; - pCharPos->m_OriginX += fCharWidth; - pCharPos->m_OriginY += fAscent; + pCharPos->m_Origin.x += fCharWidth; + pCharPos->m_Origin.y += fAscent; } else { pCharPos->m_AdjustMatrix[0] = 0; pCharPos->m_AdjustMatrix[1] = 1; pCharPos->m_AdjustMatrix[2] = 1; pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX += fAscent; + pCharPos->m_Origin.x += fAscent; } } else { if (iCharRotation == 0) { @@ -1540,21 +1538,21 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, pCharPos->m_AdjustMatrix[1] = -1; pCharPos->m_AdjustMatrix[2] = -1; pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX -= fDescent; - pCharPos->m_OriginY -= fAscent + fDescent; + pCharPos->m_Origin.x -= fDescent; + pCharPos->m_Origin.y -= fAscent + fDescent; } else if (iCharRotation == 2) { pCharPos->m_AdjustMatrix[0] = 1; pCharPos->m_AdjustMatrix[1] = 0; pCharPos->m_AdjustMatrix[2] = 0; pCharPos->m_AdjustMatrix[3] = -1; - pCharPos->m_OriginX += fCharWidth; - pCharPos->m_OriginY -= fAscent; + pCharPos->m_Origin.x += fCharWidth; + pCharPos->m_Origin.y -= fAscent; } else { pCharPos->m_AdjustMatrix[0] = 0; pCharPos->m_AdjustMatrix[1] = 1; pCharPos->m_AdjustMatrix[2] = 1; pCharPos->m_AdjustMatrix[3] = 0; - pCharPos->m_OriginX += fAscent; + pCharPos->m_Origin.x += fAscent; } } if (iHorScale != 100 || iVerScale != 100) { diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index 93a53a88a1..bc0d61fd25 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -177,8 +177,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, (FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f; FX_FLOAT left = leftPositon; FX_FLOAT top = 0.0; - charPos[0].m_OriginX = penX + left; - charPos[0].m_OriginY = penY + top; + charPos[0].m_Origin = CFX_PointF(penX + left, penY + top); charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]); charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -186,8 +185,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, #endif penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; for (int32_t i = 1; i < length; i++) { - charPos[i].m_OriginX = penX + left; - charPos[i].m_OriginY = penY + top; + charPos[i].m_Origin = CFX_PointF(penX + left, penY + top); charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]); charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index ad0fc057e2..07d1644b95 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -1187,11 +1187,11 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, int32_t iChars = GetDisplayPos(pPiece, pCharPos); if (iChars > 0) { CFX_PointF pt1, pt2; - FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f; + FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f; if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) { for (int32_t i = 0; i < pPiece->iUnderline; i++) { for (int32_t j = 0; j < iChars; j++) { - pt1.x = pCharPos[j].m_OriginX; + pt1.x = pCharPos[j].m_Origin.x; pt2.x = pt1.x + pCharPos[j].m_FontCharWidth * pPiece->fFontSize / 1000.0f; pt1.y = pt2.y = fEndY; @@ -1200,9 +1200,9 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, fEndY += 2.0f; } } else { - pt1.x = pCharPos[0].m_OriginX; + pt1.x = pCharPos[0].m_Origin.x; pt2.x = - pCharPos[iChars - 1].m_OriginX + + pCharPos[iChars - 1].m_Origin.x + pCharPos[iChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f; for (int32_t i = 0; i < pPiece->iUnderline; i++) { pt1.y = pt2.y = fEndY; @@ -1210,9 +1210,9 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, fEndY += 2.0f; } } - fEndY = pCharPos[0].m_OriginY - pPiece->rtPiece.height * 0.25f; - pt1.x = pCharPos[0].m_OriginX; - pt2.x = pCharPos[iChars - 1].m_OriginX + + fEndY = pCharPos[0].m_Origin.y - pPiece->rtPiece.height * 0.25f; + pt1.x = pCharPos[0].m_Origin.x; + pt2.x = pCharPos[iChars - 1].m_Origin.x + pCharPos[iChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f; for (int32_t i = 0; i < pPiece->iLineThrough; i++) { pt1.y = pt2.y = fEndY; @@ -1253,25 +1253,29 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, if (iChars < 1) return; - fOrgX = pCharPos[iChars - 1].m_OriginX + + fOrgX = pCharPos[iChars - 1].m_Origin.x + pCharPos[iChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f; pPiece = pPieceLine->m_textPieces[iPieceNext].get(); iChars = GetDisplayPos(pPiece, pCharPos); if (iChars < 1) return; - fEndX = pCharPos[0].m_OriginX; - CFX_PointF pt1, pt2; - pt1.x = fOrgX, pt2.x = fEndX; - FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f; + fEndX = pCharPos[0].m_Origin.x; + CFX_PointF pt1; + CFX_PointF pt2; + pt1.x = fOrgX; + pt2.x = fEndX; + FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f; for (int32_t i = 0; i < pPiece->iUnderline; i++) { - pt1.y = pt2.y = fEndY; + pt1.y = fEndY; + pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; } - fEndY = pCharPos[0].m_OriginY - pPiece->rtPiece.height * 0.25f; + fEndY = pCharPos[0].m_Origin.y - pPiece->rtPiece.height * 0.25f; for (int32_t i = 0; i < pPiece->iLineThrough; i++) { - pt1.y = pt2.y = fEndY; + pt1.y = fEndY; + pt2.y = fEndY; pPath->AddLine(pt1, pt2); fEndY += 2.0f; } diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index f1abfb7cb5..2b8bd17aad 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -1484,8 +1484,7 @@ FWL_Error CFX_Graphics::CalcTextInfo(const CFX_WideString& text, FX_FLOAT left = (FX_FLOAT)(0); FX_FLOAT top = (FX_FLOAT)(0); charCodes[0] = text.GetAt(0); - charPos[0].m_OriginX = penX + left; - charPos[0].m_OriginY = penY + top; + charPos[0].m_Origin = CFX_PointF(penX + left, penY + top); charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(charCodes[0]); charPos[0].m_FontCharWidth = FXSYS_round( m_info.font->GetGlyphWidth(charPos[0].m_GlyphIndex) * m_info.fontHScale); @@ -1498,8 +1497,7 @@ FWL_Error CFX_Graphics::CalcTextInfo(const CFX_WideString& text, m_info.fontSpacing; for (int32_t i = 1; i < length; i++) { charCodes[i] = text.GetAt(i); - charPos[i].m_OriginX = penX + left; - charPos[i].m_OriginY = penY + top; + charPos[i].m_Origin = CFX_PointF(penX + left, penY + top); charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(charCodes[i]); charPos[i].m_FontCharWidth = FXSYS_round(m_info.font->GetGlyphWidth(charPos[i].m_GlyphIndex) * |