7#include "core/fxge/freetype/fx_freetype.h"
11#include "core/fxge/cfx_fontmgr.h"
12#include "core/fxge/cfx_gemodule.h"
14#define DEFINE_PS_TABLES
15#include "third_party/freetype/include/pstables.h"
19constexpr uint32_t kVariantBit = 0x80000000;
21int xyq_search_node(
char* glyph_name,
27 glyph_name[name_offset] = ft_adobe_glyph_list[table_offset] & 0x7f;
30 if (!(ft_adobe_glyph_list[table_offset - 1] & 0x80))
33 glyph_name[name_offset] = 0;
36 int count = ft_adobe_glyph_list[table_offset] & 0x7f;
39 if (ft_adobe_glyph_list[table_offset] & 0x80) {
40 unsigned short thiscode = ft_adobe_glyph_list[table_offset + 1] * 256 +
41 ft_adobe_glyph_list[table_offset + 2];
42 if (thiscode == (
unsigned short)unicode)
53 for (
int i = 0; i < count; i++) {
54 int child_offset = ft_adobe_glyph_list[table_offset + i * 2] * 256 +
55 ft_adobe_glyph_list[table_offset + i * 2 + 1];
56 if (xyq_search_node(glyph_name, name_offset, child_offset, unicode))
63FT_MM_Var* GetVariationDescriptor(FXFT_FaceRec* face) {
64 FT_MM_Var* variation_desc =
nullptr;
65 FT_Get_MM_Var(face, &variation_desc);
66 return variation_desc;
82 return variation_desc_->axis[index].def;
86 return variation_desc_->axis[index].minimum;
90 return variation_desc_->axis[index].maximum;
96 if (glyph_name[0] ==
'u' && glyph_name[1] ==
'n' && glyph_name[2] ==
'i') {
105 const char* p = glyph_name + 3;
107 for (count = 4; count > 0; count--, p++) {
109 unsigned int d = (
unsigned char)c -
'0';
111 d = (
unsigned char)c -
'A';
124 value = (value << 4) + d;
132 return (FT_UInt32)(value | kVariantBit);
138 if (glyph_name[0] ==
'u') {
141 const char* p = glyph_name + 1;
143 for (count = 6; count > 0; count--, p++) {
145 unsigned int d = (
unsigned char)c -
'0';
147 d = (
unsigned char)c -
'A';
157 value = (value << 4) + d;
164 return (FT_UInt32)(value | kVariantBit);
171 const char* p = glyph_name;
172 const char* dot =
nullptr;
175 if (*p ==
'.' && p > glyph_name) {
183 return (FT_UInt32)ft_get_adobe_glyph_index(glyph_name, p);
185 return (FT_UInt32)(ft_get_adobe_glyph_index(glyph_name, dot) | kVariantBit);
191 int count = ft_adobe_glyph_list[1];
192 for (
int i = 0; i < count; i++) {
194 ft_adobe_glyph_list[i * 2 + 2] * 256 + ft_adobe_glyph_list[i * 2 + 3];
195 if (xyq_search_node(glyph_name, 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
void FXFT_adobe_name_from_unicode(char *name, wchar_t unicode)
int FXFT_unicode_from_adobe_name(const char *glyph_name)
void operator()(FT_MM_Var *variation_desc)