Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:04:01

0001 /*
0002  * Copyright © 2009  Red Hat, Inc.
0003  *
0004  *  This is part of HarfBuzz, a text shaping library.
0005  *
0006  * Permission is hereby granted, without written agreement and without
0007  * license or royalty fees, to use, copy, modify, and distribute this
0008  * software and its documentation for any purpose, provided that the
0009  * above copyright notice and the following two paragraphs appear in
0010  * all copies of this software.
0011  *
0012  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
0013  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
0014  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
0015  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
0016  * DAMAGE.
0017  *
0018  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
0019  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
0020  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
0021  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
0022  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
0023  *
0024  * Red Hat Author(s): Behdad Esfahbod
0025  */
0026 
0027 #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
0028 #error "Include <hb.h> instead."
0029 #endif
0030 
0031 #ifndef HB_FONT_H
0032 #define HB_FONT_H
0033 
0034 #include "hb-common.h"
0035 #include "hb-face.h"
0036 #include "hb-draw.h"
0037 #include "hb-paint.h"
0038 
0039 HB_BEGIN_DECLS
0040 
0041 /*
0042  * hb_font_funcs_t
0043  */
0044 
0045 /**
0046  * hb_font_funcs_t:
0047  *
0048  * Data type containing a set of virtual methods used for
0049  * working on #hb_font_t font objects.
0050  *
0051  * HarfBuzz provides a lightweight default function for each of 
0052  * the methods in #hb_font_funcs_t. Client programs can implement
0053  * their own replacements for the individual font functions, as
0054  * needed, and replace the default by calling the setter for a
0055  * method.
0056  *
0057  **/
0058 typedef struct hb_font_funcs_t hb_font_funcs_t;
0059 
0060 HB_EXTERN hb_font_funcs_t *
0061 hb_font_funcs_create (void);
0062 
0063 HB_EXTERN hb_font_funcs_t *
0064 hb_font_funcs_get_empty (void);
0065 
0066 HB_EXTERN hb_font_funcs_t *
0067 hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
0068 
0069 HB_EXTERN void
0070 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
0071 
0072 HB_EXTERN hb_bool_t
0073 hb_font_funcs_set_user_data (hb_font_funcs_t    *ffuncs,
0074                  hb_user_data_key_t *key,
0075                  void *              data,
0076                  hb_destroy_func_t   destroy,
0077                  hb_bool_t           replace);
0078 
0079 
0080 HB_EXTERN void *
0081 hb_font_funcs_get_user_data (const hb_font_funcs_t *ffuncs,
0082                  hb_user_data_key_t    *key);
0083 
0084 
0085 HB_EXTERN void
0086 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
0087 
0088 HB_EXTERN hb_bool_t
0089 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
0090 
0091 
0092 /* font extents */
0093 
0094 /**
0095  * hb_font_extents_t:
0096  * @ascender: The height of typographic ascenders.
0097  * @descender: The depth of typographic descenders.
0098  * @line_gap: The suggested line-spacing gap.
0099  *
0100  * Font-wide extent values, measured in font units.
0101  *
0102  * Note that typically @ascender is positive and @descender
0103  * negative, in coordinate systems that grow up.
0104  **/
0105 typedef struct hb_font_extents_t {
0106   hb_position_t ascender;
0107   hb_position_t descender;
0108   hb_position_t line_gap;
0109   /*< private >*/
0110   hb_position_t reserved9;
0111   hb_position_t reserved8;
0112   hb_position_t reserved7;
0113   hb_position_t reserved6;
0114   hb_position_t reserved5;
0115   hb_position_t reserved4;
0116   hb_position_t reserved3;
0117   hb_position_t reserved2;
0118   hb_position_t reserved1;
0119 } hb_font_extents_t;
0120 
0121 /* func types */
0122 
0123 /**
0124  * hb_font_get_font_extents_func_t:
0125  * @font: #hb_font_t to work upon
0126  * @font_data: @font user data pointer
0127  * @extents: (out): The font extents retrieved
0128  * @user_data: User data pointer passed by the caller
0129  *
0130  * This method should retrieve the extents for a font.
0131  *
0132  **/
0133 typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,
0134                                hb_font_extents_t *extents,
0135                                void *user_data);
0136 
0137 /**
0138  * hb_font_get_font_h_extents_func_t:
0139  *
0140  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0141  *
0142  * This method should retrieve the extents for a font, for horizontal-direction
0143  * text segments. Extents must be returned in an #hb_glyph_extents output
0144  * parameter.
0145  * 
0146  **/
0147 typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;
0148 
0149 /**
0150  * hb_font_get_font_v_extents_func_t:
0151  *
0152  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0153  *
0154  * This method should retrieve the extents for a font, for vertical-direction
0155  * text segments. Extents must be returned in an #hb_glyph_extents output
0156  * parameter.
0157  * 
0158  **/
0159 typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;
0160 
0161 
0162 /**
0163  * hb_font_get_nominal_glyph_func_t:
0164  * @font: #hb_font_t to work upon
0165  * @font_data: @font user data pointer
0166  * @unicode: The Unicode code point to query
0167  * @glyph: (out): The glyph ID retrieved
0168  * @user_data: User data pointer passed by the caller
0169  *
0170  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0171  *
0172  * This method should retrieve the nominal glyph ID for a specified Unicode code
0173  * point. Glyph IDs must be returned in a #hb_codepoint_t output parameter.
0174  * 
0175  * Return value: `true` if data found, `false` otherwise
0176  *
0177  **/
0178 typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,
0179                                hb_codepoint_t unicode,
0180                                hb_codepoint_t *glyph,
0181                                void *user_data);
0182 
0183 /**
0184  * hb_font_get_variation_glyph_func_t:
0185  * @font: #hb_font_t to work upon
0186  * @font_data: @font user data pointer
0187  * @unicode: The Unicode code point to query
0188  * @variation_selector: The  variation-selector code point to query
0189  * @glyph: (out): The glyph ID retrieved
0190  * @user_data: User data pointer passed by the caller
0191  *
0192  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0193  *
0194  * This method should retrieve the glyph ID for a specified Unicode code point
0195  * followed by a specified Variation Selector code point. Glyph IDs must be
0196  * returned in a #hb_codepoint_t output parameter.
0197  * 
0198  * Return value: `true` if data found, `false` otherwise
0199  *
0200  **/
0201 typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,
0202                              hb_codepoint_t unicode, hb_codepoint_t variation_selector,
0203                              hb_codepoint_t *glyph,
0204                              void *user_data);
0205 
0206 
0207 /**
0208  * hb_font_get_nominal_glyphs_func_t:
0209  * @font: #hb_font_t to work upon
0210  * @font_data: @font user data pointer
0211  * @count: number of code points to query
0212  * @first_unicode: The first Unicode code point to query
0213  * @unicode_stride: The stride between successive code points
0214  * @first_glyph: (out): The first glyph ID retrieved
0215  * @glyph_stride: The stride between successive glyph IDs
0216  * @user_data: User data pointer passed by the caller
0217  *
0218  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0219  *
0220  * This method should retrieve the nominal glyph IDs for a sequence of
0221  * Unicode code points. Glyph IDs must be returned in a #hb_codepoint_t
0222  * output parameter.
0223  *
0224  * Return value: the number of code points processed
0225  * 
0226  **/
0227 typedef unsigned int (*hb_font_get_nominal_glyphs_func_t) (hb_font_t *font, void *font_data,
0228                                unsigned int count,
0229                                const hb_codepoint_t *first_unicode,
0230                                unsigned int unicode_stride,
0231                                hb_codepoint_t *first_glyph,
0232                                unsigned int glyph_stride,
0233                                void *user_data);
0234 
0235 /**
0236  * hb_font_get_glyph_advance_func_t:
0237  * @font: #hb_font_t to work upon
0238  * @font_data: @font user data pointer
0239  * @glyph: The glyph ID to query
0240  * @user_data: User data pointer passed by the caller
0241  *
0242  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0243  *
0244  * This method should retrieve the advance for a specified glyph. The
0245  * method must return an #hb_position_t.
0246  * 
0247  * Return value: The advance of @glyph within @font
0248  *
0249  **/
0250 typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
0251                                hb_codepoint_t glyph,
0252                                void *user_data);
0253 
0254 /**
0255  * hb_font_get_glyph_h_advance_func_t:
0256  *
0257  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0258  *
0259  * This method should retrieve the advance for a specified glyph, in
0260  * horizontal-direction text segments. Advances must be returned in
0261  * an #hb_position_t output parameter.
0262  * 
0263  **/
0264 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
0265 
0266 /**
0267  * hb_font_get_glyph_v_advance_func_t:
0268  *
0269  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0270  *
0271  * This method should retrieve the advance for a specified glyph, in
0272  * vertical-direction text segments. Advances must be returned in
0273  * an #hb_position_t output parameter.
0274  * 
0275  **/
0276 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
0277 
0278 /**
0279  * hb_font_get_glyph_advances_func_t:
0280  * @font: #hb_font_t to work upon
0281  * @font_data: @font user data pointer
0282  * @count: The number of glyph IDs in the sequence queried
0283  * @first_glyph: The first glyph ID to query
0284  * @glyph_stride: The stride between successive glyph IDs
0285  * @first_advance: (out): The first advance retrieved
0286  * @advance_stride: The stride between successive advances
0287  * @user_data: User data pointer passed by the caller
0288  *
0289  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0290  *
0291  * This method should retrieve the advances for a sequence of glyphs.
0292  * 
0293  **/
0294 typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data,
0295                            unsigned int count,
0296                            const hb_codepoint_t *first_glyph,
0297                            unsigned glyph_stride,
0298                            hb_position_t *first_advance,
0299                            unsigned advance_stride,
0300                            void *user_data);
0301 
0302 /**
0303  * hb_font_get_glyph_h_advances_func_t:
0304  *
0305  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0306  *
0307  * This method should retrieve the advances for a sequence of glyphs, in
0308  * horizontal-direction text segments.
0309  * 
0310  **/
0311 typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t;
0312 
0313 /**
0314  * hb_font_get_glyph_v_advances_func_t:
0315  *
0316  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0317  *
0318  * This method should retrieve the advances for a sequence of glyphs, in
0319  * vertical-direction text segments.
0320  * 
0321  **/
0322 typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t;
0323 
0324 /**
0325  * hb_font_get_glyph_origin_func_t:
0326  * @font: #hb_font_t to work upon
0327  * @font_data: @font user data pointer
0328  * @glyph: The glyph ID to query
0329  * @x: (out): The X coordinate of the origin
0330  * @y: (out): The Y coordinate of the origin
0331  * @user_data: User data pointer passed by the caller
0332  *
0333  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0334  *
0335  * This method should retrieve the (X,Y) coordinates (in font units) of the
0336  * origin for a glyph. Each coordinate must be returned in an #hb_position_t
0337  * output parameter.
0338  *
0339  * Return value: `true` if data found, `false` otherwise
0340  * 
0341  **/
0342 typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,
0343                               hb_codepoint_t glyph,
0344                               hb_position_t *x, hb_position_t *y,
0345                               void *user_data);
0346 
0347 /**
0348  * hb_font_get_glyph_h_origin_func_t:
0349  *
0350  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0351  *
0352  * This method should retrieve the (X,Y) coordinates (in font units) of the
0353  * origin for a glyph, for horizontal-direction text segments. Each
0354  * coordinate must be returned in an #hb_position_t output parameter.
0355  * 
0356  **/
0357 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
0358 
0359 /**
0360  * hb_font_get_glyph_v_origin_func_t:
0361  *
0362  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0363  *
0364  * This method should retrieve the (X,Y) coordinates (in font units) of the
0365  * origin for a glyph, for vertical-direction text segments. Each coordinate
0366  * must be returned in an #hb_position_t output parameter.
0367  * 
0368  **/
0369 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
0370 
0371 /**
0372  * hb_font_get_glyph_kerning_func_t:
0373  * @font: #hb_font_t to work upon
0374  * @font_data: @font user data pointer
0375  * @first_glyph: The glyph ID of the first glyph in the glyph pair
0376  * @second_glyph: The glyph ID of the second glyph in the glyph pair
0377  * @user_data: User data pointer passed by the caller
0378  *
0379  * This method should retrieve the kerning-adjustment value for a glyph-pair in
0380  * the specified font, for horizontal text segments.
0381  *
0382  **/
0383 typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
0384                                hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
0385                                void *user_data);
0386 /**
0387  * hb_font_get_glyph_h_kerning_func_t:
0388  *
0389  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0390  *
0391  * This method should retrieve the kerning-adjustment value for a glyph-pair in
0392  * the specified font, for horizontal text segments.
0393  *
0394  **/
0395 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
0396 
0397 
0398 /**
0399  * hb_font_get_glyph_extents_func_t:
0400  * @font: #hb_font_t to work upon
0401  * @font_data: @font user data pointer
0402  * @glyph: The glyph ID to query
0403  * @extents: (out): The #hb_glyph_extents_t retrieved
0404  * @user_data: User data pointer passed by the caller
0405  *
0406  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0407  *
0408  * This method should retrieve the extents for a specified glyph. Extents must be 
0409  * returned in an #hb_glyph_extents output parameter.
0410  *
0411  * Return value: `true` if data found, `false` otherwise
0412  * 
0413  **/
0414 typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data,
0415                                hb_codepoint_t glyph,
0416                                hb_glyph_extents_t *extents,
0417                                void *user_data);
0418 
0419 /**
0420  * hb_font_get_glyph_contour_point_func_t:
0421  * @font: #hb_font_t to work upon
0422  * @font_data: @font user data pointer
0423  * @glyph: The glyph ID to query
0424  * @point_index: The contour-point index to query
0425  * @x: (out): The X value retrieved for the contour point
0426  * @y: (out): The Y value retrieved for the contour point
0427  * @user_data: User data pointer passed by the caller
0428  *
0429  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0430  *
0431  * This method should retrieve the (X,Y) coordinates (in font units) for a
0432  * specified contour point in a glyph. Each coordinate must be returned as
0433  * an #hb_position_t output parameter.
0434  * 
0435  * Return value: `true` if data found, `false` otherwise
0436  *
0437  **/
0438 typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data,
0439                                  hb_codepoint_t glyph, unsigned int point_index,
0440                                  hb_position_t *x, hb_position_t *y,
0441                                  void *user_data);
0442 
0443 
0444 /**
0445  * hb_font_get_glyph_name_func_t:
0446  * @font: #hb_font_t to work upon
0447  * @font_data: @font user data pointer
0448  * @glyph: The glyph ID to query
0449  * @name: (out) (array length=size): Name string retrieved for the glyph ID
0450  * @size: Length of the glyph-name string retrieved
0451  * @user_data: User data pointer passed by the caller
0452  *
0453  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0454  *
0455  * This method should retrieve the glyph name that corresponds to a
0456  * glyph ID. The name should be returned in a string output parameter.
0457  * 
0458  * Return value: `true` if data found, `false` otherwise
0459  *
0460  **/
0461 typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data,
0462                             hb_codepoint_t glyph,
0463                             char *name, unsigned int size,
0464                             void *user_data);
0465 
0466 /**
0467  * hb_font_get_glyph_from_name_func_t:
0468  * @font: #hb_font_t to work upon
0469  * @font_data: @font user data pointer
0470  * @name: (array length=len): The name string to query
0471  * @len: The length of the name queried
0472  * @glyph: (out): The glyph ID retrieved
0473  * @user_data: User data pointer passed by the caller
0474  *
0475  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0476  *
0477  * This method should retrieve the glyph ID that corresponds to a glyph-name
0478  * string. 
0479  * 
0480  * Return value: `true` if data found, `false` otherwise
0481  *
0482  **/
0483 typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data,
0484                              const char *name, int len, /* -1 means nul-terminated */
0485                              hb_codepoint_t *glyph,
0486                              void *user_data);
0487 
0488 /**
0489  * hb_font_draw_glyph_func_t:
0490  * @font: #hb_font_t to work upon
0491  * @font_data: @font user data pointer
0492  * @glyph: The glyph ID to query
0493  * @draw_funcs: The draw functions to send the shape data to
0494  * @draw_data: The data accompanying the draw functions
0495  * @user_data: User data pointer passed by the caller
0496  *
0497  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0498  *
0499  * Since: 7.0.0
0500  *
0501  **/
0502 typedef void (*hb_font_draw_glyph_func_t) (hb_font_t *font, void *font_data,
0503                                            hb_codepoint_t glyph,
0504                                            hb_draw_funcs_t *draw_funcs, void *draw_data,
0505                                            void *user_data);
0506 
0507 /**
0508  * hb_font_paint_glyph_func_t:
0509  * @font: #hb_font_t to work upon
0510  * @font_data: @font user data pointer
0511  * @glyph: The glyph ID to query
0512  * @paint_funcs: The paint functions to use
0513  * @paint_data: The data accompanying the paint functions
0514  * @palette_index: The color palette to use
0515  * @foreground: The foreground color
0516  * @user_data: User data pointer passed by the caller
0517  *
0518  * A virtual method for the #hb_font_funcs_t of an #hb_font_t object.
0519  *
0520  * Since: 7.0.0
0521  */
0522 typedef void (*hb_font_paint_glyph_func_t) (hb_font_t *font, void *font_data,
0523                                             hb_codepoint_t glyph,
0524                                             hb_paint_funcs_t *paint_funcs, void *paint_data,
0525                                             unsigned int palette_index,
0526                                             hb_color_t foreground,
0527                                             void *user_data);
0528 
0529 /* func setters */
0530 
0531 /**
0532  * hb_font_funcs_set_font_h_extents_func:
0533  * @ffuncs: A font-function structure
0534  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0535  * @user_data: Data to pass to @func
0536  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0537  *
0538  * Sets the implementation function for #hb_font_get_font_h_extents_func_t.
0539  *
0540  * Since: 1.1.2
0541  **/
0542 HB_EXTERN void
0543 hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,
0544                        hb_font_get_font_h_extents_func_t func,
0545                        void *user_data, hb_destroy_func_t destroy);
0546 
0547 /**
0548  * hb_font_funcs_set_font_v_extents_func:
0549  * @ffuncs: A font-function structure
0550  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0551  * @user_data: Data to pass to @func
0552  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0553  *
0554  * Sets the implementation function for #hb_font_get_font_v_extents_func_t.
0555  *
0556  * Since: 1.1.2
0557  **/
0558 HB_EXTERN void
0559 hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,
0560                        hb_font_get_font_v_extents_func_t func,
0561                        void *user_data, hb_destroy_func_t destroy);
0562 
0563 /**
0564  * hb_font_funcs_set_nominal_glyph_func:
0565  * @ffuncs: A font-function structure
0566  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0567  * @user_data: Data to pass to @func
0568  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0569  *
0570  * Sets the implementation function for #hb_font_get_nominal_glyph_func_t.
0571  *
0572  * Since: 1.2.3
0573  **/
0574 HB_EXTERN void
0575 hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
0576                       hb_font_get_nominal_glyph_func_t func,
0577                       void *user_data, hb_destroy_func_t destroy);
0578 
0579 /**
0580  * hb_font_funcs_set_nominal_glyphs_func:
0581  * @ffuncs: A font-function structure
0582  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0583  * @user_data: Data to pass to @func
0584  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0585  *
0586  * Sets the implementation function for #hb_font_get_nominal_glyphs_func_t.
0587  *
0588  * Since: 2.0.0
0589  **/
0590 HB_EXTERN void
0591 hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs,
0592                        hb_font_get_nominal_glyphs_func_t func,
0593                        void *user_data, hb_destroy_func_t destroy);
0594 
0595 /**
0596  * hb_font_funcs_set_variation_glyph_func:
0597  * @ffuncs: A font-function structure
0598  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0599  * @user_data: Data to pass to @func
0600  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0601  *
0602  * Sets the implementation function for #hb_font_get_variation_glyph_func_t.
0603  *
0604  * Since: 1.2.3
0605  **/
0606 HB_EXTERN void
0607 hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,
0608                     hb_font_get_variation_glyph_func_t func,
0609                     void *user_data, hb_destroy_func_t destroy);
0610 
0611 /**
0612  * hb_font_funcs_set_glyph_h_advance_func:
0613  * @ffuncs: A font-function structure
0614  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0615  * @user_data: Data to pass to @func
0616  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0617  *
0618  * Sets the implementation function for #hb_font_get_glyph_h_advance_func_t.
0619  *
0620  * Since: 0.9.2
0621  **/
0622 HB_EXTERN void
0623 hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
0624                     hb_font_get_glyph_h_advance_func_t func,
0625                     void *user_data, hb_destroy_func_t destroy);
0626 
0627 /**
0628  * hb_font_funcs_set_glyph_v_advance_func:
0629  * @ffuncs: A font-function structure
0630  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0631  * @user_data: Data to pass to @func
0632  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0633  *
0634  * Sets the implementation function for #hb_font_get_glyph_v_advance_func_t.
0635  *
0636  * Since: 0.9.2
0637  **/
0638 HB_EXTERN void
0639 hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
0640                     hb_font_get_glyph_v_advance_func_t func,
0641                     void *user_data, hb_destroy_func_t destroy);
0642 
0643 /**
0644  * hb_font_funcs_set_glyph_h_advances_func:
0645  * @ffuncs: A font-function structure
0646  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0647  * @user_data: Data to pass to @func
0648  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0649  *
0650  * Sets the implementation function for #hb_font_get_glyph_h_advances_func_t.
0651  *
0652  * Since: 1.8.6
0653  **/
0654 HB_EXTERN void
0655 hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs,
0656                     hb_font_get_glyph_h_advances_func_t func,
0657                     void *user_data, hb_destroy_func_t destroy);
0658 
0659 /**
0660  * hb_font_funcs_set_glyph_v_advances_func:
0661  * @ffuncs: A font-function structure
0662  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0663  * @user_data: Data to pass to @func
0664  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0665  *
0666  * Sets the implementation function for #hb_font_get_glyph_v_advances_func_t.
0667  *
0668  * Since: 1.8.6
0669  **/
0670 HB_EXTERN void
0671 hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs,
0672                     hb_font_get_glyph_v_advances_func_t func,
0673                     void *user_data, hb_destroy_func_t destroy);
0674 
0675 /**
0676  * hb_font_funcs_set_glyph_h_origin_func:
0677  * @ffuncs: A font-function structure
0678  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0679  * @user_data: Data to pass to @func
0680  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0681  *
0682  * Sets the implementation function for #hb_font_get_glyph_h_origin_func_t.
0683  *
0684  * Since: 0.9.2
0685  **/
0686 HB_EXTERN void
0687 hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
0688                        hb_font_get_glyph_h_origin_func_t func,
0689                        void *user_data, hb_destroy_func_t destroy);
0690 
0691 /**
0692  * hb_font_funcs_set_glyph_v_origin_func:
0693  * @ffuncs: A font-function structure
0694  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0695  * @user_data: Data to pass to @func
0696  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0697  *
0698  * Sets the implementation function for #hb_font_get_glyph_v_origin_func_t.
0699  *
0700  * Since: 0.9.2
0701  **/
0702 HB_EXTERN void
0703 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
0704                        hb_font_get_glyph_v_origin_func_t func,
0705                        void *user_data, hb_destroy_func_t destroy);
0706 
0707 /**
0708  * hb_font_funcs_set_glyph_h_kerning_func:
0709  * @ffuncs: A font-function structure
0710  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0711  * @user_data: Data to pass to @func
0712  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0713  *
0714  * Sets the implementation function for #hb_font_get_glyph_h_kerning_func_t.
0715  *
0716  * Since: 0.9.2
0717  **/
0718 HB_EXTERN void
0719 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
0720                     hb_font_get_glyph_h_kerning_func_t func,
0721                     void *user_data, hb_destroy_func_t destroy);
0722 
0723 /**
0724  * hb_font_funcs_set_glyph_extents_func:
0725  * @ffuncs: A font-function structure
0726  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0727  * @user_data: Data to pass to @func
0728  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0729  *
0730  * Sets the implementation function for #hb_font_get_glyph_extents_func_t.
0731  *
0732  * Since: 0.9.2
0733  **/
0734 HB_EXTERN void
0735 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
0736                       hb_font_get_glyph_extents_func_t func,
0737                       void *user_data, hb_destroy_func_t destroy);
0738 
0739 /**
0740  * hb_font_funcs_set_glyph_contour_point_func:
0741  * @ffuncs: A font-function structure
0742  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0743  * @user_data: Data to pass to @func
0744  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0745  *
0746  * Sets the implementation function for #hb_font_get_glyph_contour_point_func_t.
0747  *
0748  * Since: 0.9.2
0749  **/
0750 HB_EXTERN void
0751 hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
0752                         hb_font_get_glyph_contour_point_func_t func,
0753                         void *user_data, hb_destroy_func_t destroy);
0754 
0755 /**
0756  * hb_font_funcs_set_glyph_name_func:
0757  * @ffuncs: A font-function structure
0758  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0759  * @user_data: Data to pass to @func
0760  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0761  *
0762  * Sets the implementation function for #hb_font_get_glyph_name_func_t.
0763  *
0764  * Since: 0.9.2
0765  **/
0766 HB_EXTERN void
0767 hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
0768                    hb_font_get_glyph_name_func_t func,
0769                    void *user_data, hb_destroy_func_t destroy);
0770 
0771 /**
0772  * hb_font_funcs_set_glyph_from_name_func:
0773  * @ffuncs: A font-function structure
0774  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0775  * @user_data: Data to pass to @func
0776  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0777  *
0778  * Sets the implementation function for #hb_font_get_glyph_from_name_func_t.
0779  *
0780  * Since: 0.9.2
0781  **/
0782 HB_EXTERN void
0783 hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
0784                     hb_font_get_glyph_from_name_func_t func,
0785                     void *user_data, hb_destroy_func_t destroy);
0786 
0787 /**
0788  * hb_font_funcs_set_draw_glyph_func:
0789  * @ffuncs: A font-function structure
0790  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0791  * @user_data: Data to pass to @func
0792  * @destroy: (nullable): The function to call when @user_data is not needed anymore
0793  *
0794  * Sets the implementation function for #hb_font_draw_glyph_func_t.
0795  *
0796  * Since: 7.0.0
0797  **/
0798 HB_EXTERN void
0799 hb_font_funcs_set_draw_glyph_func (hb_font_funcs_t *ffuncs,
0800                                    hb_font_draw_glyph_func_t func,
0801                                    void *user_data, hb_destroy_func_t destroy);
0802 
0803 /**
0804  * hb_font_funcs_set_paint_glyph_func:
0805  * @ffuncs: A font-function structure
0806  * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
0807  * @user_data: Data to pass to @func
0808  * @destroy: (nullable): The function to call when @user_data is no longer needed
0809  *
0810  * Sets the implementation function for #hb_font_paint_glyph_func_t.
0811  *
0812  * Since: 7.0.0
0813  */
0814 HB_EXTERN void
0815 hb_font_funcs_set_paint_glyph_func (hb_font_funcs_t *ffuncs,
0816                                     hb_font_paint_glyph_func_t func,
0817                                     void *user_data, hb_destroy_func_t destroy);
0818 
0819 /* func dispatch */
0820 
0821 HB_EXTERN hb_bool_t
0822 hb_font_get_h_extents (hb_font_t *font,
0823                hb_font_extents_t *extents);
0824 HB_EXTERN hb_bool_t
0825 hb_font_get_v_extents (hb_font_t *font,
0826                hb_font_extents_t *extents);
0827 
0828 HB_EXTERN hb_bool_t
0829 hb_font_get_nominal_glyph (hb_font_t *font,
0830                hb_codepoint_t unicode,
0831                hb_codepoint_t *glyph);
0832 HB_EXTERN hb_bool_t
0833 hb_font_get_variation_glyph (hb_font_t *font,
0834                  hb_codepoint_t unicode, hb_codepoint_t variation_selector,
0835                  hb_codepoint_t *glyph);
0836 
0837 HB_EXTERN unsigned int
0838 hb_font_get_nominal_glyphs (hb_font_t *font,
0839                 unsigned int count,
0840                 const hb_codepoint_t *first_unicode,
0841                 unsigned int unicode_stride,
0842                 hb_codepoint_t *first_glyph,
0843                 unsigned int glyph_stride);
0844 
0845 HB_EXTERN hb_position_t
0846 hb_font_get_glyph_h_advance (hb_font_t *font,
0847                  hb_codepoint_t glyph);
0848 HB_EXTERN hb_position_t
0849 hb_font_get_glyph_v_advance (hb_font_t *font,
0850                  hb_codepoint_t glyph);
0851 
0852 HB_EXTERN void
0853 hb_font_get_glyph_h_advances (hb_font_t* font,
0854                   unsigned int count,
0855                   const hb_codepoint_t *first_glyph,
0856                   unsigned glyph_stride,
0857                   hb_position_t *first_advance,
0858                   unsigned advance_stride);
0859 HB_EXTERN void
0860 hb_font_get_glyph_v_advances (hb_font_t* font,
0861                   unsigned int count,
0862                   const hb_codepoint_t *first_glyph,
0863                   unsigned glyph_stride,
0864                   hb_position_t *first_advance,
0865                   unsigned advance_stride);
0866 
0867 HB_EXTERN hb_bool_t
0868 hb_font_get_glyph_h_origin (hb_font_t *font,
0869                 hb_codepoint_t glyph,
0870                 hb_position_t *x, hb_position_t *y);
0871 HB_EXTERN hb_bool_t
0872 hb_font_get_glyph_v_origin (hb_font_t *font,
0873                 hb_codepoint_t glyph,
0874                 hb_position_t *x, hb_position_t *y);
0875 
0876 HB_EXTERN hb_position_t
0877 hb_font_get_glyph_h_kerning (hb_font_t *font,
0878                  hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
0879 
0880 HB_EXTERN hb_bool_t
0881 hb_font_get_glyph_extents (hb_font_t *font,
0882                hb_codepoint_t glyph,
0883                hb_glyph_extents_t *extents);
0884 
0885 HB_EXTERN hb_bool_t
0886 hb_font_get_glyph_contour_point (hb_font_t *font,
0887                  hb_codepoint_t glyph, unsigned int point_index,
0888                  hb_position_t *x, hb_position_t *y);
0889 
0890 HB_EXTERN hb_bool_t
0891 hb_font_get_glyph_name (hb_font_t *font,
0892             hb_codepoint_t glyph,
0893             char *name, unsigned int size);
0894 HB_EXTERN hb_bool_t
0895 hb_font_get_glyph_from_name (hb_font_t *font,
0896                  const char *name, int len, /* -1 means nul-terminated */
0897                  hb_codepoint_t *glyph);
0898 
0899 HB_EXTERN void
0900 hb_font_draw_glyph (hb_font_t *font,
0901                     hb_codepoint_t glyph,
0902                     hb_draw_funcs_t *dfuncs, void *draw_data);
0903 
0904 HB_EXTERN void
0905 hb_font_paint_glyph (hb_font_t *font,
0906                      hb_codepoint_t glyph,
0907                      hb_paint_funcs_t *pfuncs, void *paint_data,
0908                      unsigned int palette_index,
0909                      hb_color_t foreground);
0910 
0911 /* high-level funcs, with fallback */
0912 
0913 /* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
0914  * otherwise calls hb_font_get_variation_glyph(). */
0915 HB_EXTERN hb_bool_t
0916 hb_font_get_glyph (hb_font_t *font,
0917            hb_codepoint_t unicode, hb_codepoint_t variation_selector,
0918            hb_codepoint_t *glyph);
0919 
0920 HB_EXTERN void
0921 hb_font_get_extents_for_direction (hb_font_t *font,
0922                    hb_direction_t direction,
0923                    hb_font_extents_t *extents);
0924 HB_EXTERN void
0925 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
0926                      hb_codepoint_t glyph,
0927                      hb_direction_t direction,
0928                      hb_position_t *x, hb_position_t *y);
0929 HB_EXTERN void
0930 hb_font_get_glyph_advances_for_direction (hb_font_t* font,
0931                       hb_direction_t direction,
0932                       unsigned int count,
0933                       const hb_codepoint_t *first_glyph,
0934                       unsigned glyph_stride,
0935                       hb_position_t *first_advance,
0936                       unsigned advance_stride);
0937 HB_EXTERN void
0938 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
0939                     hb_codepoint_t glyph,
0940                     hb_direction_t direction,
0941                     hb_position_t *x, hb_position_t *y);
0942 HB_EXTERN void
0943 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
0944                     hb_codepoint_t glyph,
0945                     hb_direction_t direction,
0946                     hb_position_t *x, hb_position_t *y);
0947 HB_EXTERN void
0948 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
0949                          hb_codepoint_t glyph,
0950                          hb_direction_t direction,
0951                          hb_position_t *x, hb_position_t *y);
0952 
0953 HB_EXTERN void
0954 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
0955                      hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
0956                      hb_direction_t direction,
0957                      hb_position_t *x, hb_position_t *y);
0958 
0959 HB_EXTERN hb_bool_t
0960 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
0961                       hb_codepoint_t glyph,
0962                       hb_direction_t direction,
0963                       hb_glyph_extents_t *extents);
0964 
0965 HB_EXTERN hb_bool_t
0966 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
0967                         hb_codepoint_t glyph, unsigned int point_index,
0968                         hb_direction_t direction,
0969                         hb_position_t *x, hb_position_t *y);
0970 
0971 /* Generates gidDDD if glyph has no name. */
0972 HB_EXTERN void
0973 hb_font_glyph_to_string (hb_font_t *font,
0974              hb_codepoint_t glyph,
0975              char *s, unsigned int size);
0976 /* Parses gidDDD and uniUUUU strings automatically. */
0977 HB_EXTERN hb_bool_t
0978 hb_font_glyph_from_string (hb_font_t *font,
0979                const char *s, int len, /* -1 means nul-terminated */
0980                hb_codepoint_t *glyph);
0981 
0982 
0983 /*
0984  * hb_font_t
0985  */
0986 
0987 /* Fonts are very light-weight objects */
0988 
0989 HB_EXTERN hb_font_t *
0990 hb_font_create (hb_face_t *face);
0991 
0992 HB_EXTERN hb_font_t *
0993 hb_font_create_sub_font (hb_font_t *parent);
0994 
0995 HB_EXTERN hb_font_t *
0996 hb_font_get_empty (void);
0997 
0998 HB_EXTERN hb_font_t *
0999 hb_font_reference (hb_font_t *font);
1000 
1001 HB_EXTERN void
1002 hb_font_destroy (hb_font_t *font);
1003 
1004 HB_EXTERN hb_bool_t
1005 hb_font_set_user_data (hb_font_t          *font,
1006                hb_user_data_key_t *key,
1007                void *              data,
1008                hb_destroy_func_t   destroy,
1009                hb_bool_t           replace);
1010 
1011 
1012 HB_EXTERN void *
1013 hb_font_get_user_data (const hb_font_t    *font,
1014                hb_user_data_key_t *key);
1015 
1016 HB_EXTERN void
1017 hb_font_make_immutable (hb_font_t *font);
1018 
1019 HB_EXTERN hb_bool_t
1020 hb_font_is_immutable (hb_font_t *font);
1021 
1022 HB_EXTERN unsigned int
1023 hb_font_get_serial (hb_font_t *font);
1024 
1025 HB_EXTERN void
1026 hb_font_changed (hb_font_t *font);
1027 
1028 HB_EXTERN void
1029 hb_font_set_parent (hb_font_t *font,
1030             hb_font_t *parent);
1031 
1032 HB_EXTERN hb_font_t *
1033 hb_font_get_parent (hb_font_t *font);
1034 
1035 HB_EXTERN void
1036 hb_font_set_face (hb_font_t *font,
1037           hb_face_t *face);
1038 
1039 HB_EXTERN hb_face_t *
1040 hb_font_get_face (hb_font_t *font);
1041 
1042 
1043 HB_EXTERN void
1044 hb_font_set_funcs (hb_font_t         *font,
1045            hb_font_funcs_t   *klass,
1046            void              *font_data,
1047            hb_destroy_func_t  destroy);
1048 
1049 /* Be *very* careful with this function! */
1050 HB_EXTERN void
1051 hb_font_set_funcs_data (hb_font_t         *font,
1052             void              *font_data,
1053             hb_destroy_func_t  destroy);
1054 
1055 
1056 HB_EXTERN void
1057 hb_font_set_scale (hb_font_t *font,
1058            int x_scale,
1059            int y_scale);
1060 
1061 HB_EXTERN void
1062 hb_font_get_scale (hb_font_t *font,
1063            int *x_scale,
1064            int *y_scale);
1065 
1066 /*
1067  * A zero value means "no hinting in that direction"
1068  */
1069 HB_EXTERN void
1070 hb_font_set_ppem (hb_font_t *font,
1071           unsigned int x_ppem,
1072           unsigned int y_ppem);
1073 
1074 HB_EXTERN void
1075 hb_font_get_ppem (hb_font_t *font,
1076           unsigned int *x_ppem,
1077           unsigned int *y_ppem);
1078 
1079 /*
1080  * Point size per EM.  Used for optical-sizing in CoreText.
1081  * A value of zero means "not set".
1082  */
1083 HB_EXTERN void
1084 hb_font_set_ptem (hb_font_t *font, float ptem);
1085 
1086 HB_EXTERN float
1087 hb_font_get_ptem (hb_font_t *font);
1088 
1089 HB_EXTERN void
1090 hb_font_set_synthetic_bold (hb_font_t *font,
1091                 float x_embolden, float y_embolden,
1092                 hb_bool_t in_place);
1093 
1094 HB_EXTERN void
1095 hb_font_get_synthetic_bold (hb_font_t *font,
1096                 float *x_embolden, float *y_embolden,
1097                 hb_bool_t *in_place);
1098 
1099 HB_EXTERN void
1100 hb_font_set_synthetic_slant (hb_font_t *font, float slant);
1101 
1102 HB_EXTERN float
1103 hb_font_get_synthetic_slant (hb_font_t *font);
1104 
1105 HB_EXTERN void
1106 hb_font_set_variations (hb_font_t *font,
1107             const hb_variation_t *variations,
1108             unsigned int variations_length);
1109 
1110 HB_EXTERN void
1111 hb_font_set_variation (hb_font_t *font,
1112                hb_tag_t tag,
1113                float    value);
1114 
1115 HB_EXTERN void
1116 hb_font_set_var_coords_design (hb_font_t *font,
1117                    const float *coords,
1118                    unsigned int coords_length);
1119 
1120 HB_EXTERN const float *
1121 hb_font_get_var_coords_design (hb_font_t *font,
1122                    unsigned int *length);
1123 
1124 HB_EXTERN void
1125 hb_font_set_var_coords_normalized (hb_font_t *font,
1126                    const int *coords, /* 2.14 normalized */
1127                    unsigned int coords_length);
1128 
1129 HB_EXTERN const int *
1130 hb_font_get_var_coords_normalized (hb_font_t *font,
1131                    unsigned int *length);
1132 
1133 /**
1134  * HB_FONT_NO_VAR_NAMED_INSTANCE:
1135  *
1136  * Constant signifying that a font does not have any
1137  * named-instance index set.  This is the default of
1138  * a font.
1139  *
1140  * Since: 7.0.0
1141  */
1142 #define HB_FONT_NO_VAR_NAMED_INSTANCE 0xFFFFFFFF
1143 
1144 HB_EXTERN void
1145 hb_font_set_var_named_instance (hb_font_t *font,
1146                 unsigned int instance_index);
1147 
1148 HB_EXTERN unsigned int
1149 hb_font_get_var_named_instance (hb_font_t *font);
1150 
1151 HB_END_DECLS
1152 
1153 #endif /* HB_FONT_H */