Change FXTEXT_CHARPOS to use CFX_PointF

This CL updates the Origin x,y coordinates in FXTEXT_CHARPOS to be an
CFX_PointF.

Change-Id: I67281db2cb82687e12490145f7c99aee908e5fa8
Reviewed-on: https://pdfium-review.googlesource.com/2718
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index 64176fb..639bdcf 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -32,10 +32,12 @@
     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 @@
       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 60b5760..fd44d42 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2001,8 +2001,8 @@
                           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 d686738..f576eb0 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -39,9 +39,7 @@
   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 @@
     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 2144206..2e9abf9 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -62,10 +62,14 @@
 
 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 d2c677e..f2bf489 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -346,6 +346,21 @@
 
 }  // 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 @@
   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 @@
                           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 6a5b63b..fd35149 100644
--- a/core/fxge/ifx_renderdevicedriver.h
+++ b/core/fxge/ifx_renderdevicedriver.h
@@ -16,8 +16,8 @@
 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 8263cf6..431491d 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -802,8 +802,9 @@
       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 @@
   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 ff81dae..ecb1104 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 3b799e6..afd4778 100644
--- a/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -36,8 +36,7 @@
 
 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 d5f1f4d..32da090 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -662,7 +662,7 @@
       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 e941739..163c618 100644
--- a/core/fxge/win32/cfx_psrenderer.h
+++ b/core/fxge/win32/cfx_psrenderer.h
@@ -22,7 +22,7 @@
 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 974a120..f8eae87 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 0c6341f..3260cae 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 62e33fe..24436ec 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -1307,76 +1307,62 @@
               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 69773f8..79af470 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -1447,22 +1447,21 @@
         }
       }
       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 @@
             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 @@
             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 @@
             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 @@
             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 93a53a8..bc0d61f 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -177,8 +177,7 @@
       (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 @@
 #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 ad0fc05..07d1644 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -1187,11 +1187,11 @@
   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 @@
         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 @@
         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 @@
     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 f1abfb7..2b8bd17 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -1484,8 +1484,7 @@
   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 @@
           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) *