summaryrefslogtreecommitdiff
path: root/core/fxge/ge/fx_text_int.h
blob: 04587c37cb0057d705161e9364a8358c9bac6ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef CORE_FXGE_GE_FX_TEXT_INT_H_
#define CORE_FXGE_GE_FX_TEXT_INT_H_

#include <map>

#include "core/include/fxge/fx_font.h"
#include "core/include/fxge/fx_freetype.h"

struct _CFX_UniqueKeyGen {
  void Generate(int count, ...);
  FX_CHAR m_Key[128];
  int m_KeyLen;
};
class CFX_SizeGlyphCache {
 public:
  CFX_SizeGlyphCache() {}
  ~CFX_SizeGlyphCache();
  std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap;
};
class CTTFontDesc {
 public:
  CTTFontDesc() {
    m_Type = 0;
    m_pFontData = NULL;
    m_RefCount = 0;
  }
  ~CTTFontDesc();
  // ret < 0, releaseface not appropriate for this object.
  // ret == 0, object released
  // ret > 0, object still alive, other referrers.
  int ReleaseFace(FXFT_Face face);
  int m_Type;
  union {
    struct {
      FX_BOOL m_bItalic;
      FX_BOOL m_bBold;
      FXFT_Face m_pFace;
    } m_SingleFace;
    struct {
      FXFT_Face m_pFaces[16];
    } m_TTCFace;
  };
  uint8_t* m_pFontData;
  int m_RefCount;
};

#define CHARSET_FLAG_ANSI 1
#define CHARSET_FLAG_SYMBOL 2
#define CHARSET_FLAG_SHIFTJIS 4
#define CHARSET_FLAG_BIG5 8
#define CHARSET_FLAG_GB 16
#define CHARSET_FLAG_KOREAN 32

class CFX_FontFaceInfo {
 public:
  CFX_FontFaceInfo(CFX_ByteString filePath,
                   CFX_ByteString faceName,
                   CFX_ByteString fontTables,
                   uint32_t fontOffset,
                   uint32_t fileSize)
      : m_FilePath(filePath),
        m_FaceName(faceName),
        m_FontTables(fontTables),
        m_FontOffset(fontOffset),
        m_FileSize(fileSize),
        m_Styles(0),
        m_Charsets(0) {}

  const CFX_ByteString m_FilePath;
  const CFX_ByteString m_FaceName;
  const CFX_ByteString m_FontTables;
  const uint32_t m_FontOffset;
  const uint32_t m_FileSize;
  uint32_t m_Styles;
  uint32_t m_Charsets;
};

#endif  // CORE_FXGE_GE_FX_TEXT_INT_H_