⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.212
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 :
shaping-plans-and-caching.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>Plans and caching: 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="shaping-and-shape-plans.html" title="Shaping and shape plans"> <link rel="prev" href="shaping-shaper-selection.html" title="Shaper selection"> <link rel="next" href="clusters.html" title="Clusters"> <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="shaping-and-shape-plans.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="shaping-shaper-selection.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="clusters.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="shaping-plans-and-caching"></a>Plans and caching</h2></div></div></div> <p> Internally, HarfBuzz uses a structure called a shape plan to track its decisions about how to shape the contents of a buffer. The <code class="function">hb_shape()</code> function builds up the shape plan by examining segment properties and by inspecting the contents of the font. </p> <p> This process can involve some decision-making and trade-offs — for example, HarfBuzz inspects the GSUB and GPOS lookups for the script and language tags set on the segment properties, but it falls back on the lookups under the <code class="literal">DFLT</code> tag (and sometimes other common tags) if there are actually no lookups for the tag requested. </p> <p> HarfBuzz also includes some work-arounds for handling well-known older font conventions that do not follow OpenType or Unicode specifications, for buggy system fonts, and for peculiarities of Microsoft Uniscribe. All of that means that a shape plan, while not something that you should edit directly in client code, still might be an object that you want to inspect. Furthermore, if resources are tight, you might want to cache the shape plan that HarfBuzz builds for your buffer and font, so that you do not have to rebuild it for every shaping call. </p> <p> You can create a cacheable shape plan with <code class="function">hb_shape_plan_create_cached(face, props, user_features, num_user_features, shaper_list)</code>, where <em class="parameter"><code>face</code></em> is a face object (not a font object, notably), <em class="parameter"><code>props</code></em> is an <span class="type">hb_segment_properties_t</span>, <em class="parameter"><code>user_features</code></em> is an array of <span class="type">hb_feature_t</span>s (with length <em class="parameter"><code>num_user_features</code></em>), and <em class="parameter"><code>shaper_list</code></em> is a list of shapers to try. </p> <p> Shape plans are objects in HarfBuzz, so there are reference-counting functions and user-data attachment functions you can use. <code class="function">hb_shape_plan_reference(shape_plan)</code> increases the reference count on a shape plan, while <code class="function">hb_shape_plan_destroy(shape_plan)</code> decreases the reference count, destroying the shape plan when the last reference is dropped. </p> <p> You can attach user data to a shaper (with a key) using the <code class="function">hb_shape_plan_set_user_data(shape_plan,key,data,destroy,replace)</code> function, optionally supplying a <code class="function">destroy</code> callback to use. You can then fetch the user data attached to a shape plan with <code class="function">hb_shape_plan_get_user_data(shape_plan, key)</code>. </p> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>