Path: blob/master/src/java.desktop/share/native/libharfbuzz/hb-font.h
41152 views
/*1* Copyright © 2009 Red Hat, Inc.2*3* This is part of HarfBuzz, a text shaping library.4*5* Permission is hereby granted, without written agreement and without6* license or royalty fees, to use, copy, modify, and distribute this7* software and its documentation for any purpose, provided that the8* above copyright notice and the following two paragraphs appear in9* all copies of this software.10*11* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR12* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES13* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN14* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH15* DAMAGE.16*17* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,18* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND19* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS20* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO21* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.22*23* Red Hat Author(s): Behdad Esfahbod24*/2526#if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)27#error "Include <hb.h> instead."28#endif2930#ifndef HB_FONT_H31#define HB_FONT_H3233#include "hb-common.h"34#include "hb-face.h"35#include "hb-draw.h"3637HB_BEGIN_DECLS3839/**40* hb_font_t:41*42* Data type for holding fonts.43*44*/45typedef struct hb_font_t hb_font_t;464748/*49* hb_font_funcs_t50*/5152/**53* hb_font_funcs_t:54*55* Data type containing a set of virtual methods used for56* working on #hb_font_t font objects.57*58* HarfBuzz provides a lightweight default function for each of59* the methods in #hb_font_funcs_t. Client programs can implement60* their own replacements for the individual font functions, as61* needed, and replace the default by calling the setter for a62* method.63*64**/65typedef struct hb_font_funcs_t hb_font_funcs_t;6667HB_EXTERN hb_font_funcs_t *68hb_font_funcs_create (void);6970HB_EXTERN hb_font_funcs_t *71hb_font_funcs_get_empty (void);7273HB_EXTERN hb_font_funcs_t *74hb_font_funcs_reference (hb_font_funcs_t *ffuncs);7576HB_EXTERN void77hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);7879HB_EXTERN hb_bool_t80hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,81hb_user_data_key_t *key,82void * data,83hb_destroy_func_t destroy,84hb_bool_t replace);858687HB_EXTERN void *88hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,89hb_user_data_key_t *key);909192HB_EXTERN void93hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);9495HB_EXTERN hb_bool_t96hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);979899/* font and glyph extents */100101/**102* hb_font_extents_t:103* @ascender: The height of typographic ascenders.104* @descender: The depth of typographic descenders.105* @line_gap: The suggested line-spacing gap.106*107* Font-wide extent values, measured in font units.108*109* Note that typically @ascender is positive and @descender110* negative, in coordinate systems that grow up.111**/112typedef struct hb_font_extents_t {113hb_position_t ascender;114hb_position_t descender;115hb_position_t line_gap;116/*< private >*/117hb_position_t reserved9;118hb_position_t reserved8;119hb_position_t reserved7;120hb_position_t reserved6;121hb_position_t reserved5;122hb_position_t reserved4;123hb_position_t reserved3;124hb_position_t reserved2;125hb_position_t reserved1;126} hb_font_extents_t;127128/**129* hb_glyph_extents_t:130* @x_bearing: Distance from the x-origin to the left extremum of the glyph.131* @y_bearing: Distance from the top extremum of the glyph to the y-origin.132* @width: Distance from the left extremum of the glyph to the right extremum.133* @height: Distance from the top extremum of the glyph to the bottom extremum.134*135* Glyph extent values, measured in font units.136*137* Note that @height is negative, in coordinate systems that grow up.138**/139typedef struct hb_glyph_extents_t {140hb_position_t x_bearing;141hb_position_t y_bearing;142hb_position_t width;143hb_position_t height;144} hb_glyph_extents_t;145146/* func types */147148/**149* hb_font_get_font_extents_func_t:150* @font: #hb_font_t to work upon151* @font_data: @font user data pointer152* @extents: (out): The font extents retrieved153* @user_data: User data pointer passed by the caller154*155* This method should retrieve the extents for a font.156*157**/158typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,159hb_font_extents_t *extents,160void *user_data);161162/**163* hb_font_get_font_h_extents_func_t:164*165* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.166*167* This method should retrieve the extents for a font, for horizontal-direction168* text segments. Extents must be returned in an #hb_glyph_extents output169* parameter.170*171**/172typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;173174/**175* hb_font_get_font_v_extents_func_t:176*177* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.178*179* This method should retrieve the extents for a font, for vertical-direction180* text segments. Extents must be returned in an #hb_glyph_extents output181* parameter.182*183**/184typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;185186187/**188* hb_font_get_nominal_glyph_func_t:189* @font: #hb_font_t to work upon190* @font_data: @font user data pointer191* @unicode: The Unicode code point to query192* @glyph: (out): The glyph ID retrieved193* @user_data: User data pointer passed by the caller194*195* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.196*197* This method should retrieve the nominal glyph ID for a specified Unicode code198* point. Glyph IDs must be returned in a #hb_codepoint_t output parameter.199*200* Return value: %true if data found, %false otherwise201*202**/203typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,204hb_codepoint_t unicode,205hb_codepoint_t *glyph,206void *user_data);207208/**209* hb_font_get_variation_glyph_func_t:210* @font: #hb_font_t to work upon211* @font_data: @font user data pointer212* @unicode: The Unicode code point to query213* @variation_selector: The variation-selector code point to query214* @glyph: (out): The glyph ID retrieved215* @user_data: User data pointer passed by the caller216*217* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.218*219* This method should retrieve the glyph ID for a specified Unicode code point220* followed by a specified Variation Selector code point. Glyph IDs must be221* returned in a #hb_codepoint_t output parameter.222*223* Return value: %true if data found, %false otherwise224*225**/226typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,227hb_codepoint_t unicode, hb_codepoint_t variation_selector,228hb_codepoint_t *glyph,229void *user_data);230231232/**233* hb_font_get_nominal_glyphs_func_t:234* @font: #hb_font_t to work upon235* @font_data: @font user data pointer236* @count: number of code points to query237* @first_unicode: The first Unicode code point to query238* @unicode_stride: The stride between successive code points239* @first_glyph: (out): The first glyph ID retrieved240* @glyph_stride: The stride between successive glyph IDs241* @user_data: User data pointer passed by the caller242*243* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.244*245* This method should retrieve the nominal glyph IDs for a sequence of246* Unicode code points. Glyph IDs must be returned in a #hb_codepoint_t247* output parameter.248*249* Return value: the number of code points processed250*251**/252typedef unsigned int (*hb_font_get_nominal_glyphs_func_t) (hb_font_t *font, void *font_data,253unsigned int count,254const hb_codepoint_t *first_unicode,255unsigned int unicode_stride,256hb_codepoint_t *first_glyph,257unsigned int glyph_stride,258void *user_data);259260/**261* hb_font_get_glyph_advance_func_t:262* @font: #hb_font_t to work upon263* @font_data: @font user data pointer264* @glyph: The glyph ID to query265* @user_data: User data pointer passed by the caller266*267* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.268*269* This method should retrieve the advance for a specified glyph. The270* method must return an #hb_position_t.271*272* Return value: The advance of @glyph within @font273*274**/275typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,276hb_codepoint_t glyph,277void *user_data);278279/**280* hb_font_get_glyph_h_advance_func_t:281*282* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.283*284* This method should retrieve the advance for a specified glyph, in285* horizontal-direction text segments. Advances must be returned in286* an #hb_position_t output parameter.287*288**/289typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;290291/**292* hb_font_get_glyph_v_advance_func_t:293*294* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.295*296* This method should retrieve the advance for a specified glyph, in297* vertical-direction text segments. Advances must be returned in298* an #hb_position_t output parameter.299*300**/301typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;302303/**304* hb_font_get_glyph_advances_func_t:305* @font: #hb_font_t to work upon306* @font_data: @font user data pointer307* @count: The number of glyph IDs in the sequence queried308* @first_glyph: The first glyph ID to query309* @glyph_stride: The stride between successive glyph IDs310* @first_advance: (out): The first advance retrieved311* @advance_stride: The stride between successive advances312* @user_data: User data pointer passed by the caller313*314* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.315*316* This method should retrieve the advances for a sequence of glyphs.317*318**/319typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data,320unsigned int count,321const hb_codepoint_t *first_glyph,322unsigned glyph_stride,323hb_position_t *first_advance,324unsigned advance_stride,325void *user_data);326327/**328* hb_font_get_glyph_h_advances_func_t:329*330* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.331*332* This method should retrieve the advances for a sequence of glyphs, in333* horizontal-direction text segments.334*335**/336typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t;337338/**339* hb_font_get_glyph_v_advances_func_t:340*341* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.342*343* This method should retrieve the advances for a sequence of glyphs, in344* vertical-direction text segments.345*346**/347typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t;348349/**350* hb_font_get_glyph_origin_func_t:351* @font: #hb_font_t to work upon352* @font_data: @font user data pointer353* @glyph: The glyph ID to query354* @x: (out): The X coordinate of the origin355* @y: (out): The Y coordinate of the origin356* @user_data: User data pointer passed by the caller357*358* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.359*360* This method should retrieve the (X,Y) coordinates (in font units) of the361* origin for a glyph. Each coordinate must be returned in an #hb_position_t362* output parameter.363*364* Return value: %true if data found, %false otherwise365*366**/367typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,368hb_codepoint_t glyph,369hb_position_t *x, hb_position_t *y,370void *user_data);371372/**373* hb_font_get_glyph_h_origin_func_t:374*375* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.376*377* This method should retrieve the (X,Y) coordinates (in font units) of the378* origin for a glyph, for horizontal-direction text segments. Each379* coordinate must be returned in an #hb_position_t output parameter.380*381**/382typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;383384/**385* hb_font_get_glyph_v_origin_func_t:386*387* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.388*389* This method should retrieve the (X,Y) coordinates (in font units) of the390* origin for a glyph, for vertical-direction text segments. Each coordinate391* must be returned in an #hb_position_t output parameter.392*393**/394typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;395396/**397* hb_font_get_glyph_kerning_func_t:398* @font: #hb_font_t to work upon399* @font_data: @font user data pointer400* @first_glyph: The glyph ID of the first glyph in the glyph pair401* @second_glyph: The glyph ID of the second glyph in the glyph pair402* @user_data: User data pointer passed by the caller403*404* This method should retrieve the kerning-adjustment value for a glyph-pair in405* the specified font, for horizontal text segments.406*407**/408typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,409hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,410void *user_data);411/**412* hb_font_get_glyph_h_kerning_func_t:413*414* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.415*416* This method should retrieve the kerning-adjustment value for a glyph-pair in417* the specified font, for horizontal text segments.418*419**/420typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;421422423/**424* hb_font_get_glyph_extents_func_t:425* @font: #hb_font_t to work upon426* @font_data: @font user data pointer427* @glyph: The glyph ID to query428* @extents: (out): The #hb_glyph_extents_t retrieved429* @user_data: User data pointer passed by the caller430*431* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.432*433* This method should retrieve the extents for a specified glyph. Extents must be434* returned in an #hb_glyph_extents output parameter.435*436* Return value: %true if data found, %false otherwise437*438**/439typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data,440hb_codepoint_t glyph,441hb_glyph_extents_t *extents,442void *user_data);443444/**445* hb_font_get_glyph_contour_point_func_t:446* @font: #hb_font_t to work upon447* @font_data: @font user data pointer448* @glyph: The glyph ID to query449* @point_index: The contour-point index to query450* @x: (out): The X value retrieved for the contour point451* @y: (out): The Y value retrieved for the contour point452* @user_data: User data pointer passed by the caller453*454* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.455*456* This method should retrieve the (X,Y) coordinates (in font units) for a457* specified contour point in a glyph. Each coordinate must be returned as458* an #hb_position_t output parameter.459*460* Return value: %true if data found, %false otherwise461*462**/463typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data,464hb_codepoint_t glyph, unsigned int point_index,465hb_position_t *x, hb_position_t *y,466void *user_data);467468469/**470* hb_font_get_glyph_name_func_t:471* @font: #hb_font_t to work upon472* @font_data: @font user data pointer473* @glyph: The glyph ID to query474* @name: (out) (array length=size): Name string retrieved for the glyph ID475* @size: Length of the glyph-name string retrieved476* @user_data: User data pointer passed by the caller477*478* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.479*480* This method should retrieve the glyph name that corresponds to a481* glyph ID. The name should be returned in a string output parameter.482*483* Return value: %true if data found, %false otherwise484*485**/486typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data,487hb_codepoint_t glyph,488char *name, unsigned int size,489void *user_data);490491/**492* hb_font_get_glyph_from_name_func_t:493* @font: #hb_font_t to work upon494* @font_data: @font user data pointer495* @name: (array length=len): The name string to query496* @len: The length of the name queried497* @glyph: (out): The glyph ID retrieved498* @user_data: User data pointer passed by the caller499*500* A virtual method for the #hb_font_funcs_t of an #hb_font_t object.501*502* This method should retrieve the glyph ID that corresponds to a glyph-name503* string.504*505* Return value: %true if data found, %false otherwise506*507**/508typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data,509const char *name, int len, /* -1 means nul-terminated */510hb_codepoint_t *glyph,511void *user_data);512513514/* func setters */515516/**517* hb_font_funcs_set_font_h_extents_func:518* @ffuncs: A font-function structure519* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign520* @user_data: Data to pass to @func521* @destroy: (nullable): The function to call when @user_data is not needed anymore522*523* Sets the implementation function for #hb_font_get_font_h_extents_func_t.524*525* Since: 1.1.2526**/527HB_EXTERN void528hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,529hb_font_get_font_h_extents_func_t func,530void *user_data, hb_destroy_func_t destroy);531532/**533* hb_font_funcs_set_font_v_extents_func:534* @ffuncs: A font-function structure535* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign536* @user_data: Data to pass to @func537* @destroy: (nullable): The function to call when @user_data is not needed anymore538*539* Sets the implementation function for #hb_font_get_font_v_extents_func_t.540*541* Since: 1.1.2542**/543HB_EXTERN void544hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,545hb_font_get_font_v_extents_func_t func,546void *user_data, hb_destroy_func_t destroy);547548/**549* hb_font_funcs_set_nominal_glyph_func:550* @ffuncs: A font-function structure551* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign552* @user_data: Data to pass to @func553* @destroy: (nullable): The function to call when @user_data is not needed anymore554*555* Sets the implementation function for #hb_font_get_nominal_glyph_func_t.556*557* Since: 1.2.3558**/559HB_EXTERN void560hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,561hb_font_get_nominal_glyph_func_t func,562void *user_data, hb_destroy_func_t destroy);563564/**565* hb_font_funcs_set_nominal_glyphs_func:566* @ffuncs: A font-function structure567* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign568* @user_data: Data to pass to @func569* @destroy: (nullable): The function to call when @user_data is not needed anymore570*571* Sets the implementation function for #hb_font_get_nominal_glyphs_func_t.572*573* Since: 2.0.0574**/575HB_EXTERN void576hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs,577hb_font_get_nominal_glyphs_func_t func,578void *user_data, hb_destroy_func_t destroy);579580/**581* hb_font_funcs_set_variation_glyph_func:582* @ffuncs: A font-function structure583* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign584* @user_data: Data to pass to @func585* @destroy: (nullable): The function to call when @user_data is not needed anymore586*587* Sets the implementation function for #hb_font_get_variation_glyph_func_t.588*589* Since: 1.2.3590**/591HB_EXTERN void592hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,593hb_font_get_variation_glyph_func_t func,594void *user_data, hb_destroy_func_t destroy);595596/**597* hb_font_funcs_set_glyph_h_advance_func:598* @ffuncs: A font-function structure599* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign600* @user_data: Data to pass to @func601* @destroy: (nullable): The function to call when @user_data is not needed anymore602*603* Sets the implementation function for #hb_font_get_glyph_h_advance_func_t.604*605* Since: 0.9.2606**/607HB_EXTERN void608hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,609hb_font_get_glyph_h_advance_func_t func,610void *user_data, hb_destroy_func_t destroy);611612/**613* hb_font_funcs_set_glyph_v_advance_func:614* @ffuncs: A font-function structure615* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign616* @user_data: Data to pass to @func617* @destroy: (nullable): The function to call when @user_data is not needed anymore618*619* Sets the implementation function for #hb_font_get_glyph_v_advance_func_t.620*621* Since: 0.9.2622**/623HB_EXTERN void624hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,625hb_font_get_glyph_v_advance_func_t func,626void *user_data, hb_destroy_func_t destroy);627628/**629* hb_font_funcs_set_glyph_h_advances_func:630* @ffuncs: A font-function structure631* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign632* @user_data: Data to pass to @func633* @destroy: (nullable): The function to call when @user_data is not needed anymore634*635* Sets the implementation function for #hb_font_get_glyph_h_advances_func_t.636*637* Since: 1.8.6638**/639HB_EXTERN void640hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs,641hb_font_get_glyph_h_advances_func_t func,642void *user_data, hb_destroy_func_t destroy);643644/**645* hb_font_funcs_set_glyph_v_advances_func:646* @ffuncs: A font-function structure647* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign648* @user_data: Data to pass to @func649* @destroy: (nullable): The function to call when @user_data is not needed anymore650*651* Sets the implementation function for #hb_font_get_glyph_v_advances_func_t.652*653* Since: 1.8.6654**/655HB_EXTERN void656hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs,657hb_font_get_glyph_v_advances_func_t func,658void *user_data, hb_destroy_func_t destroy);659660/**661* hb_font_funcs_set_glyph_h_origin_func:662* @ffuncs: A font-function structure663* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign664* @user_data: Data to pass to @func665* @destroy: (nullable): The function to call when @user_data is not needed anymore666*667* Sets the implementation function for #hb_font_get_glyph_h_origin_func_t.668*669* Since: 0.9.2670**/671HB_EXTERN void672hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,673hb_font_get_glyph_h_origin_func_t func,674void *user_data, hb_destroy_func_t destroy);675676/**677* hb_font_funcs_set_glyph_v_origin_func:678* @ffuncs: A font-function structure679* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign680* @user_data: Data to pass to @func681* @destroy: (nullable): The function to call when @user_data is not needed anymore682*683* Sets the implementation function for #hb_font_get_glyph_v_origin_func_t.684*685* Since: 0.9.2686**/687HB_EXTERN void688hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,689hb_font_get_glyph_v_origin_func_t func,690void *user_data, hb_destroy_func_t destroy);691692/**693* hb_font_funcs_set_glyph_h_kerning_func:694* @ffuncs: A font-function structure695* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign696* @user_data: Data to pass to @func697* @destroy: (nullable): The function to call when @user_data is not needed anymore698*699* Sets the implementation function for #hb_font_get_glyph_h_kerning_func_t.700*701* Since: 0.9.2702**/703HB_EXTERN void704hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,705hb_font_get_glyph_h_kerning_func_t func,706void *user_data, hb_destroy_func_t destroy);707708/**709* hb_font_funcs_set_glyph_extents_func:710* @ffuncs: A font-function structure711* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign712* @user_data: Data to pass to @func713* @destroy: (nullable): The function to call when @user_data is not needed anymore714*715* Sets the implementation function for #hb_font_get_glyph_extents_func_t.716*717* Since: 0.9.2718**/719HB_EXTERN void720hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,721hb_font_get_glyph_extents_func_t func,722void *user_data, hb_destroy_func_t destroy);723724/**725* hb_font_funcs_set_glyph_contour_point_func:726* @ffuncs: A font-function structure727* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign728* @user_data: Data to pass to @func729* @destroy: (nullable): The function to call when @user_data is not needed anymore730*731* Sets the implementation function for #hb_font_get_glyph_contour_point_func_t.732*733* Since: 0.9.2734**/735HB_EXTERN void736hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,737hb_font_get_glyph_contour_point_func_t func,738void *user_data, hb_destroy_func_t destroy);739740/**741* hb_font_funcs_set_glyph_name_func:742* @ffuncs: A font-function structure743* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign744* @user_data: Data to pass to @func745* @destroy: (nullable): The function to call when @user_data is not needed anymore746*747* Sets the implementation function for #hb_font_get_glyph_name_func_t.748*749* Since: 0.9.2750**/751HB_EXTERN void752hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,753hb_font_get_glyph_name_func_t func,754void *user_data, hb_destroy_func_t destroy);755756/**757* hb_font_funcs_set_glyph_from_name_func:758* @ffuncs: A font-function structure759* @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign760* @user_data: Data to pass to @func761* @destroy: (nullable): The function to call when @user_data is not needed anymore762*763* Sets the implementation function for #hb_font_get_glyph_from_name_func_t.764*765* Since: 0.9.2766**/767HB_EXTERN void768hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,769hb_font_get_glyph_from_name_func_t func,770void *user_data, hb_destroy_func_t destroy);771772/* func dispatch */773774HB_EXTERN hb_bool_t775hb_font_get_h_extents (hb_font_t *font,776hb_font_extents_t *extents);777HB_EXTERN hb_bool_t778hb_font_get_v_extents (hb_font_t *font,779hb_font_extents_t *extents);780781HB_EXTERN hb_bool_t782hb_font_get_nominal_glyph (hb_font_t *font,783hb_codepoint_t unicode,784hb_codepoint_t *glyph);785HB_EXTERN hb_bool_t786hb_font_get_variation_glyph (hb_font_t *font,787hb_codepoint_t unicode, hb_codepoint_t variation_selector,788hb_codepoint_t *glyph);789790HB_EXTERN unsigned int791hb_font_get_nominal_glyphs (hb_font_t *font,792unsigned int count,793const hb_codepoint_t *first_unicode,794unsigned int unicode_stride,795hb_codepoint_t *first_glyph,796unsigned int glyph_stride);797798HB_EXTERN hb_position_t799hb_font_get_glyph_h_advance (hb_font_t *font,800hb_codepoint_t glyph);801HB_EXTERN hb_position_t802hb_font_get_glyph_v_advance (hb_font_t *font,803hb_codepoint_t glyph);804805HB_EXTERN void806hb_font_get_glyph_h_advances (hb_font_t* font,807unsigned int count,808const hb_codepoint_t *first_glyph,809unsigned glyph_stride,810hb_position_t *first_advance,811unsigned advance_stride);812HB_EXTERN void813hb_font_get_glyph_v_advances (hb_font_t* font,814unsigned int count,815const hb_codepoint_t *first_glyph,816unsigned glyph_stride,817hb_position_t *first_advance,818unsigned advance_stride);819820HB_EXTERN hb_bool_t821hb_font_get_glyph_h_origin (hb_font_t *font,822hb_codepoint_t glyph,823hb_position_t *x, hb_position_t *y);824HB_EXTERN hb_bool_t825hb_font_get_glyph_v_origin (hb_font_t *font,826hb_codepoint_t glyph,827hb_position_t *x, hb_position_t *y);828829HB_EXTERN hb_position_t830hb_font_get_glyph_h_kerning (hb_font_t *font,831hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);832833HB_EXTERN hb_bool_t834hb_font_get_glyph_extents (hb_font_t *font,835hb_codepoint_t glyph,836hb_glyph_extents_t *extents);837838HB_EXTERN hb_bool_t839hb_font_get_glyph_contour_point (hb_font_t *font,840hb_codepoint_t glyph, unsigned int point_index,841hb_position_t *x, hb_position_t *y);842843HB_EXTERN hb_bool_t844hb_font_get_glyph_name (hb_font_t *font,845hb_codepoint_t glyph,846char *name, unsigned int size);847HB_EXTERN hb_bool_t848hb_font_get_glyph_from_name (hb_font_t *font,849const char *name, int len, /* -1 means nul-terminated */850hb_codepoint_t *glyph);851852853/* high-level funcs, with fallback */854855/* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,856* otherwise calls hb_font_get_variation_glyph(). */857HB_EXTERN hb_bool_t858hb_font_get_glyph (hb_font_t *font,859hb_codepoint_t unicode, hb_codepoint_t variation_selector,860hb_codepoint_t *glyph);861862HB_EXTERN void863hb_font_get_extents_for_direction (hb_font_t *font,864hb_direction_t direction,865hb_font_extents_t *extents);866HB_EXTERN void867hb_font_get_glyph_advance_for_direction (hb_font_t *font,868hb_codepoint_t glyph,869hb_direction_t direction,870hb_position_t *x, hb_position_t *y);871HB_EXTERN void872hb_font_get_glyph_advances_for_direction (hb_font_t* font,873hb_direction_t direction,874unsigned int count,875const hb_codepoint_t *first_glyph,876unsigned glyph_stride,877hb_position_t *first_advance,878unsigned advance_stride);879HB_EXTERN void880hb_font_get_glyph_origin_for_direction (hb_font_t *font,881hb_codepoint_t glyph,882hb_direction_t direction,883hb_position_t *x, hb_position_t *y);884HB_EXTERN void885hb_font_add_glyph_origin_for_direction (hb_font_t *font,886hb_codepoint_t glyph,887hb_direction_t direction,888hb_position_t *x, hb_position_t *y);889HB_EXTERN void890hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,891hb_codepoint_t glyph,892hb_direction_t direction,893hb_position_t *x, hb_position_t *y);894895HB_EXTERN void896hb_font_get_glyph_kerning_for_direction (hb_font_t *font,897hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,898hb_direction_t direction,899hb_position_t *x, hb_position_t *y);900901HB_EXTERN hb_bool_t902hb_font_get_glyph_extents_for_origin (hb_font_t *font,903hb_codepoint_t glyph,904hb_direction_t direction,905hb_glyph_extents_t *extents);906907HB_EXTERN hb_bool_t908hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,909hb_codepoint_t glyph, unsigned int point_index,910hb_direction_t direction,911hb_position_t *x, hb_position_t *y);912913/* Generates gidDDD if glyph has no name. */914HB_EXTERN void915hb_font_glyph_to_string (hb_font_t *font,916hb_codepoint_t glyph,917char *s, unsigned int size);918/* Parses gidDDD and uniUUUU strings automatically. */919HB_EXTERN hb_bool_t920hb_font_glyph_from_string (hb_font_t *font,921const char *s, int len, /* -1 means nul-terminated */922hb_codepoint_t *glyph);923924925/*926* hb_font_t927*/928929/* Fonts are very light-weight objects */930931HB_EXTERN hb_font_t *932hb_font_create (hb_face_t *face);933934HB_EXTERN hb_font_t *935hb_font_create_sub_font (hb_font_t *parent);936937HB_EXTERN hb_font_t *938hb_font_get_empty (void);939940HB_EXTERN hb_font_t *941hb_font_reference (hb_font_t *font);942943HB_EXTERN void944hb_font_destroy (hb_font_t *font);945946HB_EXTERN hb_bool_t947hb_font_set_user_data (hb_font_t *font,948hb_user_data_key_t *key,949void * data,950hb_destroy_func_t destroy,951hb_bool_t replace);952953954HB_EXTERN void *955hb_font_get_user_data (hb_font_t *font,956hb_user_data_key_t *key);957958HB_EXTERN void959hb_font_make_immutable (hb_font_t *font);960961HB_EXTERN hb_bool_t962hb_font_is_immutable (hb_font_t *font);963964HB_EXTERN void965hb_font_set_parent (hb_font_t *font,966hb_font_t *parent);967968HB_EXTERN hb_font_t *969hb_font_get_parent (hb_font_t *font);970971HB_EXTERN void972hb_font_set_face (hb_font_t *font,973hb_face_t *face);974975HB_EXTERN hb_face_t *976hb_font_get_face (hb_font_t *font);977978979HB_EXTERN void980hb_font_set_funcs (hb_font_t *font,981hb_font_funcs_t *klass,982void *font_data,983hb_destroy_func_t destroy);984985/* Be *very* careful with this function! */986HB_EXTERN void987hb_font_set_funcs_data (hb_font_t *font,988void *font_data,989hb_destroy_func_t destroy);990991992HB_EXTERN void993hb_font_set_scale (hb_font_t *font,994int x_scale,995int y_scale);996997HB_EXTERN void998hb_font_get_scale (hb_font_t *font,999int *x_scale,1000int *y_scale);10011002/*1003* A zero value means "no hinting in that direction"1004*/1005HB_EXTERN void1006hb_font_set_ppem (hb_font_t *font,1007unsigned int x_ppem,1008unsigned int y_ppem);10091010HB_EXTERN void1011hb_font_get_ppem (hb_font_t *font,1012unsigned int *x_ppem,1013unsigned int *y_ppem);10141015/*1016* Point size per EM. Used for optical-sizing in CoreText.1017* A value of zero means "not set".1018*/1019HB_EXTERN void1020hb_font_set_ptem (hb_font_t *font, float ptem);10211022HB_EXTERN float1023hb_font_get_ptem (hb_font_t *font);10241025HB_EXTERN void1026hb_font_set_variations (hb_font_t *font,1027const hb_variation_t *variations,1028unsigned int variations_length);10291030HB_EXTERN void1031hb_font_set_var_coords_design (hb_font_t *font,1032const float *coords,1033unsigned int coords_length);10341035#ifdef HB_EXPERIMENTAL_API1036HB_EXTERN const float *1037hb_font_get_var_coords_design (hb_font_t *font,1038unsigned int *length);1039#endif10401041HB_EXTERN void1042hb_font_set_var_coords_normalized (hb_font_t *font,1043const int *coords, /* 2.14 normalized */1044unsigned int coords_length);10451046HB_EXTERN const int *1047hb_font_get_var_coords_normalized (hb_font_t *font,1048unsigned int *length);10491050HB_EXTERN void1051hb_font_set_var_named_instance (hb_font_t *font,1052unsigned instance_index);10531054#ifdef HB_EXPERIMENTAL_API1055HB_EXTERN hb_bool_t1056hb_font_draw_glyph (hb_font_t *font, hb_codepoint_t glyph,1057const hb_draw_funcs_t *funcs, void *user_data);1058#endif10591060HB_END_DECLS10611062#endif /* HB_FONT_H */106310641065