⚝
One Hat Cyber Team
⚝
Your IP:
3.140.195.167
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
gtk-doc
/
html
/
harfbuzz
/
View File Name :
fonts-and-faces-custom-functions.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Customizing font functions: HarfBuzz Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="HarfBuzz Manual"> <link rel="up" href="fonts-and-faces.html" title="Fonts, faces, and output"> <link rel="prev" href="fonts-and-faces.html" title="Fonts, faces, and output"> <link rel="next" href="fonts-and-faces-native-opentype.html" title="Font objects and HarfBuzz's native OpenType implementation"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="fonts-and-faces.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="fonts-and-faces.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="fonts-and-faces-native-opentype.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="fonts-and-faces-custom-functions"></a>Customizing font functions</h2></div></div></div> <p> During shaping, HarfBuzz frequently needs to query font objects to get at the contents and parameters of the glyphs in a font file. It includes a built-in set of functions that is tailored to working with OpenType fonts. However, as was the case with Unicode functions in the buffers chapter, HarfBuzz also wants to make it easy for you to assign a substitute set of font functions if you are developing a program to work with a library or platform that provides its own font functions. </p> <p> Therefore, the HarfBuzz API defines a set of virtual methods for accessing font-object properties, and you can replace the defaults with your own selections without interfering with the shaping process. Each font object in HarfBuzz includes a structure called <code class="literal">font_funcs</code> that serves as a vtable for the font object. The virtual methods in <code class="literal">font_funcs</code> are: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p> <code class="function">hb_font_get_font_h_extents_func_t</code>: returns the extents of the font for horizontal text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_font_v_extents_func_t</code>: returns the extents of the font for vertical text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_nominal_glyph_func_t</code>: returns the font's nominal glyph for a given code point. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_variation_glyph_func_t</code>: returns the font's glyph for a given code point when it is followed by a given Variation Selector. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_nominal_glyphs_func_t</code>: returns the font's nominal glyphs for a series of code points. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_advance_func_t</code>: returns the advance for a glyph. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_h_advance_func_t</code>: returns the advance for a glyph for horizontal text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_v_advance_func_t</code>:returns the advance for a glyph for vertical text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_advances_func_t</code>: returns the advances for a series of glyphs. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_h_advances_func_t</code>: returns the advances for a series of glyphs for horizontal text . </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_v_advances_func_t</code>: returns the advances for a series of glyphs for vertical text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_origin_func_t</code>: returns the origin coordinates of a glyph. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_h_origin_func_t</code>: returns the origin coordinates of a glyph for horizontal text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_v_origin_func_t</code>: returns the origin coordinates of a glyph for vertical text. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_extents_func_t</code>: returns the extents for a glyph. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_contour_point_func_t</code>: returns the coordinates of a specific contour point from a glyph. </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_name_func_t</code>: returns the name of a glyph (from its glyph index). </p></li> <li class="listitem"><p> <code class="function">hb_font_get_glyph_from_name_func_t</code>: returns the glyph index that corresponds to a given glyph name. </p></li> </ul></div> <p> You can fetch the font-functions configuration for a font object by calling <code class="function">hb_font_get_font_funcs()</code>: </p> <pre class="programlisting"> hb_font_funcs_t *ffunctions; ffunctions = hb_font_get_font_funcs (font); </pre> <p> The individual methods can each be replaced with their own setter function, such as <code class="function">hb_font_funcs_set_nominal_glyph_func(*ffunctions, func, *user_data, destroy)</code>. </p> <p> Font-functions structures can be reused for multiple font objects, and can be reference counted with <code class="function">hb_font_funcs_reference()</code> and <code class="function">hb_font_funcs_destroy()</code>. Just like other objects in HarfBuzz, you can set user-data for each font-functions structure and assign a destroy callback for it. </p> <p> You can also mark a font-functions structure as immutable, with <code class="function">hb_font_funcs_make_immutable()</code>. This is especially useful if your code is a library or framework that will have its own client programs. By marking your font-functions structures as immutable, you prevent your client programs from changing the configuration and introducing inconsistencies and errors downstream. </p> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>