1e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Copyright 2014 PDFium Authors. All rights reserved.
2e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Use of this source code is governed by a BSD-style license that can be
3e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// found in the LICENSE file.
4e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
5e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
7e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifndef PUBLIC_FPDF_SYSFONTINFO_H_
8e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PUBLIC_FPDF_SYSFONTINFO_H_
9e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
104d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann// NOLINTNEXTLINE(build/include)
11e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#include "fpdfview.h"
12e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
13e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/* Character sets for the font */
14ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_ANSI_CHARSET 0
15ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_DEFAULT_CHARSET 1
16ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_SYMBOL_CHARSET 2
17e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define FXFONT_SHIFTJIS_CHARSET 128
18ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_HANGEUL_CHARSET 129
19ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_GB2312_CHARSET 134
20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_CHINESEBIG5_CHARSET 136
21e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
22e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/* Font pitch and family flags */
23d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann#define FXFONT_FF_FIXEDPITCH (1 << 0)
24ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_FF_ROMAN (1 << 4)
25ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_FF_SCRIPT (4 << 4)
26e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
27e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/* Typical weight values */
28ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_FW_NORMAL 400
29ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define FXFONT_FW_BOLD 700
30e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
31e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Exported Functions
32e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef __cplusplus
33e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovextern "C" {
34e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif
35e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
36e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/**
37e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Interface: FPDF_SYSFONTINFO
38e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          Interface for getting system font information and font mapping
39e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov */
40e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovtypedef struct _FPDF_SYSFONTINFO {
41ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
42ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Version number of the interface. Currently must be 1.
43ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
44ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int version;
45e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
46ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
47ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: Release
48ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Give implementation a chance to release any data after the
49ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * interface is no longer used
50ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
51ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
52ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
53ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          No
54ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Comments:
55ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Called by Foxit SDK during the final cleanup process.
56ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
57ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
58ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
59ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          None
60ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   */
61ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  void (*Release)(struct _FPDF_SYSFONTINFO* pThis);
62e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
63ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
64ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: EnumFonts
65ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Enumerate all fonts installed on the system
66ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
67ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
68ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
69ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          No
70ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Comments:
71ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Implementation should call FPDF_AddIntalledFont() function for
72ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * each font found.
73ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
74ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
75ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
76ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pMapper     -   An opaque pointer to internal font mapper, used
77ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * when calling FPDF_AddInstalledFont
78ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
79ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          None
80ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   */
81ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper);
82e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
83ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
84ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: MapFont
85ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Use the system font mapper to get a font handle from requested
86ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *parameters
87ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
88ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
89ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
90ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Yes only if GetFont method is not implemented.
91ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Comments:
92ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          If the system supports native font mapper (like Windows),
93ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *implementation can implement this method to get a font handle.
94ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Otherwise, Foxit SDK will do the mapping and then call GetFont
95ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *method.
96ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
97ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
98ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
99ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          weight      -   Weight of the requested font. 400 is normal and
100ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *700 is bold.
101ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          bItalic     -   Italic option of the requested font, TRUE or
102ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *FALSE.
103ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          charset     -   Character set identifier for the requested font.
104ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *See above defined constants.
105ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pitch_family -  A combination of flags. See above defined
106ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *constants.
107ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          face        -   Typeface name. Currently use system local encoding
108ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *only.
109d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann   *          bExact      -   Obsolete: this parameter is now ignored.
110ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
111ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          An opaque pointer for font handle, or NULL if system mapping is
112ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *not supported.
113ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
114ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis,
115ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                   int weight,
116ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                   FPDF_BOOL bItalic,
117ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                   int charset,
118ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                   int pitch_family,
119ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                   const char* face,
120ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                   FPDF_BOOL* bExact);
121e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
122ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
123ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: GetFont
124ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Get a handle to a particular font by its internal ID
125ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
126ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
127ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
128ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Yes only if MapFont method is not implemented.
129ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Comments:
130ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          If the system mapping not supported, Foxit SDK will do the font
131ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *mapping and use this method to get a font handle.
132ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
133ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
134ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          face        -   Typeface name. Currently use system local encoding
135ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *only.
136ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
137ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          An opaque pointer for font handle.
138ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
139ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face);
140e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
141ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
142ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: GetFontData
143ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Get font data from a font
144ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
145ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
146ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
147ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Yes
148ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Comments:
149ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Can read either full font file, or a particular TrueType/OpenType
150ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *table
151ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
152ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
153ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          hFont       -   Font handle returned by MapFont or GetFont method
154ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          table       -   TrueType/OpenType table identifier (refer to
155ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *TrueType specification).
156ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *                          0 for the whole font file.
157ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          buffer      -   The buffer receiving the font data. Can be NULL if
158ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *not provided
159ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          buf_size    -   Buffer size, can be zero if not provided
160ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
161ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Number of bytes needed, if buffer not provided or not large
162ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *enough,
163ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          or number of bytes written into buffer otherwise.
164ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
165ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis,
166ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               void* hFont,
167ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               unsigned int table,
168ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               unsigned char* buffer,
169ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               unsigned long buf_size);
170e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
171ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
172ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: GetFaceName
173ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Get face name from a font handle
174ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
175ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
176ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
177ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          No
178ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
179ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
180ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          hFont       -   Font handle returned by MapFont or GetFont method
181ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          buffer      -   The buffer receiving the face name. Can be NULL if
182ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *not provided
183ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          buf_size    -   Buffer size, can be zero if not provided
184ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
185ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Number of bytes needed, if buffer not provided or not large
186ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *enough,
187ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          or number of bytes written into buffer otherwise.
188ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
189ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis,
190ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               void* hFont,
191ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               char* buffer,
192ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                               unsigned long buf_size);
193e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
194ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
195ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: GetFontCharset
196ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Get character set information for a font handle
197ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
198ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
199ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
200ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          No
201ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
202ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
203ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          hFont       -   Font handle returned by MapFont or GetFont method
204ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
205ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Character set identifier. See defined constants above.
206ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
207ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
208e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
209ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  /**
210ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Method: DeleteFont
211ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Delete a font handle
212ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Interface Version:
213ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          1
214ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Implementation Required:
215ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          Yes
216ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Parameters:
217ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          pThis       -   Pointer to the interface structure itself
218ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          hFont       -   Font handle returned by MapFont or GetFont method
219ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   * Return Value:
220ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   *          None
221ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann   **/
222ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
223e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FPDF_SYSFONTINFO;
224e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
225e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/**
226e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Struct: FPDF_CharsetFontMap
227e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *    Provides the name of a font to use for a given charset value.
228e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov **/
229ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmanntypedef struct FPDF_CharsetFontMap_ {
230ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int charset;  // Character Set Enum value, see FXFONT_*_CHARSET above.
231ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  const char* fontname;  // Name of default font to use with that charset.
232e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} FPDF_CharsetFontMap;
233e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
234e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/**
235e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Function: FPDF_GetDefaultTTFMap
236e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *    Returns a pointer to the default character set to TT Font name map. The
237e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *    map is an array of FPDF_CharsetFontMap structs, with its end indicated
238e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *    by a { -1, NULL } entry.
239e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Parameters:
240e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *     None.
241e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Return Value:
242e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *     Pointer to the Charset Font Map.
243e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov **/
244d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMap();
245e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
246e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/**
247e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Function: FPDF_AddInstalledFont
248e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          Add a system font to the list in Foxit SDK.
249e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Comments:
250ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *          This function is only called during the system font list building
251ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *process.
252e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Parameters:
253e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          mapper          -   Opaque pointer to Foxit font mapper
254e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          face            -   The font face name
255e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          charset         -   Font character set. See above defined constants.
256e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Return Value:
257e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          None.
258e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov **/
259d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper,
260d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann                                                     const char* face,
261d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. Moltmann                                                     int charset);
262e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
263e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/**
264e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Function: FPDF_SetSystemFontInfo
265e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          Set the system font info interface into Foxit SDK
266e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Comments:
267ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *          Platform support implementation should implement required methods of
268ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *FFDF_SYSFONTINFO interface,
269e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          then call this function during SDK initialization process.
270e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Parameters:
271e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          pFontInfo       -   Pointer to a FPDF_SYSFONTINFO structure
272e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Return Value:
273e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          None
274e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov **/
275d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV
276d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
277e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
278e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov/**
279e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Function: FPDF_GetDefaultSystemFontInfo
280e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          Get default system font info interface for current platform
281e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Comments:
282ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *          For some platforms Foxit SDK implement a default version of system
283ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *font info interface.
284ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *          The default implementation can be used in FPDF_SetSystemFontInfo
285ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *function.
286e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Parameters:
287e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          None
288e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov * Return Value:
289ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *          Pointer to a FPDF_SYSFONTINFO structure describing the default
290ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann *interface.
291e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov *          Or NULL if the platform doesn't have a default interface.
2924d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *          Application should call FPDF_FreeDefaultSystemFontInfo to free the
2934d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *returned pointer.
294e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov **/
295d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo();
296e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
2974d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann/**
2984d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann * Function: FPDF_FreeDefaultSystemFontInfo
2994d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *           Free a default system font info interface
3004d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann * Comments:
3014d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *           This function should be called on the output from
3024d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *FPDF_SetSystemFontInfo once it is no longer needed by the client.
3034d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann * Parameters:
3044d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *           pFontInfo       -   Pointer to a FPDF_SYSFONTINFO structure
3054d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann * Return Value:
3064d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann *          None
3074d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann **/
308d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_EXPORT void FPDF_CALLCONV
309d904c1ec7e8d1d86ed56f0dd252435d12cd345aePhilip P. MoltmannFPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
3104d3acf4ec42bf6e838f9060103aff98fbf170794Philip P. Moltmann
311e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef __cplusplus
312e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov}
313e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif
314e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
315e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif  // PUBLIC_FPDF_SYSFONTINFO_H_
316