📄 gdk-fonts.html
字号:
<td>The body size of the font in 10ths of a point.(A <em class="firstterm">point</em> is 1/72.27 inch) </td></tr><tr><td>Resolution X</td><td>The horizontal resolution that the font was designed for.</td></tr><tr><td>Resolution Y</td><td>The vertical resolution that the font was designed for .</td></tr><tr><td>Spacing</td><td>The type of spacing for the font - can be 'p' for proportional,'m' for monospaced or 'c' for charcell.</td></tr><tr><td>Average Width</td><td>The average width of a glyph in the font. For monospacedand charcell fonts, all glyphs in the font have this width</td></tr><tr><td>Charset Registry</td><td>The registration authority that owns the encoding forthe font. Together with the Charset Encoding field, thisdefines the character set for the font.</td></tr><tr><td>Charset Encoding</td><td>An identifier for the particular character set encoding.</td></tr></tbody></table></div><p></p><p>When specifying a font via a X logical Font Description,'*' can be used as a wildcard to match any portion ofthe XLFD. For instance, the above example couldalso be specified as</p><div class="informalexample"><pre class="programlisting">"-*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1"</pre></div><p>It is generally a good idea to use wildcards for anyportion of the XLFD that your program does not careabout specifically, since that will improve thechances of finding a matching font.</p><p>A <em class="firstterm">fontset</em> is a list of fontsthat is used for drawing international text that maycontain characters from a number of different charactersets. It is represented by a list of XLFD's. </p><p>The font for a given character set is determined by goingthrough the list of XLFD's in order. For each one, ifthe registry and and encoding fields match the desiredcharacter set, then that font is used, otherwise ifthe XLFD contains wild-cards for the registry and encodingfields, the registry and encoding for the desired characterset are substituted in and a lookup is done. If a match is foundthat font is used. Otherwise, processing continueson to the next font in the list.</p><p>The functions for determining the metrics of a stringcome in several varieties that can take a numberof forms of string input:</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term">8-bit string</span></p></td><td><p> When using functions like <a class="link" href="gdk-Fonts.html#gdk-string-width"><code class="function">gdk_string_width()</code></a> that take a <span class="type">gchar *</span>, if the font is of type <a class="link" href="gdk-Fonts.html#GDK-FONT-FONT:CAPS"><code class="literal">GDK_FONT_FONT</code></a> and is an 8-bit font, then each <span class="type">gchar</span> indexes the glyphs in the font directly. </p></td></tr><tr><td><p><span class="term">16-bit string</span></p></td><td><p> For functions taking a <span class="type">gchar *</span>, if the font is of type <a class="link" href="gdk-Fonts.html#GDK-FONT-FONT:CAPS"><code class="literal">GDK_FONT_FONT</code></a>, and is a 16-bit font, then the <span class="type">gchar *</span> argument is interpreted as a <span class="type">guint16 *</span> cast to a <span class="type">gchar *</span> and each <span class="type">guint16</span> indexes the glyphs in the font directly. </p></td></tr><tr><td><p><span class="term">Multibyte string</span></p></td><td><p> For functions taking a <span class="type">gchar *</span>, if the font is of type <a class="link" href="gdk-Fonts.html#GDK-FONT-FONTSET:CAPS"><code class="literal">GDK_FONT_FONTSET</code></a>, then the input string is interpreted as a <em class="firstterm">multibyte</em> encoded according to the current locale. (A multibyte string is one in which each character may consist of one or more bytes, with different lengths for different characters in the string). They can be converted to and from wide character strings (see below) using <a class="link" href="gdk-Fonts.html#gdk-wcstombs"><code class="function">gdk_wcstombs()</code></a> and <a class="link" href="gdk-Fonts.html#gdk-mbstowcs"><code class="function">gdk_mbstowcs()</code></a>.) The string will be rendered using one or more different fonts from the fontset. </p></td></tr><tr><td><p><span class="term">Wide character string</span></p></td><td><p> For a number of the text-measuring functions, GDK provides a variant (such as <a class="link" href="gdk-Fonts.html#gdk-text-width-wc"><code class="function">gdk_text_width_wc()</code></a>) which takes a <span class="type">GdkWChar *</span> instead of a <span class="type">gchar *</span>. The input is then taken to be a wide character string in the encoding of the current locale. (A wide character string is a string in which each character consists of several bytes, and the width of each character in the string is constant.) </p></td></tr></tbody></table></div><p></p><p>GDK provides functions to determine a number of differentmeasurements (metrics) for a given string. (Need diagramhere).</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term">ascent</span></p></td><td><p> The vertical distance from the origin of the drawing opereration to the top of the drawn character. </p></td></tr><tr><td><p><span class="term">descent</span></p></td><td><p> The vertical distance from the origin of the drawing opereration to the bottom of the drawn character. </p></td></tr><tr><td><p><span class="term">left bearing</span></p></td><td><p> The horizontal distance from the origin of the drawing operation to the left-most part of the drawn character. </p></td></tr><tr><td><p><span class="term">right bearing</span></p></td><td><p> The horizontal distance from the origin of the drawing operation to the right-most part of the drawn character. </p></td></tr><tr><td><p><span class="term">width bearing</span></p></td><td><p> The horizontal distance from the origin of the drawing operation to the correct origin for drawing another string to follow the current one. Depending on the font, this could be greater than or less than the right bearing. </p></td></tr></tbody></table></div><p></p></div><div class="refsect1" lang="en"><a name="id3160754"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3160764"></a><h3><a name="GdkFont"></a>GdkFont</h3><a class="indexterm" name="id3160779"></a><pre class="programlisting">typedef struct { GdkFontType type; gint ascent; gint descent;} GdkFont;</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">GdkFont</code> is deprecated and should not be used in newly-written code.</p></div><p>The <span class="structname">GdkFont</span> structure represents a font or fontset. Itcontains the following public fields. A new <span class="structname">GdkFont</span>structure is returned by <a class="link" href="gdk-Fonts.html#gdk-font-load"><code class="function">gdk_font_load()</code></a> or <a class="link" href="gdk-Fonts.html#gdk-fontset-load"><code class="function">gdk_fontset_load()</code></a>,and is reference counted with <a class="link" href="gdk-Fonts.html#gdk-font-ref"><code class="function">gdk_font_ref()</code></a> and <a class="link" href="gdk-Fonts.html#gdk-font-unref"><code class="function">gdk_font_unref()</code></a></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a class="link" href="gdk-Fonts.html#GdkFontType">GdkFontType</a> <em class="structfield"><code>type</code></em>;</span></p></td><td>a value of type <a class="link" href="gdk-Fonts.html#GdkFontType"><span class="type">GdkFontType</span></a> which indicates whether this font is a single font or a fontset.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <em class="structfield"><code>ascent</code></em>;</span></p></td><td>the maximum distance that the font, when drawn, ascends above the baseline.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <em class="structfield"><code>descent</code></em>;</span></p></td><td>the maximum distance that the font, when drawn,descends below the baseline.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3160936"></a><h3><a name="GdkFontType"></a>enum GdkFontType</h3><a class="indexterm" name="id3160951"></a><pre class="programlisting">typedef enum{ GDK_FONT_FONT, GDK_FONT_FONTSET} GdkFontType;</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">GdkFontType</code> is deprecated and should not be used in newly-written code.</p></div><p>Indicates the type of a font. The possible valuesare currently:</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GDK-FONT-FONT:CAPS"></a><code class="literal">GDK_FONT_FONT</code></span></p></td><td>the font is a single font.</td></tr><tr><td><p><span class="term"><a name="GDK-FONT-FONTSET:CAPS"></a><code class="literal">GDK_FONT_FONTSET</code></span></p></td><td>the font is a fontset.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3161029"></a><h3><a name="gdk-font-load"></a>gdk_font_load ()</h3><a class="indexterm" name="id3161044"></a><pre class="programlisting"><a class="link" href="gdk-Fonts.html#GdkFont">GdkFont</a>* gdk_font_load (const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *font_name);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">gdk_font_load</code> is deprecated and should not be used in newly-written code.</p></div><p>Loads a font.</p><p>The font may be newly loaded or looked up the font in a cache. You should make no assumptions about the initial reference count.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>font_name</code></em> :</span></p></td><td> a XLFD describing the font to load.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a <a class="link" href="gdk-Fonts.html#GdkFont"><span class="type">GdkFont</span></a>, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if the font could not be loaded.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3161141"></a><h3><a name="gdk-font-load-for-display"></a>gdk_font_load_for_display ()</h3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -