1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gdk.Pango; 26 27 private import cairo.Region; 28 private import gdk.Display; 29 private import gdk.Screen; 30 private import gobject.ObjectG; 31 private import gtkc.gdk; 32 public import gtkc.gdktypes; 33 private import pango.PgContext; 34 private import pango.PgLayout; 35 private import pango.PgLayoutLine; 36 37 38 /** */ 39 40 /** 41 * Creates a #PangoContext for the default GDK screen. 42 * 43 * The context must be freed when you’re finished with it. 44 * 45 * When using GTK+, normally you should use gtk_widget_get_pango_context() 46 * instead of this function, to get the appropriate context for 47 * the widget you intend to render text onto. 48 * 49 * The newly created context will have the default font options (see 50 * #cairo_font_options_t) for the default screen; if these options 51 * change it will not be updated. Using gtk_widget_get_pango_context() 52 * is more convenient if you want to keep a context around and track 53 * changes to the screen’s font rendering settings. 54 * 55 * Returns: a new #PangoContext for the default display 56 */ 57 public PgContext contextGet() 58 { 59 auto p = gdk_pango_context_get(); 60 61 if(p is null) 62 { 63 return null; 64 } 65 66 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p, true); 67 } 68 69 /** 70 * Creates a #PangoContext for @screen. 71 * 72 * The context must be freed when you’re finished with it. 73 * 74 * When using GTK+, normally you should use gtk_widget_get_pango_context() 75 * instead of this function, to get the appropriate context for 76 * the widget you intend to render text onto. 77 * 78 * The newly created context will have the default font options 79 * (see #cairo_font_options_t) for the screen; if these options 80 * change it will not be updated. Using gtk_widget_get_pango_context() 81 * is more convenient if you want to keep a context around and track 82 * changes to the screen’s font rendering settings. 83 * 84 * Params: 85 * screen = the #GdkScreen for which the context is to be created. 86 * 87 * Returns: a new #PangoContext for @screen 88 * 89 * Since: 2.2 90 */ 91 public PgContext contextGetForScreen(Screen screen) 92 { 93 auto p = gdk_pango_context_get_for_screen((screen is null) ? null : screen.getScreenStruct()); 94 95 if(p is null) 96 { 97 return null; 98 } 99 100 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p, true); 101 } 102 103 /** 104 * Obtains a clip region which contains the areas where the given ranges 105 * of text would be drawn. @x_origin and @y_origin are the top left point 106 * to center the layout. @index_ranges should contain 107 * ranges of bytes in the layout’s text. 108 * 109 * Note that the regions returned correspond to logical extents of the text 110 * ranges, not ink extents. So the drawn layout may in fact touch areas out of 111 * the clip region. The clip region is mainly useful for highlightling parts 112 * of text, such as when text is selected. 113 * 114 * Params: 115 * layout = a #PangoLayout 116 * xOrigin = X pixel where you intend to draw the layout with this clip 117 * yOrigin = Y pixel where you intend to draw the layout with this clip 118 * indexRanges = array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes 119 * nRanges = number of ranges in @index_ranges, i.e. half the size of @index_ranges 120 * 121 * Returns: a clip region containing the given ranges 122 */ 123 public Region layoutGetClipRegion(PgLayout layout, int xOrigin, int yOrigin, int* indexRanges, int nRanges) 124 { 125 auto p = gdk_pango_layout_get_clip_region((layout is null) ? null : layout.getPgLayoutStruct(), xOrigin, yOrigin, indexRanges, nRanges); 126 127 if(p is null) 128 { 129 return null; 130 } 131 132 return new Region(cast(cairo_region_t*) p); 133 } 134 135 /** 136 * Obtains a clip region which contains the areas where the given 137 * ranges of text would be drawn. @x_origin and @y_origin are the top left 138 * position of the layout. @index_ranges 139 * should contain ranges of bytes in the layout’s text. The clip 140 * region will include space to the left or right of the line (to the 141 * layout bounding box) if you have indexes above or below the indexes 142 * contained inside the line. This is to draw the selection all the way 143 * to the side of the layout. However, the clip region is in line coordinates, 144 * not layout coordinates. 145 * 146 * Note that the regions returned correspond to logical extents of the text 147 * ranges, not ink extents. So the drawn line may in fact touch areas out of 148 * the clip region. The clip region is mainly useful for highlightling parts 149 * of text, such as when text is selected. 150 * 151 * Params: 152 * line = a #PangoLayoutLine 153 * xOrigin = X pixel where you intend to draw the layout line with this clip 154 * yOrigin = baseline pixel where you intend to draw the layout line with this clip 155 * indexRanges = array of byte indexes into the layout, 156 * where even members of array are start indexes and odd elements 157 * are end indexes 158 * nRanges = number of ranges in @index_ranges, i.e. half the size of @index_ranges 159 * 160 * Returns: a clip region containing the given ranges 161 */ 162 public Region layoutLineGetClipRegion(PgLayoutLine line, int xOrigin, int yOrigin, int[] indexRanges, int nRanges) 163 { 164 auto p = gdk_pango_layout_line_get_clip_region((line is null) ? null : line.getPgLayoutLineStruct(), xOrigin, yOrigin, indexRanges.ptr, nRanges); 165 166 if(p is null) 167 { 168 return null; 169 } 170 171 return new Region(cast(cairo_region_t*) p); 172 } 173 174 /** 175 * Creates a #PangoContext for @display. 176 * 177 * The context must be freed when you’re finished with it. 178 * 179 * When using GTK+, normally you should use gtk_widget_get_pango_context() 180 * instead of this function, to get the appropriate context for 181 * the widget you intend to render text onto. 182 * 183 * The newly created context will have the default font options 184 * (see #cairo_font_options_t) for the display; if these options 185 * change it will not be updated. Using gtk_widget_get_pango_context() 186 * is more convenient if you want to keep a context around and track 187 * changes to the font rendering settings. 188 * 189 * Params: 190 * display = the #GdkDisplay for which the context is to be created 191 * 192 * Returns: a new #PangoContext for @display 193 * 194 * Since: 3.22 195 */ 196 public PgContext contextGetForDisplay(Display display) 197 { 198 auto p = gdk_pango_context_get_for_display((display is null) ? null : display.getDisplayStruct()); 199 200 if(p is null) 201 { 202 return null; 203 } 204 205 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p, true); 206 }