xref: /aosp_15_r20/external/pdfium/xfa/fgas/layout/cfgas_char.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
8 #define XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
9 
10 #include <stdint.h>
11 
12 #include <vector>
13 
14 #include "core/fxcrt/fx_unicode.h"
15 #include "core/fxcrt/retain_ptr.h"
16 #include "xfa/fgas/layout/cfgas_textuserdata.h"
17 #include "xfa/fgas/layout/fgas_linebreak.h"
18 
19 class CFGAS_Char {
20  public:
21   enum class BreakType : uint8_t {
22     kNone = 0,
23     kPiece,
24     kLine,
25     kParagraph,
26     kPage
27   };
28 
29   static void BidiLine(std::vector<CFGAS_Char>* chars, size_t iCount);
30 
31   explicit CFGAS_Char(uint16_t wCharCode);
32   CFGAS_Char(uint16_t wCharCode,
33              int32_t iHorizontalScale,
34              int32_t iVerticalScale);
35   CFGAS_Char(const CFGAS_Char& other);
36   ~CFGAS_Char();
37 
38   FX_CHARTYPE GetCharType() const;
char_code()39   uint16_t char_code() const { return m_wCharCode; }
horizonal_scale()40   int16_t horizonal_scale() const { return m_iHorizontalScale; }
vertical_scale()41   int16_t vertical_scale() const { return m_iVerticalScale; }
42 
43   BreakType m_dwStatus = BreakType::kNone;
44   FX_BIDICLASS m_iBidiClass = FX_BIDICLASS::kON;
45   FX_LINEBREAKTYPE m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
46   uint32_t m_dwCharStyles = 0;
47   int32_t m_iCharWidth = 0;
48   uint16_t m_iBidiLevel = 0;
49   uint16_t m_iBidiPos = 0;
50   uint16_t m_iBidiOrder = 0;
51   int32_t m_iFontSize = 0;
52   uint32_t m_dwIdentity = 0;
53   RetainPtr<CFGAS_TextUserData> m_pUserData;
54 
55  private:
56   uint16_t m_wCharCode;
57   int32_t m_iHorizontalScale;
58   int32_t m_iVerticalScale;
59 };
60 
61 #endif  // XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
62