41 #include FT_ADVANCES_H
42 #include FT_MULTIPLE_MASTERS_H
44 #include FT_TRUETYPE_TABLES_H
89 mutable int cached_x_scale;
94 _hb_ft_font_create (
FT_Face ft_face,
bool symbol,
bool unref)
96 hb_ft_font_t *ft_font = (hb_ft_font_t *)
hb_calloc (1,
sizeof (hb_ft_font_t));
97 if (
unlikely (!ft_font))
return nullptr;
99 ft_font->lock.init ();
100 ft_font->ft_face = ft_face;
101 ft_font->symbol = symbol;
102 ft_font->unref = unref;
106 ft_font->cached_x_scale = 0;
107 ft_font->advance_cache.init ();
113 _hb_ft_face_destroy (
void *
data)
119 _hb_ft_font_destroy (
void *
data)
121 hb_ft_font_t *ft_font = (hb_ft_font_t *)
data;
123 ft_font->advance_cache.fini ();
126 _hb_ft_face_destroy (ft_font->ft_face);
128 ft_font->lock.fini ();
148 if (hb_object_is_immutable (
font))
154 hb_ft_font_t *ft_font = (hb_ft_font_t *)
font->user_data;
156 ft_font->load_flags = load_flags;
178 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *)
font->user_data;
180 return ft_font->load_flags;
200 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *)
font->user_data;
202 return ft_font->ft_face;
221 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *)
font->user_data;
223 ft_font->lock.lock ();
225 return ft_font->ft_face;
242 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *)
font->user_data;
244 ft_font->lock.unlock ();
255 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
261 if (
unlikely (ft_font->symbol) && unicode <= 0x00FFu)
285 unsigned int unicode_stride,
287 unsigned int glyph_stride,
290 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
297 first_unicode = &StructAtOffsetUnaligned<hb_codepoint_t> (first_unicode, unicode_stride);
298 first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
314 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
326 hb_ft_get_glyph_h_advances (
hb_font_t*
font,
void* font_data,
329 unsigned glyph_stride,
331 unsigned advance_stride,
334 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
336 FT_Face ft_face = ft_font->ft_face;
337 int load_flags = ft_font->load_flags;
338 int mult =
font->x_scale < 0 ? -1 : +1;
340 if (
font->x_scale != ft_font->cached_x_scale)
342 ft_font->advance_cache.clear ();
343 ft_font->cached_x_scale =
font->x_scale;
346 for (
unsigned int i = 0;
i <
count;
i++)
352 if (ft_font->advance_cache.get (glyph, &
cv))
357 ft_font->advance_cache.set (glyph,
v);
360 *first_advance = (
v * mult + (1<<9)) >> 10;
361 first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
362 first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
366 #ifndef HB_NO_VERTICAL
373 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
380 if (
font->y_scale < 0)
386 return (-
v + (1<<9)) >> 10;
390 #ifndef HB_NO_VERTICAL
399 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
401 FT_Face ft_face = ft_font->ft_face;
411 if (
font->x_scale < 0)
413 if (
font->y_scale < 0)
420 #ifndef HB_NO_OT_SHAPE_FALLBACK
428 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
446 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
448 FT_Face ft_face = ft_font->ft_face;
457 if (
font->x_scale < 0)
462 if (
font->y_scale < 0)
474 unsigned int point_index,
479 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
481 FT_Face ft_face = ft_font->ft_face;
505 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
507 FT_Face ft_face = ft_font->ft_face;
523 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
525 FT_Face ft_face = ft_font->ft_face;
532 len = hb_min (
len, (
int)
sizeof (
buf) - 1);
556 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
558 FT_Face ft_face = ft_font->ft_face;
562 if (
font->y_scale < 0)
590 _hb_ft_conic_to (
const FT_Vector *control,
600 _hb_ft_cubic_to (
const FT_Vector *control1,
606 control2->
x, control2->
y,
618 const hb_ft_font_t *ft_font = (
const hb_ft_font_t *) font_data;
620 FT_Face ft_face = ft_font->ft_face;
626 if (ft_face->
glyph->
format != FT_GLYPH_FORMAT_OUTLINE)
647 static inline void free_static_ft_funcs ();
663 #ifndef HB_NO_VERTICAL
669 #ifndef HB_NO_OT_SHAPE_FALLBACK
691 void free_static_ft_funcs ()
693 static_ft_funcs.free_instance ();
697 _hb_ft_get_font_funcs ()
699 return static_ft_funcs.get_unconst ();
707 hb_ft_font_t *ft_font = _hb_ft_font_create (ft_face, symbol, unref);
711 _hb_ft_get_font_funcs (),
713 _hb_ft_font_destroy);
818 hb_ft_face_finalize (
FT_Face ft_face)
897 _hb_ft_font_set_funcs (
font, ft_face,
false);
918 hb_ft_font_t *ft_font = (hb_ft_font_t *)
font->user_data;
920 FT_Face ft_face = ft_font->ft_face;
931 #if defined(HAVE_FT_GET_VAR_BLEND_COORDINATES) && !defined(HB_NO_VAR)
941 bool nonzero =
false;
943 for (
unsigned int i = 0;
i < mm_var->
num_axis; ++
i)
946 nonzero = nonzero ||
coords[
i];
957 #ifdef HAVE_FT_DONE_MM_VAR
994 static inline void free_static_ft_library ();
996 static struct hb_ft_library_lazy_loader_t :
hb_lazy_loader_t<hb_remove_pointer<FT_Library>,
997 hb_ft_library_lazy_loader_t>
1017 } static_ft_library;
1020 void free_static_ft_library ()
1022 static_ft_library.free_instance ();
1028 return static_ft_library.get_unconst ();
1032 _release_blob (
FT_Face ft_face)
1063 unsigned int blob_length;
1085 abs (
font->x_scale), abs (
font->y_scale),
1088 font->x_ppem * 72 * 64 /
font->x_scale,
1089 font->y_ppem * 72 * 64 /
font->y_scale);
1091 if (
font->x_scale < 0 ||
font->y_scale < 0)
1094 0,
font->y_scale < 0 ? -1 : +1};
1098 #if defined(HAVE_FT_GET_VAR_BLEND_COORDINATES) && !defined(HB_NO_VAR)
1099 unsigned int num_coords;
1106 for (
unsigned int i = 0;
i < num_coords;
i++)
1117 _hb_ft_font_set_funcs (
font, ft_face,
true);
small capitals from c petite p scientific i
[1]
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
#define FT_LOAD_VERTICAL_LAYOUT
#define FT_LOAD_NO_BITMAP
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
FT_Done_Face(FT_Face face)
#define FT_LOAD_NO_HINTING
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
FT_Select_Charmap(FT_Face face, FT_Encoding encoding)
struct FT_FaceRec_ * FT_Face
FT_Face_GetCharVariantIndex(FT_Face face, FT_ULong charcode, FT_ULong variantSelector)
enum FT_Kerning_Mode_ FT_Kerning_Mode
FT_Get_Glyph_Name(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
FT_Get_Name_Index(FT_Face face, const FT_String *glyph_name)
FT_Done_FreeType(FT_Library library)
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
FT_Set_Char_Size(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution)
FT_Reference_Face(FT_Face face)
FT_New_Memory_Face(FT_Library library, const FT_Byte *file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface)
FT_MulFix(FT_Long a, FT_Long b)
FT_Init_FreeType(FT_Library *alibrary)
FT_Get_Advance(FT_Face face, FT_UInt gindex, FT_Int32 load_flags, FT_Fixed *padvance)
int(* FT_Outline_ConicToFunc)(const FT_Vector *control, const FT_Vector *to, void *user)
int(* FT_Outline_LineToFunc)(const FT_Vector *to, void *user)
int(* FT_Outline_CubicToFunc)(const FT_Vector *control1, const FT_Vector *control2, const FT_Vector *to, void *user)
int(* FT_Outline_MoveToFunc)(const FT_Vector *to, void *user)
FT_Set_Var_Blend_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed *coords)
FT_Get_Var_Blend_Coordinates(FT_Face face, FT_UInt num_coords, FT_Fixed *coords)
FT_Done_MM_Var(FT_Library library, FT_MM_Var *amaster)
FT_Get_MM_Var(FT_Face face, FT_MM_Var **amaster)
FT_BEGIN_HEADER FT_Outline_Decompose(FT_Outline *outline, const FT_Outline_Funcs *func_interface, void *user)
void(* FT_Generic_Finalizer)(void *object)
const char * hb_blob_get_data(hb_blob_t *blob, unsigned int *length)
hb_blob_t * hb_blob_create(const char *data, unsigned int length, hb_memory_mode_t mode, void *user_data, hb_destroy_func_t destroy)
void hb_blob_destroy(hb_blob_t *blob)
#define DEBUG_MSG(WHAT, OBJ,...)
void const void *obj HB_UNUSED
void hb_face_set_index(hb_face_t *face, unsigned int index)
void hb_face_destroy(hb_face_t *face)
void hb_face_set_upem(hb_face_t *face, unsigned int upem)
hb_face_t * hb_face_create(hb_blob_t *blob, unsigned int index)
hb_face_t * hb_face_create_for_tables(hb_reference_table_func_t reference_table_func, void *user_data, hb_destroy_func_t destroy)
hb_face_t * hb_face_reference(hb_face_t *face)
unsigned int hb_face_get_index(const hb_face_t *face)
hb_blob_t * hb_face_reference_blob(hb_face_t *face)
hb_font_t * hb_font_create(hb_face_t *face)
void hb_font_set_var_coords_normalized(hb_font_t *font, const int *coords, unsigned int coords_length)
const int * hb_font_get_var_coords_normalized(hb_font_t *font, unsigned int *length)
void hb_font_set_funcs(hb_font_t *font, hb_font_funcs_t *klass, void *font_data, hb_destroy_func_t destroy)
void hb_font_set_ppem(hb_font_t *font, unsigned int x_ppem, unsigned int y_ppem)
void hb_font_set_scale(hb_font_t *font, int x_scale, int y_scale)
hb_font_funcs_t * hb_font_funcs_create()
void hb_font_funcs_make_immutable(hb_font_funcs_t *ffuncs)
HB_EXTERN hb_face_t * hb_ft_face_create_referenced(FT_Face ft_face)
HB_EXTERN hb_font_t * hb_ft_font_create(FT_Face ft_face, hb_destroy_func_t destroy)
HB_EXTERN hb_font_t * hb_ft_font_create_referenced(FT_Face ft_face)
HB_EXTERN void hb_ft_font_unlock_face(hb_font_t *font)
HB_EXTERN FT_Face hb_ft_font_get_face(hb_font_t *font)
HB_EXTERN hb_face_t * hb_ft_face_create_cached(FT_Face ft_face)
HB_EXTERN void hb_ft_font_set_funcs(hb_font_t *font)
HB_EXTERN int hb_ft_font_get_load_flags(hb_font_t *font)
HB_EXTERN void hb_ft_font_changed(hb_font_t *font)
HB_BEGIN_DECLS HB_EXTERN hb_face_t * hb_ft_face_create(FT_Face ft_face, hb_destroy_func_t destroy)
HB_EXTERN void hb_ft_font_set_load_flags(hb_font_t *font, int load_flags)
HB_EXTERN FT_Face hb_ft_font_lock_face(hb_font_t *font)
int PRIV() strcmp(PCRE2_SPTR str1, PCRE2_SPTR str2)
int PRIV() strncmp(PCRE2_SPTR str1, PCRE2_SPTR str2, size_t len)
QT_BEGIN_NAMESPACE bool done
GLenum GLuint GLenum GLsizei length
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLubyte GLsizei GLenum const void * coords
GLenum GLenum GLsizei count
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
@ HB_MEMORY_MODE_WRITABLE
@ HB_MEMORY_MODE_READONLY
void(* hb_destroy_func_t)(void *user_data)
HB_BEGIN_DECLS typedef int hb_bool_t
HB_EXTERN hb_font_get_glyph_func_t void * user_data
HB_EXTERN hb_font_get_glyph_func_t void hb_destroy_func_t destroy
HB_EXTERN void hb_font_funcs_set_glyph_name_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_name_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_contour_point_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_contour_point_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_extents_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_extents_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_h_kerning_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_h_kerning_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_nominal_glyphs_func(hb_font_funcs_t *ffuncs, hb_font_get_nominal_glyphs_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_variation_glyph_func(hb_font_funcs_t *ffuncs, hb_font_get_variation_glyph_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_font_h_extents_func(hb_font_funcs_t *ffuncs, hb_font_get_font_h_extents_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_v_origin_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_v_origin_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_v_advance_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_v_advance_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_shape_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_shape_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_nominal_glyph_func(hb_font_funcs_t *ffuncs, hb_font_get_nominal_glyph_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_h_advances_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_h_advances_func_t func, void *user_data, hb_destroy_func_t destroy)
HB_EXTERN void hb_font_funcs_set_glyph_from_name_func(hb_font_funcs_t *ffuncs, hb_font_get_glyph_from_name_func_t func, void *user_data, hb_destroy_func_t destroy)
FT_Generic_Finalizer finalizer
void line_to(float to_x, float to_y)
void move_to(float to_x, float to_y)
void cubic_to(float control1_x, float control1_y, float control2_x, float control2_y, float to_x, float to_y)
void quadratic_to(float control_x, float control_y, float to_x, float to_y)
static hb_font_funcs_t * create()
static void destroy(Stored *p)
static const Stored * get_null()
std::condition_variable cv
FT_UInt FT_UInt right_glyph
FT_Load_Sfnt_Table(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
XmlOutput::xml_output tag(const QString &name)