1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Pango Interaction</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7
<link rel="home" href="index.html" title="GDK 2 Reference Manual">
8
<link rel="up" href="reference.html" title="API Reference">
9
<link rel="prev" href="gdk2-Input-Devices.html" title="Input Devices">
10
<link rel="next" href="gdk2-Cairo-Interaction.html" title="Cairo Interaction">
11
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17
<td><a accesskey="p" href="gdk2-Input-Devices.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20
<th width="100%" align="center">GDK 2 Reference Manual</th>
21
<td><a accesskey="n" href="gdk2-Cairo-Interaction.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23
<tr><td colspan="5" class="shortcuts">
24
<a href="#gdk2-Pango-Interaction.synopsis" class="shortcut">Top</a>
26
<a href="#gdk2-Pango-Interaction.description" class="shortcut">Description</a>
28
<a href="#gdk2-Pango-Interaction.object-hierarchy" class="shortcut">Object Hierarchy</a>
30
<a href="#gdk2-Pango-Interaction.properties" class="shortcut">Properties</a>
33
<div class="refentry">
34
<a name="gdk2-Pango-Interaction"></a><div class="titlepage"></div>
35
<div class="refnamediv"><table width="100%"><tr>
37
<h2><span class="refentrytitle"><a name="gdk2-Pango-Interaction.top_of_page"></a>Pango Interaction</span></h2>
38
<p>Pango Interaction — Using Pango in GDK</p>
40
<td valign="top" align="right"></td>
42
<div class="refsynopsisdiv">
43
<a name="gdk2-Pango-Interaction.synopsis"></a><h2>Synopsis</h2>
44
<a name="GdkPangoRenderer"></a><pre class="synopsis">
45
#include <gdk/gdk.h>
47
struct <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer-struct" title="struct GdkPangoRenderer">GdkPangoRenderer</a>;
48
struct <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRendererClass" title="struct GdkPangoRendererClass">GdkPangoRendererClass</a>;
49
<a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="returnvalue">PangoRenderer</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-new" title="gdk_pango_renderer_new ()">gdk_pango_renderer_new</a> (<em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);
50
<a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="returnvalue">PangoRenderer</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-get-default" title="gdk_pango_renderer_get_default ()">gdk_pango_renderer_get_default</a> (<em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);
51
<span class="returnvalue">void</span> <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-drawable" title="gdk_pango_renderer_set_drawable ()">gdk_pango_renderer_set_drawable</a> (<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
52
<em class="parameter"><code><a class="link" href="gdk2-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> *drawable</code></em>);
53
<span class="returnvalue">void</span> <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-gc" title="gdk_pango_renderer_set_gc ()">gdk_pango_renderer_set_gc</a> (<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
54
<em class="parameter"><code><a class="link" href="gdk2-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> *gc</code></em>);
55
<span class="returnvalue">void</span> <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-stipple" title="gdk_pango_renderer_set_stipple ()">gdk_pango_renderer_set_stipple</a> (<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
56
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderPart"><span class="type">PangoRenderPart</span></a> part</code></em>,
57
<em class="parameter"><code><a class="link" href="gdk2-Bitmaps-and-Pixmaps.html#GdkBitmap" title="GdkBitmap"><span class="type">GdkBitmap</span></a> *stipple</code></em>);
58
<span class="returnvalue">void</span> <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-override-color" title="gdk_pango_renderer_set_override_color ()">gdk_pango_renderer_set_override_color</a>
59
(<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
60
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderPart"><span class="type">PangoRenderPart</span></a> part</code></em>,
61
<em class="parameter"><code>const <a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
62
<a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="returnvalue">PangoContext</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-context-get" title="gdk_pango_context_get ()">gdk_pango_context_get</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
63
<a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="returnvalue">PangoContext</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-context-get-for-screen" title="gdk_pango_context_get_for_screen ()">gdk_pango_context_get_for_screen</a> (<em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);
64
<span class="returnvalue">void</span> <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-context-set-colormap" title="gdk_pango_context_set_colormap ()">gdk_pango_context_set_colormap</a> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
65
<em class="parameter"><code><a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>);
66
struct <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoAttrEmbossed" title="struct GdkPangoAttrEmbossed">GdkPangoAttrEmbossed</a>;
67
struct <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoAttrEmbossColor" title="struct GdkPangoAttrEmbossColor">GdkPangoAttrEmbossColor</a>;
68
struct <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoAttrStipple" title="struct GdkPangoAttrStipple">GdkPangoAttrStipple</a>;
69
<a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="returnvalue">PangoAttribute</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-attr-emboss-color-new" title="gdk_pango_attr_emboss_color_new ()">gdk_pango_attr_emboss_color_new</a> (<em class="parameter"><code>const <a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
70
<a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="returnvalue">PangoAttribute</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-attr-embossed-new" title="gdk_pango_attr_embossed_new ()">gdk_pango_attr_embossed_new</a> (<em class="parameter"><code><span class="type">gboolean</span> embossed</code></em>);
71
<a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="returnvalue">PangoAttribute</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-attr-stipple-new" title="gdk_pango_attr_stipple_new ()">gdk_pango_attr_stipple_new</a> (<em class="parameter"><code><a class="link" href="gdk2-Bitmaps-and-Pixmaps.html#GdkBitmap" title="GdkBitmap"><span class="type">GdkBitmap</span></a> *stipple</code></em>);
72
<a class="link" href="gdk2-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="returnvalue">GdkRegion</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-layout-get-clip-region" title="gdk_pango_layout_get_clip_region ()">gdk_pango_layout_get_clip_region</a> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> *layout</code></em>,
73
<em class="parameter"><code><span class="type">gint</span> x_origin</code></em>,
74
<em class="parameter"><code><span class="type">gint</span> y_origin</code></em>,
75
<em class="parameter"><code>const <span class="type">gint</span> *index_ranges</code></em>,
76
<em class="parameter"><code><span class="type">gint</span> n_ranges</code></em>);
77
<a class="link" href="gdk2-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="returnvalue">GdkRegion</span></a> * <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-layout-line-get-clip-region" title="gdk_pango_layout_line_get_clip_region ()">gdk_pango_layout_line_get_clip_region</a>
78
(<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayoutLine"><span class="type">PangoLayoutLine</span></a> *line</code></em>,
79
<em class="parameter"><code><span class="type">gint</span> x_origin</code></em>,
80
<em class="parameter"><code><span class="type">gint</span> y_origin</code></em>,
81
<em class="parameter"><code>const <span class="type">gint</span> *index_ranges</code></em>,
82
<em class="parameter"><code><span class="type">gint</span> n_ranges</code></em>);
85
<div class="refsect1">
86
<a name="gdk2-Pango-Interaction.object-hierarchy"></a><h2>Object Hierarchy</h2>
87
<pre class="synopsis">
89
+----<a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer">PangoRenderer</a>
93
<div class="refsect1">
94
<a name="gdk2-Pango-Interaction.properties"></a><h2>Properties</h2>
95
<pre class="synopsis">
96
"<a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer--screen" title='The "screen" property'>screen</a>" <a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a>* : Read / Write / Construct Only
99
<div class="refsect1">
100
<a name="gdk2-Pango-Interaction.description"></a><h2>Description</h2>
102
Pango is the text layout system used by GDK and GTK+. The functions
103
and types in this section are used to render Pango objects to GDK.
104
drawables, and also extend the set of Pango attributes to include
105
stippling and embossing.
108
Creating a <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> object is the first step in rendering text,
109
and requires getting a handle to a <a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>. For GTK+ programs,
110
you'll usually want to use <a href="http://developer.gnome.org/gtk2/GtkWidget.html#gtk-widget-get-pango-context"><code class="function">gtk_widget_get_pango_context()</code></a>, or
111
<a href="http://developer.gnome.org/gtk2/GtkWidget.html#gtk-widget-create-pango-layout"><code class="function">gtk_widget_create_pango_layout()</code></a>, rather than using the lowlevel
112
<a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-context-get-for-screen" title="gdk_pango_context_get_for_screen ()"><code class="function">gdk_pango_context_get_for_screen()</code></a>. Once you have a <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>, you
113
can set the text and attributes of it with Pango functions like
114
<a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-set-text"><code class="function">pango_layout_set_text()</code></a> and get its size with <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-get-size"><code class="function">pango_layout_get_size()</code></a>.
115
(Note that Pango uses a fixed point system internally, so converting
116
between Pango units and pixels using PANGO_SCALE or the <a href="/usr/share/gtk-doc/html/pango/pango-Glyph-Storage.html#PANGO-PIXELS:CAPS"><code class="function">PANGO_PIXELS()</code></a> macro.)
119
Rendering a Pango layout is done most simply with <a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-layout" title="gdk_draw_layout ()"><code class="function">gdk_draw_layout()</code></a>;
120
you can also draw pieces of the layout with <a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-layout" title="gdk_draw_layout ()"><code class="function">gdk_draw_layout()</code></a> or
121
<a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-glyphs" title="gdk_draw_glyphs ()"><code class="function">gdk_draw_glyphs()</code></a>. <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> is a subclass of <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="type">PangoRenderer</span></a>
122
that is used internally to implement these functions. Using it
123
directly or subclassing it can be useful in some cases. See the
124
<a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> documentation for details.
126
<div class="example">
127
<a name="rotated-example"></a><p class="title"><b>Example 8. Using <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> to draw transformed text</b></p>
128
<div class="example-contents">
129
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
132
<td class="listing_lines" align="right"><pre>1
196
<td class="listing_code"><pre class="programlisting"><span class="preproc">#define</span><span class="normal"> RADIUS </span><span class="number">100</span>
197
<span class="preproc">#define</span><span class="normal"> N_WORDS </span><span class="number">10</span>
198
<span class="preproc">#define</span><span class="normal"> FONT </span><span class="string">"Sans Bold 18"</span>
199
<span class="usertype">GdkScreen</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">screen </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk2-Drawing-Primitives.html#gdk-drawable-get-screen">gdk_drawable_get_screen</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">drawable</span><span class="symbol">);</span>
200
<span class="usertype">PangoRenderer</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">renderer</span><span class="symbol">;</span>
201
<span class="usertype">GdkGC</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">gc</span><span class="symbol">;</span>
202
<span class="usertype">PangoMatrix</span><span class="normal"> matrix </span><span class="symbol">=</span><span class="normal"> <a href="/usr/share/gtk-doc/html/pango/pango-Glyph-Storage.html#PANGO-MATRIX-INIT:CAPS">PANGO_MATRIX_INIT</a></span><span class="symbol">;</span>
203
<span class="usertype">PangoContext</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">context</span><span class="symbol">;</span>
204
<span class="usertype">PangoLayout</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">layout</span><span class="symbol">;</span>
205
<span class="usertype">PangoFontDescription</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">desc</span><span class="symbol">;</span>
206
<span class="type">double</span><span class="normal"> device_radius</span><span class="symbol">;</span>
207
<span class="type">int</span><span class="normal"> width</span><span class="symbol">,</span><span class="normal"> height</span><span class="symbol">;</span>
208
<span class="type">int</span><span class="normal"> i</span><span class="symbol">;</span>
209
<span class="comment">/* Get the default renderer for the screen, and set it up for drawing */</span>
210
<span class="normal">renderer </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-get-default">gdk_pango_renderer_get_default</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">screen</span><span class="symbol">);</span>
211
<span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-drawable">gdk_pango_renderer_set_drawable</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDK_PANGO_RENDERER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">),</span><span class="normal"> drawable</span><span class="symbol">);</span>
212
<span class="normal">gc </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk2-Graphics-Contexts.html#gdk-gc-new">gdk_gc_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">drawable</span><span class="symbol">);</span>
213
<span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-gc">gdk_pango_renderer_set_gc</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDK_PANGO_RENDERER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">),</span><span class="normal"> gc</span><span class="symbol">);</span>
214
<span class="comment">/* Set up a transformation matrix so that the user space coordinates for</span>
215
<span class="comment"> * where we are drawing are [-RADIUS, RADIUS], [-RADIUS, RADIUS]</span>
216
<span class="comment"> * We first center, then change the scale */</span>
217
<span class="function"><a href="gdk2-Drawing-Primitives.html#gdk-drawable-get-size">gdk_drawable_get_size</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">drawable</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">width</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">height</span><span class="symbol">);</span>
218
<span class="normal">device_radius </span><span class="symbol">=</span><span class="normal"> </span><span class="function">MIN</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">width</span><span class="symbol">,</span><span class="normal"> height</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2</span><span class="symbol">.;</span>
219
<span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Glyph-Storage.html#pango-matrix-translate">pango_matrix_translate</a></span><span class="normal"> </span><span class="symbol">(&</span><span class="normal">matrix</span><span class="symbol">,</span>
220
<span class="normal"> device_radius </span><span class="symbol">+</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">width </span><span class="symbol">-</span><span class="normal"> </span><span class="number">2</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> device_radius</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2</span><span class="symbol">,</span>
221
<span class="normal"> device_radius </span><span class="symbol">+</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">height </span><span class="symbol">-</span><span class="normal"> </span><span class="number">2</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> device_radius</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2</span><span class="symbol">);</span>
222
<span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Glyph-Storage.html#pango-matrix-scale">pango_matrix_scale</a></span><span class="normal"> </span><span class="symbol">(&</span><span class="normal">matrix</span><span class="symbol">,</span><span class="normal"> device_radius </span><span class="symbol">/</span><span class="normal"> RADIUS</span><span class="symbol">,</span><span class="normal"> device_radius </span><span class="symbol">/</span><span class="normal"> RADIUS</span><span class="symbol">);</span>
223
<span class="comment">/* Create a PangoLayout, set the font and text */</span>
224
<span class="normal">context </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-context-get-for-screen">gdk_pango_context_get_for_screen</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">screen</span><span class="symbol">);</span>
225
<span class="normal">layout </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-new">pango_layout_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">context</span><span class="symbol">);</span>
226
<span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-set-text">pango_layout_set_text</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">layout</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Text"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">);</span>
227
<span class="normal">desc </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Fonts.html#pango-font-description-from-string">pango_font_description_from_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">FONT</span><span class="symbol">);</span>
228
<span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-set-font-description">pango_layout_set_font_description</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">layout</span><span class="symbol">,</span><span class="normal"> desc</span><span class="symbol">);</span>
229
<span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Fonts.html#pango-font-description-free">pango_font_description_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">desc</span><span class="symbol">);</span>
230
<span class="comment">/* Draw the layout N_WORDS times in a circle */</span>
231
<span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span><span class="normal"> i </span><span class="symbol"><</span><span class="normal"> N_WORDS</span><span class="symbol">;</span><span class="normal"> i</span><span class="symbol">++)</span>
232
<span class="normal"> </span><span class="cbracket">{</span>
233
<span class="normal"> </span><span class="usertype">GdkColor</span><span class="normal"> color</span><span class="symbol">;</span>
234
<span class="normal"> </span><span class="usertype">PangoMatrix</span><span class="normal"> rotated_matrix </span><span class="symbol">=</span><span class="normal"> matrix</span><span class="symbol">;</span>
235
<span class="normal"> </span><span class="type">int</span><span class="normal"> width</span><span class="symbol">,</span><span class="normal"> height</span><span class="symbol">;</span>
236
<span class="normal"> </span><span class="type">double</span><span class="normal"> angle </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="number">360</span><span class="symbol">.</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> i</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> N_WORDS</span><span class="symbol">;</span>
237
<span class="normal"> </span><span class="comment">/* Gradient from red at angle == 60 to blue at angle == 300 */</span>
238
<span class="normal"> color</span><span class="symbol">.</span><span class="normal">red </span><span class="symbol">=</span><span class="normal"> </span><span class="number">65535</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> </span><span class="function">cos</span><span class="normal"> </span><span class="symbol">((</span><span class="normal">angle </span><span class="symbol">-</span><span class="normal"> </span><span class="number">60</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> M_PI </span><span class="symbol">/</span><span class="normal"> </span><span class="number">180</span><span class="symbol">.))</span><span class="normal"> </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2</span><span class="symbol">;</span>
239
<span class="normal"> color</span><span class="symbol">.</span><span class="normal">green </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
240
<span class="normal"> color</span><span class="symbol">.</span><span class="normal">blue </span><span class="symbol">=</span><span class="normal"> </span><span class="number">65535</span><span class="normal"> </span><span class="symbol">-</span><span class="normal"> color</span><span class="symbol">.</span><span class="normal">red</span><span class="symbol">;</span>
241
<span class="normal"> </span><span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-override-color">gdk_pango_renderer_set_override_color</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDK_PANGO_RENDERER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">),</span>
242
<span class="normal"> <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PANGO-RENDER-PART-FOREGROUND:CAPS">PANGO_RENDER_PART_FOREGROUND</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">color</span><span class="symbol">);</span>
243
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Glyph-Storage.html#pango-matrix-rotate">pango_matrix_rotate</a></span><span class="normal"> </span><span class="symbol">(&</span><span class="normal">rotated_matrix</span><span class="symbol">,</span><span class="normal"> angle</span><span class="symbol">);</span>
244
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#pango-context-set-matrix">pango_context_set_matrix</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">context</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">rotated_matrix</span><span class="symbol">);</span>
245
<span class="normal"> </span><span class="comment">/* Inform Pango to re-layout the text with the new transformation matrix */</span>
246
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-context-changed">pango_layout_context_changed</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">layout</span><span class="symbol">);</span>
247
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#pango-layout-get-size">pango_layout_get_size</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">layout</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">width</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">height</span><span class="symbol">);</span>
248
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#pango-renderer-draw-layout">pango_renderer_draw_layout</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">,</span><span class="normal"> layout</span><span class="symbol">,</span>
249
<span class="normal"> </span><span class="symbol">-</span><span class="normal"> width </span><span class="symbol">/</span><span class="normal"> </span><span class="number">2</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">-</span><span class="normal"> RADIUS </span><span class="symbol">*</span><span class="normal"> <a href="/usr/share/gtk-doc/html/pango/pango-Glyph-Storage.html#PANGO-SCALE:CAPS">PANGO_SCALE</a></span><span class="symbol">);</span>
250
<span class="normal"> </span><span class="cbracket">}</span>
251
<span class="comment">/* Clean up default renderer, since it is shared */</span>
252
<span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-override-color">gdk_pango_renderer_set_override_color</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDK_PANGO_RENDERER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">),</span>
253
<span class="normal"> <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PANGO-RENDER-PART-FOREGROUND:CAPS">PANGO_RENDER_PART_FOREGROUND</a></span><span class="symbol">,</span><span class="normal"> <a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
254
<span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-drawable">gdk_pango_renderer_set_drawable</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDK_PANGO_RENDERER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">),</span><span class="normal"> <a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
255
<span class="function"><a href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-gc">gdk_pango_renderer_set_gc</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDK_PANGO_RENDERER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">renderer</span><span class="symbol">),</span><span class="normal"> <a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
256
<span class="comment">/* free the objects we created */</span>
257
<span class="function">g_object_unref</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">layout</span><span class="symbol">);</span>
258
<span class="function">g_object_unref</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">context</span><span class="symbol">);</span>
259
<span class="function">g_object_unref</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">gc</span><span class="symbol">);</span></pre></td>
266
<br class="example-break"><div class="figure">
267
<a name="idp24397744"></a><p class="title"><b>Figure 1. Output of <a class="xref" href="gdk2-Pango-Interaction.html#rotated-example" title="Example 8. Using GdkPangoRenderer to draw transformed text">Example 8, “Using <span class="type">GdkPangoRenderer</span> to draw transformed text”</a></b></p>
268
<div class="figure-contents"><div><img src="rotated-text.png" alt="Output of"></div></div>
270
<br class="figure-break">
272
<div class="refsect1">
273
<a name="gdk2-Pango-Interaction.details"></a><h2>Details</h2>
274
<div class="refsect2">
275
<a name="GdkPangoRenderer-struct"></a><h3>struct GdkPangoRenderer</h3>
276
<pre class="programlisting">struct GdkPangoRenderer;</pre>
278
<a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> is a subclass of <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="type">PangoRenderer</span></a> used for rendering
279
Pango objects into GDK drawables. The default renderer for a particular
280
screen is obtained with <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-get-default" title="gdk_pango_renderer_get_default ()"><code class="function">gdk_pango_renderer_get_default()</code></a>; Pango
281
functions like <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#pango-renderer-draw-layout"><code class="function">pango_renderer_draw_layout()</code></a> and
282
<a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#pango-renderer-draw-layout-line"><code class="function">pango_renderer_draw_layout_line()</code></a> are then used to draw objects with
286
In most simple cases, applications can just use <a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-layout" title="gdk_draw_layout ()"><code class="function">gdk_draw_layout()</code></a>, and
287
don't need to directly use <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> at all. Using the
288
<a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> directly is most useful when working with a
289
transformation such as a rotation, because the Pango drawing functions
290
take user space coordinates (coordinates before the transformation)
291
instead of device coordinates.
294
In certain cases it can be useful to subclass <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>. Examples
295
of reasons to do this are to add handling of custom attributes by
296
overriding 'prepare_run' or to do custom drawing of embedded objects
297
by overriding 'draw_shape'.
299
<p class="since">Since 2.6</p>
302
<div class="refsect2">
303
<a name="GdkPangoRendererClass"></a><h3>struct GdkPangoRendererClass</h3>
304
<pre class="programlisting">struct GdkPangoRendererClass {
308
<a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> is the class structure for <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>.
310
<p class="since">Since 2.6</p>
313
<div class="refsect2">
314
<a name="gdk-pango-renderer-new"></a><h3>gdk_pango_renderer_new ()</h3>
315
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="returnvalue">PangoRenderer</span></a> * gdk_pango_renderer_new (<em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);</pre>
317
Creates a new <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="type">PangoRenderer</span></a> for <em class="parameter"><code>screen</code></em>. Normally you can use the
318
results of <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-get-default" title="gdk_pango_renderer_get_default ()"><code class="function">gdk_pango_renderer_get_default()</code></a> rather than creating a new
321
<div class="variablelist"><table border="0" class="variablelist">
323
<col align="left" valign="top">
328
<td><p><span class="term"><em class="parameter"><code>screen</code></em> :</span></p></td>
329
<td>a <a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a>
333
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
334
<td>a newly created <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="type">PangoRenderer</span></a>. Free with <code class="function">g_object_unref()</code>.</td>
338
<p class="since">Since 2.6</p>
341
<div class="refsect2">
342
<a name="gdk-pango-renderer-get-default"></a><h3>gdk_pango_renderer_get_default ()</h3>
343
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="returnvalue">PangoRenderer</span></a> * gdk_pango_renderer_get_default (<em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);</pre>
345
Gets the default <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="type">PangoRenderer</span></a> for a screen. This default renderer
346
is shared by all users of the display, so properties such as the color
347
or transformation matrix set for the renderer may be overwritten
348
by functions such as <a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-layout" title="gdk_draw_layout ()"><code class="function">gdk_draw_layout()</code></a>.
351
Before using the renderer, you need to call <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-drawable" title="gdk_pango_renderer_set_drawable ()"><code class="function">gdk_pango_renderer_set_drawable()</code></a>
352
and <a class="link" href="gdk2-Pango-Interaction.html#gdk-pango-renderer-set-gc" title="gdk_pango_renderer_set_gc ()"><code class="function">gdk_pango_renderer_set_gc()</code></a> to set the drawable and graphics context
355
<div class="variablelist"><table border="0" class="variablelist">
357
<col align="left" valign="top">
362
<td><p><span class="term"><em class="parameter"><code>screen</code></em> :</span></p></td>
363
<td>a <a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a>
367
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
368
<td>the default <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderer"><span class="type">PangoRenderer</span></a> for <em class="parameter"><code>screen</code></em>. The
369
renderer is owned by GTK+ and will be kept around until the
370
screen is closed.</td>
374
<p class="since">Since 2.6</p>
377
<div class="refsect2">
378
<a name="gdk-pango-renderer-set-drawable"></a><h3>gdk_pango_renderer_set_drawable ()</h3>
379
<pre class="programlisting"><span class="returnvalue">void</span> gdk_pango_renderer_set_drawable (<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
380
<em class="parameter"><code><a class="link" href="gdk2-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a> *drawable</code></em>);</pre>
382
Sets the drawable the renderer draws to.
384
<div class="variablelist"><table border="0" class="variablelist">
386
<col align="left" valign="top">
391
<td><p><span class="term"><em class="parameter"><code>gdk_renderer</code></em> :</span></p></td>
392
<td>a <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>
396
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
397
<td>the new target drawable, or <a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
402
<p class="since">Since 2.6</p>
405
<div class="refsect2">
406
<a name="gdk-pango-renderer-set-gc"></a><h3>gdk_pango_renderer_set_gc ()</h3>
407
<pre class="programlisting"><span class="returnvalue">void</span> gdk_pango_renderer_set_gc (<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
408
<em class="parameter"><code><a class="link" href="gdk2-Graphics-Contexts.html#GdkGC"><span class="type">GdkGC</span></a> *gc</code></em>);</pre>
410
Sets the GC the renderer draws with. Note that the GC must not be
411
modified until it is unset by calling the function again with
412
<a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> for the <em class="parameter"><code>gc</code></em> parameter, since GDK may make internal copies
413
of the GC which won't be updated to follow changes to the
416
<div class="variablelist"><table border="0" class="variablelist">
418
<col align="left" valign="top">
423
<td><p><span class="term"><em class="parameter"><code>gdk_renderer</code></em> :</span></p></td>
424
<td>a <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>
428
<td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td>
429
<td>the new GC to use for drawing, or <a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
434
<p class="since">Since 2.6</p>
437
<div class="refsect2">
438
<a name="gdk-pango-renderer-set-stipple"></a><h3>gdk_pango_renderer_set_stipple ()</h3>
439
<pre class="programlisting"><span class="returnvalue">void</span> gdk_pango_renderer_set_stipple (<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
440
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderPart"><span class="type">PangoRenderPart</span></a> part</code></em>,
441
<em class="parameter"><code><a class="link" href="gdk2-Bitmaps-and-Pixmaps.html#GdkBitmap" title="GdkBitmap"><span class="type">GdkBitmap</span></a> *stipple</code></em>);</pre>
443
Sets the stipple for one render part (foreground, background, underline,
444
etc.) Note that this is overwritten when iterating through the individual
445
styled runs of a <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> or <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayoutLine"><span class="type">PangoLayoutLine</span></a>. This function is thus
446
only useful when you call low level functions like <a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#pango-renderer-draw-glyphs"><code class="function">pango_renderer_draw_glyphs()</code></a>
447
directly, or in the 'prepare_run' virtual function of a subclass of
448
<a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>.
450
<div class="variablelist"><table border="0" class="variablelist">
452
<col align="left" valign="top">
457
<td><p><span class="term"><em class="parameter"><code>gdk_renderer</code></em> :</span></p></td>
458
<td>a <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>
462
<td><p><span class="term"><em class="parameter"><code>part</code></em> :</span></p></td>
463
<td>the part to render with the stipple</td>
466
<td><p><span class="term"><em class="parameter"><code>stipple</code></em> :</span></p></td>
467
<td>the new stipple value.</td>
471
<p class="since">Since 2.6</p>
474
<div class="refsect2">
475
<a name="gdk-pango-renderer-set-override-color"></a><h3>gdk_pango_renderer_set_override_color ()</h3>
476
<pre class="programlisting"><span class="returnvalue">void</span> gdk_pango_renderer_set_override_color
477
(<em class="parameter"><code><a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a> *gdk_renderer</code></em>,
478
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-pango-renderer.html#PangoRenderPart"><span class="type">PangoRenderPart</span></a> part</code></em>,
479
<em class="parameter"><code>const <a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
481
Sets the color for a particular render part (foreground,
482
background, underline, etc.), overriding any attributes on the layouts
483
renderered with this renderer.
485
<div class="variablelist"><table border="0" class="variablelist">
487
<col align="left" valign="top">
492
<td><p><span class="term"><em class="parameter"><code>gdk_renderer</code></em> :</span></p></td>
493
<td>a <a class="link" href="gdk2-Pango-Interaction.html#GdkPangoRenderer"><span class="type">GdkPangoRenderer</span></a>
497
<td><p><span class="term"><em class="parameter"><code>part</code></em> :</span></p></td>
498
<td>the part to render to set the color of</td>
501
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
502
<td>the color to use, or <a href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> to unset a previously
503
set override color. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
508
<p class="since">Since 2.6</p>
511
<div class="refsect2">
512
<a name="gdk-pango-context-get"></a><h3>gdk_pango_context_get ()</h3>
513
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="returnvalue">PangoContext</span></a> * gdk_pango_context_get (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
515
Creates a <a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> for the default GDK screen.
518
The context must be freed when you're finished with it.
521
When using GTK+, normally you should use <a href="http://developer.gnome.org/gtk2/GtkWidget.html#gtk-widget-get-pango-context"><code class="function">gtk_widget_get_pango_context()</code></a>
522
instead of this function, to get the appropriate context for
523
the widget you intend to render text onto.
526
The newly created context will have the default font options (see
527
<a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-font-options-t.html#cairo-font-options-t"><span class="type">cairo_font_options_t</span></a>) for the default screen; if these options
528
change it will not be updated. Using <a href="http://developer.gnome.org/gtk2/GtkWidget.html#gtk-widget-get-pango-context"><code class="function">gtk_widget_get_pango_context()</code></a>
529
is more convenient if you want to keep a context around and track
530
changes to the screen's font rendering settings.
532
<div class="variablelist"><table border="0" class="variablelist">
534
<col align="left" valign="top">
538
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
539
<td>a new <a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> for the default display</td>
544
<div class="refsect2">
545
<a name="gdk-pango-context-get-for-screen"></a><h3>gdk_pango_context_get_for_screen ()</h3>
546
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="returnvalue">PangoContext</span></a> * gdk_pango_context_get_for_screen (<em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);</pre>
548
Creates a <a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> for <em class="parameter"><code>screen</code></em>.
551
The context must be freed when you're finished with it.
554
When using GTK+, normally you should use <a href="http://developer.gnome.org/gtk2/GtkWidget.html#gtk-widget-get-pango-context"><code class="function">gtk_widget_get_pango_context()</code></a>
555
instead of this function, to get the appropriate context for
556
the widget you intend to render text onto.
559
The newly created context will have the default font options
560
(see <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-font-options-t.html#cairo-font-options-t"><span class="type">cairo_font_options_t</span></a>) for the screen; if these options
561
change it will not be updated. Using <a href="http://developer.gnome.org/gtk2/GtkWidget.html#gtk-widget-get-pango-context"><code class="function">gtk_widget_get_pango_context()</code></a>
562
is more convenient if you want to keep a context around and track
563
changes to the screen's font rendering settings.
565
<div class="variablelist"><table border="0" class="variablelist">
567
<col align="left" valign="top">
572
<td><p><span class="term"><em class="parameter"><code>screen</code></em> :</span></p></td>
573
<td>the <a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> for which the context is to be created.</td>
576
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
577
<td>a new <a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> for <em class="parameter"><code>screen</code></em>
582
<p class="since">Since 2.2</p>
585
<div class="refsect2">
586
<a name="gdk-pango-context-set-colormap"></a><h3>gdk_pango_context_set_colormap ()</h3>
587
<pre class="programlisting"><span class="returnvalue">void</span> gdk_pango_context_set_colormap (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> *context</code></em>,
588
<em class="parameter"><code><a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>);</pre>
589
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
590
<h3 class="title">Warning</h3>
591
<p><code class="literal">gdk_pango_context_set_colormap</code> is deprecated and should not be used in newly-written code.</p>
594
This function used to set the colormap to be used for drawing with
595
<em class="parameter"><code>context</code></em>. The colormap is now always derived from the graphics
596
context used for drawing, so calling this function is no longer
599
<div class="variablelist"><table border="0" class="variablelist">
601
<col align="left" valign="top">
606
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
607
<td>a <a href="/usr/share/gtk-doc/html/pango/pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>
611
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
612
<td>a <a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
619
<div class="refsect2">
620
<a name="GdkPangoAttrEmbossed"></a><h3>struct GdkPangoAttrEmbossed</h3>
621
<pre class="programlisting">struct GdkPangoAttrEmbossed {
627
A Pango text attribute containing a embossed bitmap to be used when
630
<div class="variablelist"><table border="0" class="variablelist">
632
<col align="left" valign="top">
637
<td><p><span class="term"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a> <em class="structfield"><code><a name="GdkPangoAttrEmbossed.attr"></a>attr</code></em>;</span></p></td>
638
<td>the <a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a>.</td>
641
<td><p><span class="term"><span class="type">gboolean</span> <em class="structfield"><code><a name="GdkPangoAttrEmbossed.embossed"></a>embossed</code></em>;</span></p></td>
642
<td>the embossed bitmap.</td>
648
<div class="refsect2">
649
<a name="GdkPangoAttrEmbossColor"></a><h3>struct GdkPangoAttrEmbossColor</h3>
650
<pre class="programlisting">struct GdkPangoAttrEmbossColor {
656
A Pango text attribute specifying the color to emboss text with.
658
<div class="variablelist"><table border="0" class="variablelist">
660
<col align="left" valign="top">
665
<td><p><span class="term"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a> <em class="structfield"><code><a name="GdkPangoAttrEmbossColor.attr"></a>attr</code></em>;</span></p></td>
666
<td>the <a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a>
670
<td><p><span class="term"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoColor"><span class="type">PangoColor</span></a> <em class="structfield"><code><a name="GdkPangoAttrEmbossColor.color"></a>color</code></em>;</span></p></td>
677
<div class="refsect2">
678
<a name="GdkPangoAttrStipple"></a><h3>struct GdkPangoAttrStipple</h3>
679
<pre class="programlisting">struct GdkPangoAttrStipple {
685
A Pango text attribute containing a stipple bitmap to be used when
688
<div class="variablelist"><table border="0" class="variablelist">
690
<col align="left" valign="top">
695
<td><p><span class="term"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a> <em class="structfield"><code><a name="GdkPangoAttrStipple.attr"></a>attr</code></em>;</span></p></td>
696
<td>the <a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a>.</td>
699
<td><p><span class="term"><a class="link" href="gdk2-Bitmaps-and-Pixmaps.html#GdkBitmap" title="GdkBitmap"><span class="type">GdkBitmap</span></a> *<em class="structfield"><code><a name="GdkPangoAttrStipple.stipple"></a>stipple</code></em>;</span></p></td>
700
<td>the stipple bitmap.</td>
706
<div class="refsect2">
707
<a name="gdk-pango-attr-emboss-color-new"></a><h3>gdk_pango_attr_emboss_color_new ()</h3>
708
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="returnvalue">PangoAttribute</span></a> * gdk_pango_attr_emboss_color_new (<em class="parameter"><code>const <a class="link" href="gdk2-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
710
Creates a new attribute specifying the color to emboss text with.
712
<div class="variablelist"><table border="0" class="variablelist">
714
<col align="left" valign="top">
719
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
720
<td>a GdkColor representing the color to emboss with</td>
723
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
724
<td>new <a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a>
729
<p class="since">Since 2.12</p>
732
<div class="refsect2">
733
<a name="gdk-pango-attr-embossed-new"></a><h3>gdk_pango_attr_embossed_new ()</h3>
734
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="returnvalue">PangoAttribute</span></a> * gdk_pango_attr_embossed_new (<em class="parameter"><code><span class="type">gboolean</span> embossed</code></em>);</pre>
736
Creates a new attribute flagging a region as embossed or not.
738
<div class="variablelist"><table border="0" class="variablelist">
740
<col align="left" valign="top">
745
<td><p><span class="term"><em class="parameter"><code>embossed</code></em> :</span></p></td>
746
<td>if the region should be embossed</td>
749
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
750
<td>new <a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a>
757
<div class="refsect2">
758
<a name="gdk-pango-attr-stipple-new"></a><h3>gdk_pango_attr_stipple_new ()</h3>
759
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="returnvalue">PangoAttribute</span></a> * gdk_pango_attr_stipple_new (<em class="parameter"><code><a class="link" href="gdk2-Bitmaps-and-Pixmaps.html#GdkBitmap" title="GdkBitmap"><span class="type">GdkBitmap</span></a> *stipple</code></em>);</pre>
761
Creates a new attribute containing a stipple bitmap to be used when
764
<div class="variablelist"><table border="0" class="variablelist">
766
<col align="left" valign="top">
771
<td><p><span class="term"><em class="parameter"><code>stipple</code></em> :</span></p></td>
772
<td>a bitmap to be set as stipple</td>
775
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
776
<td>new <a href="/usr/share/gtk-doc/html/pango/pango-Text-Attributes.html#PangoAttribute"><span class="type">PangoAttribute</span></a>
783
<div class="refsect2">
784
<a name="gdk-pango-layout-get-clip-region"></a><h3>gdk_pango_layout_get_clip_region ()</h3>
785
<pre class="programlisting"><a class="link" href="gdk2-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="returnvalue">GdkRegion</span></a> * gdk_pango_layout_get_clip_region (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> *layout</code></em>,
786
<em class="parameter"><code><span class="type">gint</span> x_origin</code></em>,
787
<em class="parameter"><code><span class="type">gint</span> y_origin</code></em>,
788
<em class="parameter"><code>const <span class="type">gint</span> *index_ranges</code></em>,
789
<em class="parameter"><code><span class="type">gint</span> n_ranges</code></em>);</pre>
791
Obtains a clip region which contains the areas where the given ranges
792
of text would be drawn. <em class="parameter"><code>x_origin</code></em> and <em class="parameter"><code>y_origin</code></em> are the same position
793
you would pass to <a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-layout-line" title="gdk_draw_layout_line ()"><code class="function">gdk_draw_layout_line()</code></a>. <em class="parameter"><code>index_ranges</code></em> should contain
794
ranges of bytes in the layout's text.
797
Note that the regions returned correspond to logical extents of the text
798
ranges, not ink extents. So the drawn layout may in fact touch areas out of
799
the clip region. The clip region is mainly useful for highlightling parts
800
of text, such as when text is selected.
802
<div class="variablelist"><table border="0" class="variablelist">
804
<col align="left" valign="top">
809
<td><p><span class="term"><em class="parameter"><code>layout</code></em> :</span></p></td>
810
<td>a <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>
814
<td><p><span class="term"><em class="parameter"><code>x_origin</code></em> :</span></p></td>
815
<td>X pixel where you intend to draw the layout with this clip</td>
818
<td><p><span class="term"><em class="parameter"><code>y_origin</code></em> :</span></p></td>
819
<td>Y pixel where you intend to draw the layout with this clip</td>
822
<td><p><span class="term"><em class="parameter"><code>index_ranges</code></em> :</span></p></td>
823
<td>array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes</td>
826
<td><p><span class="term"><em class="parameter"><code>n_ranges</code></em> :</span></p></td>
827
<td>number of ranges in <em class="parameter"><code>index_ranges</code></em>, i.e. half the size of <em class="parameter"><code>index_ranges</code></em>
831
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
832
<td>a clip region containing the given ranges</td>
838
<div class="refsect2">
839
<a name="gdk-pango-layout-line-get-clip-region"></a><h3>gdk_pango_layout_line_get_clip_region ()</h3>
840
<pre class="programlisting"><a class="link" href="gdk2-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="returnvalue">GdkRegion</span></a> * gdk_pango_layout_line_get_clip_region
841
(<em class="parameter"><code><a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayoutLine"><span class="type">PangoLayoutLine</span></a> *line</code></em>,
842
<em class="parameter"><code><span class="type">gint</span> x_origin</code></em>,
843
<em class="parameter"><code><span class="type">gint</span> y_origin</code></em>,
844
<em class="parameter"><code>const <span class="type">gint</span> *index_ranges</code></em>,
845
<em class="parameter"><code><span class="type">gint</span> n_ranges</code></em>);</pre>
847
Obtains a clip region which contains the areas where the given
848
ranges of text would be drawn. <em class="parameter"><code>x_origin</code></em> and <em class="parameter"><code>y_origin</code></em> are the same
849
position you would pass to <a class="link" href="gdk2-Drawing-Primitives.html#gdk-draw-layout-line" title="gdk_draw_layout_line ()"><code class="function">gdk_draw_layout_line()</code></a>. <em class="parameter"><code>index_ranges</code></em>
850
should contain ranges of bytes in the layout's text. The clip
851
region will include space to the left or right of the line (to the
852
layout bounding box) if you have indexes above or below the indexes
853
contained inside the line. This is to draw the selection all the way
854
to the side of the layout. However, the clip region is in line coordinates,
855
not layout coordinates.
858
Note that the regions returned correspond to logical extents of the text
859
ranges, not ink extents. So the drawn line may in fact touch areas out of
860
the clip region. The clip region is mainly useful for highlightling parts
861
of text, such as when text is selected.
863
<div class="variablelist"><table border="0" class="variablelist">
865
<col align="left" valign="top">
870
<td><p><span class="term"><em class="parameter"><code>line</code></em> :</span></p></td>
871
<td>a <a href="/usr/share/gtk-doc/html/pango/pango-Layout-Objects.html#PangoLayoutLine"><span class="type">PangoLayoutLine</span></a>
875
<td><p><span class="term"><em class="parameter"><code>x_origin</code></em> :</span></p></td>
876
<td>X pixel where you intend to draw the layout line with this clip</td>
879
<td><p><span class="term"><em class="parameter"><code>y_origin</code></em> :</span></p></td>
880
<td>baseline pixel where you intend to draw the layout line with this clip</td>
883
<td><p><span class="term"><em class="parameter"><code>index_ranges</code></em> :</span></p></td>
884
<td>array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes</td>
887
<td><p><span class="term"><em class="parameter"><code>n_ranges</code></em> :</span></p></td>
888
<td>number of ranges in <em class="parameter"><code>index_ranges</code></em>, i.e. half the size of <em class="parameter"><code>index_ranges</code></em>
892
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
893
<td>a clip region containing the given ranges</td>
899
<div class="refsect1">
900
<a name="gdk2-Pango-Interaction.property-details"></a><h2>Property Details</h2>
901
<div class="refsect2">
902
<a name="GdkPangoRenderer--screen"></a><h3>The <code class="literal">"screen"</code> property</h3>
903
<pre class="programlisting"> "screen" <a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a>* : Read / Write / Construct Only</pre>
904
<p>the GdkScreen for the renderer.</p>
910
Generated by GTK-Doc V1.18</div>
b'\\ No newline at end of file'