/* SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later */ /* Copyright 2010, SIL International, All rights reserved. */ #pragma once
/** *Returnsversioninformationonthisengine
*/
GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix);
/** *TheFaceOptionsallowtheapplicationtorequirethatcertaintablesare *readduringfaceconstruction.ThismaybeofconcerniftheappFaceHandle *usedinthegr_get_table_fnmaychange. *Thevaluescanbecombined
*/ enum gr_face_options { /** No preload, no cmap caching, fail if the graphite tables are invalid */
gr_face_default = 0, /** Dumb rendering will be enabled if the graphite tables are invalid. @deprecated Since 1.311 */
gr_face_dumbRendering = 1, /** preload glyphs at construction time */
gr_face_preloadGlyphs = 2, /** Cache the lookup from code point to glyph ID at construction time */
gr_face_cacheCmap = 4, /** Preload everything */
gr_face_preloadAll = gr_face_preloadGlyphs | gr_face_cacheCmap
};
/** Holds information about a particular Graphite silf table that has been loaded */ struct gr_faceinfo {
gr_uint16 extra_ascent; /**< The extra_ascent in the GDL, in design units */
gr_uint16 extra_descent; /**< The extra_descent in the GDL, in design units */
gr_uint16 upem; /**< The design units for the font */ enum gr_space_contextuals {
gr_space_unknown = 0, /**< no information is known. */
gr_space_none = 1, /**< the space character never occurs in any rules. */
gr_space_left_only = 2, /**< the space character only occurs as the first element in a rule. */
gr_space_right_only = 3, /**< the space character only occurs as the last element in a rule. */
gr_space_either_only = 4, /**< the space character only occurs as the only element in a rule. */
gr_space_both = 5, /**< the space character may occur as the first or last element of a rule. */
gr_space_cross = 6/**< the space character occurs in a rule not as a first or last element. */
} space_contextuals; unsignedint has_bidi_pass : 1; /**< the table specifies that a bidirectional pass should run */ unsignedint line_ends : 1; /**< there are line end contextuals somewhere */ unsignedint justifies : 1; /**< there are .justify properties set somewhere on some glyphs */
};
typedefstruct gr_faceinfo gr_faceinfo;
/** type describing function to retrieve font table information * *@returnapointertothetableinmemory.Thepointedtomemorymustexistas *longasthegr_facewhichmakesthecall. *@paramappFaceHandleistheuniqueinformationpassedtogr_make_face() *@paramnameisa32bittagtothetablename. *@paramlenreturnedbythisfunctiontosayhowlongthetableisinmemory.
*/ typedefconstvoid *(*gr_get_table_fn)(constvoid* appFaceHandle, unsignedint name, size_t *len);
/** type describing function to release any resources allocated by the above get_table table function * *@paramappFaceHandleistheuniqueinformationpassedtogr_make_face() *@parampointertotablememoryreturnedbyget_table.
*/ typedefvoid (*gr_release_table_fn)(constvoid* appFaceHandle, constvoid *table_buffer);
/** struct housing function pointers to manage font table buffers for the graphite engine. */ struct gr_face_ops
{ /** size in bytes of this structure */
size_t size; /** a pointer to a function to request a table from the client. */
gr_get_table_fn get_table; /** is a pointer to a function to notify the client the a table can be released.
* This can be NULL to signify that the client does not wish to do any release handling. */
gr_release_table_fn release_table;
}; typedefstruct gr_face_ops gr_face_ops;
/** Create a gr_face object given application information and a table functions. * *@returngr_faceorNULLifthefontfailstoloadforsomereason. *@paramappFaceHandleThisisapplicationspecificinformationthatispassed *tothegetTablefunction.TheappFaceHandlemuststay *aliveaslongasthegr_faceisalive. *@paramface_opsPointertofacespecificcallbackstructurefortable *management.Muststayaliveforthedurationofthe *callonly. *@paramfaceOptionsBitfielddescribingvariousoptions.Seeenumgr_face_optionsfordetails.
*/
GR2_API gr_face* gr_make_face_with_ops(constvoid* appFaceHandle/*non-NULL*/, const gr_face_ops *face_ops, unsigned int faceOptions);
/** @deprecated Since v1.2.0 in favour of gr_make_face_with_ops. *Createagr_faceobjectgivenapplicationinformationandagetTablefunction. * *@returngr_faceorNULLifthefontfailstoloadforsomereason. *@paramappFaceHandleThisisapplicationspecificinformationthatispassed *tothegetTablefunction.TheappFaceHandlemuststay *aliveaslongasthegr_faceisalive. *@paramgetTableCallbackfunctiontogettabledata. *@paramfaceOptionsBitfielddescribingvariousoptions.Seeenumgr_face_optionsfordetails.
*/
GR2_DEPRECATED_API gr_face* gr_make_face(constvoid* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
/** @deprecated Since 1.3.7 this function is now an alias for gr_make_face_with_ops(). * *Createagr_faceobjectgivenapplicationinformation,withsubsegmentalcachingsupport * *@returngr_faceorNULLifthefontfailstoload. *@paramappFaceHandleisapointertoapplicationspecificinformationthatispassedtogetTable. *ThismaynotbeNULLandmuststayaliveaslongasthegr_faceisalive. *@paramface_opsPointertofacespecificcallbackstructurefortablemanagement.Muststay *aliveforthedurationofthecallonly. *@paramsegCacheMaxSizeUnused. *@paramfaceOptionsBitfieldofvaluesfromenumgr_face_options
*/
GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache_and_ops(constvoid* appFaceHandle, const gr_face_ops *face_ops, unsignedint segCacheMaxSize, unsignedint faceOptions);
/** @deprecated Since 1.3.7 this function is now an alias for gr_make_face(). * *Createagr_faceobjectgivenapplicationinformation,withsubsegmentalcachingsupport. *Thisfunctionisdeprecatedasofv1.2.0infavourofgr_make_face_with_seg_cache_and_ops. * *@returngr_faceorNULLifthefontfailstoload. *@paramappFaceHandleisapointertoapplicationspecificinformationthatispassedtogetTable. *ThismaynotbeNULLandmuststayaliveaslongasthegr_faceisalive. *@paramgetTableThefunctiongraphitecallstoaccessfonttabledata *@paramsegCacheMaxSizeHowlargethesegmentcacheis. *@paramfaceOptionsBitfieldofvaluesfromenumgr_face_options
*/
GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache(constvoid* appFaceHandle, gr_get_table_fn getTable, unsignedint segCacheMaxSize, unsignedint faceOptions);
/** Convert a tag in a string into a gr_uint32 * *@returngr_uint32tag,zeropadded *@paramstranulterminatedstringofwhichatmostthefirst4charactersareread
*/
GR2_API gr_uint32 gr_str_to_tag(constchar *str);
/** Convert a gr_uint32 tag into a string * *@paramtagcontainsthetagtoconvert *@paramstrisapointertoachararrayofatleastsize4bytes.Thefirst4bytesofthisarray *willbeoverwrittenbythisfunction.Nonulisappended.
*/
GR2_API void gr_tag_to_str(gr_uint32 tag, char *str);
/** Get feature values for a given language or default * *@returnacopyofthedefaultfeaturevaluesforagivenlanguage.Theapplicationmustcall *gr_featureval_destroy()tofreethisobjectwhendone. *@parampFaceThefontfacetogetfeaturevaluesfrom *@paramlangnameThelanguagetagtogetfeaturevaluesfor.Ifthereisnosuchlanguageor *langnameis0,thedefaultfeaturevaluesforthefontarereturned. *langnameisright0paddedandassumeslowercase.Thustheenlangauge *wouldbe0x656E0000.Langnamemayalsobespacepadded,thus0x656E2020.
*/
GR2_API gr_feature_val* gr_face_featureval_for_lang(const gr_face* pFace, gr_uint32 langname);
/** Get feature reference for a given feature id from a face * *@returnafeaturereferencecorrespondingtothegivenid.Thisdataispartofthegr_faceand *willbefreedwhenthefaceisdestroyed. *@parampFaceFontfacetogetinformationon. *@paramfeatIdFeatureidtagtogetreferenceto.
*/
GR2_API const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId);
/** Returns number of feature references in a face **/
GR2_API gr_uint16 gr_face_n_fref(const gr_face* pFace);
/** Returns feature reference at given index in face **/
GR2_API const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i);
/** Return number of languages the face knows about **/
GR2_API unsignedshort gr_face_n_languages(const gr_face* pFace);
/** Returns a language id corresponding to a language of given index in the face **/
GR2_API gr_uint32 gr_face_lang_by_index(const gr_face* pFace, gr_uint16 i);
/** Destroy the given face and free its memory **/
GR2_API void gr_face_destroy(gr_face *face);
/** Returns the number of glyphs in the face **/
GR2_API unsignedshort gr_face_n_glyphs(const gr_face* pFace);
/** Returns a faceinfo for the face and script **/
GR2_API const gr_faceinfo *gr_face_info(const gr_face *pFace, gr_uint32 script);
/** Returns whether the font supports a given Unicode character * *@returntrueifthecharacterissupported. *@parampFacefacetotestwithin *@paramusvUnicodeScalarValueofcharactertotest *@paramscriptTagofscriptforselectingwhichsetofpseudoglyphstotest.MaybeNULL.
*/
GR2_API int gr_face_is_char_supported(const gr_face *pFace, gr_uint32 usv, gr_uint32 script);
#ifndef GRAPHITE2_NFILEFACE /** Create gr_face from a font file * *@returngr_facethataccessesafontfiledirectly.ReturnsNULLonfailure. *@paramfilenameFullpathandfilenametofontfile *@paramfaceOptionsBitfilefromenumgr_face_optionstocontrolfaceoptions.
*/
GR2_API gr_face* gr_make_file_face(constchar *filename, unsignedint faceOptions);
/** @deprecated Since 1.3.7. This function is now an alias for gr_make_file_face(). * *Creategr_facefromafontfile,withsubsegmentcachingsupport. * *@returngr_facethataccessesafontfiledirectly.ReturnsNULLonfailure. *@paramfilenameFullpathandfilenametofontfile *@paramsegCacheMaxSizeSpecifieshowbigtomakethecacheinsegments. *@paramfaceOptionsBitfieldfromenumgr_face_optionstocontrolfaceoptions.
*/
GR2_DEPRECATED_API gr_face* gr_make_file_face_with_seg_cache(constchar *filename, unsignedint segCacheMaxSize, unsignedint faceOptions); #endif// !GRAPHITE2_NFILEFACE
/** Create a font from a face * *@returngr_fontCallfont_destroytofreethisfont *@paramppmResolutionofthefontinpixelsperem *@paramfaceFacethisfontcorrespondsto.Thismuststayaliveaslongasthefontisalive.
*/
GR2_API gr_font* gr_make_font(float ppm, const gr_face *face);
/** query function to find the hinted advance of a glyph * *@paramappFontHandleistheuniqueinformationpassedtogr_make_font_with_advance() *@paramglyphidistheglyphtoretirevethehintedadvancefor.
*/ typedeffloat (*gr_advance_fn)(constvoid* appFontHandle, gr_uint16 glyphid);
/** struct housing function pointers to manage font hinted metrics for the
* graphite engine. */ struct gr_font_ops
{ /** size of the structure in bytes to allow for future extensibility */
size_t size; /** a pointer to a function to retrieve the hinted *advancewidthofaglyphwhichthefontcannot *providewithoutclientassistance.Thiscanbe
* NULL to signify no horizontal hinted metrics are necessary. */
gr_advance_fn glyph_advance_x; /** a pointer to a function to retrieve the hinted *advanceheightofaglyphwhichthefontcannot *providewithoutclientassistance.Thiscanbe
* NULL to signify no horizontal hinted metrics are necessary. */
gr_advance_fn glyph_advance_y;
}; typedefstruct gr_font_ops gr_font_ops;
/** Free a font **/
GR2_API void gr_font_destroy(gr_font *font);
/** get a feature value * *@returnvalueofspecificfeatureor0ifanyproblems. *@parampfeaturerefgr_feature_reftothefeature *@paramfeatsgr_feature_valcontainingallthevalues
*/
GR2_API gr_uint16 gr_fref_feature_value(const gr_feature_ref* pfeatureref, const gr_feature_val* feats);
/** set a feature value * *@returnfalseiftherewereanyproblems(valueoutofrange,etc.) *@parampfeaturerefgr_feature_reftothefeature *@paramvalvaluetosetthefeatureto *@parampDestthegr_feature_valcontainingallthevaluesforallthefeatures
*/
GR2_API int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest);
/** Returns the id tag for a gr_feature_ref **/
GR2_API gr_uint32 gr_fref_id(const gr_feature_ref* pfeatureref);
/** Returns number of values a feature may take, given a gr_feature_ref **/
GR2_API gr_uint16 gr_fref_n_values(const gr_feature_ref* pfeatureref);
/** Returns the value associated with a particular value in a feature * *@returnvalue *@parampfeaturerefgr_feature_refofthefeatureofinterest *@paramsettingnoIndexuptothereturnvalueofgr_fref_n_values()ofthevalue
*/
GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
/** Returns a string of the UI name of a feature * *@returnstringoftheUIname,intheencodingformrequested.Callgr_label_destroy()afteruse. *@parampfeaturerefgr_feature_refofthefeature *@paramlangIdThisisapointersincethefacemaynotsupportastringintherequested *language.TheactuallanguageofthestringisreturnedinlangId *@paramutfEncodingformforthestring *@paramlengthUsedtoreturnthelengthofthestringreturnedinbytes.
*/
GR2_API void* gr_fref_label(const gr_feature_ref* pfeatureref, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
/** Return a UI string for a possible value of a feature * *@returnstringoftheUIname,intheencodingformrequested.nulterminated.Callgr_label_destroy() *afteruse. *@parampfeaturerefgr_feature_refofthefeature *@paramsettingnoValuesettingindex *@paramlangIdThisisapointertotherequestedlanguage.Therequestedlanguageidis *replacedbytheactuallanguageidofthestringreturned. *@paramutfEncodingformforthestring *@paramlengthReturnsthelengthofthestringreturnedinbytes.
*/
GR2_API void* gr_fref_value_label(const gr_feature_ref* pfeatureref, gr_uint16 settingno/*rather than a value*/, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
/** Destroy a previously returned label string **/
GR2_API void gr_label_destroy(void * label);
/** Copies a gr_feature_val **/
GR2_API gr_feature_val* gr_featureval_clone(const gr_feature_val* pfeatures);
/** Destroys a gr_feature_val **/
GR2_API void gr_featureval_destroy(gr_feature_val *pfeatures);
#ifdef __cplusplus
} #endif
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.29 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.