7#include "core/fxge/freetype/fx_freetype.h"
11#include "core/fxcrt/compiler_specific.h"
12#include "core/fxge/cfx_fontmgr.h"
13#include "core/fxge/cfx_gemodule.h"
15#define DEFINE_PS_TABLES
16#include "third_party/freetype/include/pstables.h"
20constexpr uint32_t kVariantBit = 0x80000000;
22bool SearchNode(pdfium::span<
const uint8_t> glyph_span,
23 pdfium::span<
char> name_buf,
29 name_buf[name_offset] = glyph_span[table_offset] & 0x7f;
32 if (!(glyph_span[table_offset - 1] & 0x80)) {
36 name_buf[name_offset] = 0;
39 int count = glyph_span[table_offset] & 0x7f;
42 if (glyph_span[table_offset] & 0x80) {
43 unsigned short thiscode =
44 glyph_span[table_offset + 1] * 256 + glyph_span[table_offset + 2];
45 if (thiscode == (
unsigned short)unicode) {
54 for (
int i = 0; i < count; i++) {
55 int child_offset = glyph_span[table_offset + i * 2] * 256 +
56 glyph_span[table_offset + i * 2 + 1];
57 if (SearchNode(glyph_span, name_buf, name_offset, child_offset, unicode)) {
67 FT_MM_Var* variation_desc =
nullptr;
68 FT_Get_MM_Var(face, &variation_desc);
69 return variation_desc;
72pdfium::span<
const FT_Var_Axis> GetVariationAxis(
73 const FT_MM_Var* variation_desc) {
74 if (!variation_desc) {
80 pdfium::make_span(variation_desc->axis, variation_desc->num_axis));
97 return axis_[index].def;
101 return axis_[index].minimum;
105 return axis_[index].maximum;
112 if (glyph_name[0] ==
'u' && glyph_name[1] ==
'n' && glyph_name[2] ==
'i') {
121 const char* p = glyph_name + 3;
123 for (count = 4; count > 0; count--, p++) {
125 unsigned int d = (
unsigned char)c -
'0';
127 d = (
unsigned char)c -
'A';
142 value = (value << 4) + d;
151 return (FT_UInt32)(value | kVariantBit);
158 if (glyph_name[0] ==
'u') {
161 const char* p = glyph_name + 1;
163 for (count = 6; count > 0; count--, p++) {
165 unsigned int d = (
unsigned char)c -
'0';
167 d = (
unsigned char)c -
'A';
179 value = (value << 4) + d;
187 return (FT_UInt32)(value | kVariantBit);
195 const char* p = glyph_name;
196 const char* dot =
nullptr;
199 if (*p ==
'.' && p > glyph_name) {
207 return (FT_UInt32)ft_get_adobe_glyph_index(glyph_name, p);
210 return (FT_UInt32)(ft_get_adobe_glyph_index(glyph_name, dot) |
218 pdfium::span<
const uint8_t> glyph_span(ft_adobe_glyph_list);
221 int count = glyph_span[1];
222 for (
int i = 0; i < count; i++) {
223 int child_offset = glyph_span[i * 2 + 2] * 256 + glyph_span[i * 2 + 3];
224 if (SearchNode(glyph_span, name_buf, 0, child_offset, unicode)) {
FXFT_LibraryRec * GetFTLibrary() const
static CFX_GEModule * Get()
CFX_FontMgr * GetFontMgr() const
FT_Long GetAxisMax(size_t index) const
ScopedFXFTMMVar(FXFT_FaceRec *face)
FT_Pos GetAxisDefault(size_t index) const
FT_Long GetAxisMin(size_t index) const
#define UNSAFE_BUFFERS(...)
void FXFT_adobe_name_from_unicode(pdfium::span< char > name_buf, wchar_t unicode)
int FXFT_unicode_from_adobe_name(const char *glyph_name)
struct FT_FaceRec_ FXFT_FaceRec
void operator()(FT_MM_Var *variation_desc)