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 * Conversion parameters: 26 * inFile = pango-Text-Attributes.html 27 * outPack = pango 28 * outFile = PgAttribute 29 * strct = PangoAttribute 30 * realStrct= 31 * ctorStrct= 32 * clss = PgAttribute 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - pango_attr_ 41 * - pango_ 42 * omit structs: 43 * omit prefixes: 44 * - pango_color_ 45 * - pango_language_ 46 * - pango_attr_list_ 47 * - pango_attr_iterator_ 48 * omit code: 49 * omit signals: 50 * imports: 51 * - glib.Str 52 * - glib.ErrorG 53 * - glib.GException 54 * - glib.SimpleXML 55 * - pango.PgAttributeList 56 * - pango.PgLanguage 57 * - pango.PgFontDescription 58 * structWrap: 59 * - GMarkupParseContext* -> SimpleXML 60 * - PangoAttrList* -> PgAttributeList 61 * - PangoAttribute* -> PgAttribute 62 * - PangoFontDescription* -> PgFontDescription 63 * - PangoLanguage* -> PgLanguage 64 * module aliases: 65 * local aliases: 66 * overrides: 67 */ 68 69 module pango.PgAttribute; 70 71 public import gtkc.pangotypes; 72 73 private import gtkc.pango; 74 private import glib.ConstructionException; 75 private import gobject.ObjectG; 76 77 78 private import glib.Str; 79 private import glib.ErrorG; 80 private import glib.GException; 81 private import glib.SimpleXML; 82 private import pango.PgAttributeList; 83 private import pango.PgLanguage; 84 private import pango.PgFontDescription; 85 86 87 88 89 /** 90 * Attributed text is used in a number of places in Pango. It 91 * is used as the input to the itemization process and also when 92 * creating a PangoLayout. The data types and functions in 93 * this section are used to represent and manipulate sets 94 * of attributes applied to a portion of text. 95 */ 96 public class PgAttribute 97 { 98 99 /** the main Gtk struct */ 100 protected PangoAttribute* pangoAttribute; 101 102 103 public PangoAttribute* getPgAttributeStruct() 104 { 105 return pangoAttribute; 106 } 107 108 109 /** the main Gtk struct as a void* */ 110 protected void* getStruct() 111 { 112 return cast(void*)pangoAttribute; 113 } 114 115 /** 116 * Sets our main struct and passes it to the parent class 117 */ 118 public this (PangoAttribute* pangoAttribute) 119 { 120 this.pangoAttribute = pangoAttribute; 121 } 122 123 /** 124 */ 125 126 /** 127 * Parses marked-up text (see 128 * markup format) to create 129 * a plain-text string and an attribute list. 130 * If accel_marker is nonzero, the given character will mark the 131 * character following it as an accelerator. For example, accel_marker 132 * might be an ampersand or underscore. All characters marked 133 * as an accelerator will receive a PANGO_UNDERLINE_LOW attribute, 134 * and the first character so marked will be returned in accel_char. 135 * Two accel_marker characters following each other produce a single 136 * literal accel_marker character. 137 * To parse a stream of pango markup incrementally, use pango_markup_parser_new(). 138 * If any error happens, none of the output arguments are touched except 139 * for error. 140 * Params: 141 * markupText = markup to parse (see markup format) 142 * length = length of markup_text, or -1 if nul-terminated 143 * accelMarker = character that precedes an accelerator, or 0 for none 144 * attrList = address of return location for a PangoAttrList, or NULL. [out][allow-none] 145 * text = address of return location for text with tags stripped, or NULL. [out][allow-none] 146 * accelChar = address of return location for accelerator char, or NULL. [out][allow-none] 147 * Returns: FALSE if error is set, otherwise TRUE 148 * Throws: GException on failure. 149 */ 150 public static int parseMarkup(string markupText, int length, gunichar accelMarker, out PgAttributeList attrList, out string text, gunichar* accelChar) 151 { 152 // gboolean pango_parse_markup (const char *markup_text, int length, gunichar accel_marker, PangoAttrList **attr_list, char **text, gunichar *accel_char, GError **error); 153 PangoAttrList* outattrList = null; 154 char* outtext = null; 155 GError* err = null; 156 157 auto p = pango_parse_markup(Str.toStringz(markupText), length, accelMarker, &outattrList, &outtext, accelChar, &err); 158 159 if (err !is null) 160 { 161 throw new GException( new ErrorG(err) ); 162 } 163 164 attrList = ObjectG.getDObject!(PgAttributeList)(outattrList); 165 text = Str.toString(outtext); 166 return p; 167 } 168 169 /** 170 * Parses marked-up text (see 171 * markup format) to create 172 * a plain-text string and an attribute list. 173 * If accel_marker is nonzero, the given character will mark the 174 * character following it as an accelerator. For example, accel_marker 175 * might be an ampersand or underscore. All characters marked 176 * as an accelerator will receive a PANGO_UNDERLINE_LOW attribute, 177 * and the first character so marked will be returned in accel_char, 178 * when calling finish(). Two accel_marker characters following each 179 * other produce a single literal accel_marker character. 180 * To feed markup to the parser, use g_markup_parse_context_parse() 181 * on the returned GMarkupParseContext. When done with feeding markup 182 * to the parser, use pango_markup_parser_finish() to get the data out 183 * of it, and then use g_markup_parse_context_free() to free it. 184 * This function is designed for applications that read pango markup 185 * from streams. To simply parse a string containing pango markup, 186 * the simpler pango_parse_markup() API is recommended instead. 187 * Since 1.31.0 188 * Params: 189 * accelMarker = character that precedes an accelerator, or 0 for none 190 * Returns: a GMarkupParseContext that should be destroyed with g_markup_parse_context_free(). [transfer none] 191 */ 192 public static SimpleXML markupParserNew(gunichar accelMarker) 193 { 194 // GMarkupParseContext * pango_markup_parser_new (gunichar accel_marker); 195 auto p = pango_markup_parser_new(accelMarker); 196 197 if(p is null) 198 { 199 return null; 200 } 201 202 return ObjectG.getDObject!(SimpleXML)(cast(GMarkupParseContext*) p); 203 } 204 205 /** 206 * After feeding a pango markup parser some data with g_markup_parse_context_parse(), 207 * use this function to get the list of pango attributes and text out of the 208 * markup. This function will not free context, use g_markup_parse_context_free() 209 * to do so. 210 * Since 1.31.0 211 * Params: 212 * context = A valid parse context that was returned from pango_markup_parser_new() 213 * attrList = address of return location for a PangoAttrList, or NULL. [out][allow-none] 214 * text = address of return location for text with tags stripped, or NULL. [out][allow-none] 215 * accelChar = address of return location for accelerator char, or NULL. [out][allow-none] 216 * Returns: FALSE if error is set, otherwise TRUE 217 * Throws: GException on failure. 218 */ 219 public static int markupParserFinish(SimpleXML context, out PgAttributeList attrList, out string text, out gunichar accelChar) 220 { 221 // gboolean pango_markup_parser_finish (GMarkupParseContext *context, PangoAttrList **attr_list, char **text, gunichar *accel_char, GError **error); 222 PangoAttrList* outattrList = null; 223 char* outtext = null; 224 GError* err = null; 225 226 auto p = pango_markup_parser_finish((context is null) ? null : context.getSimpleXMLStruct(), &outattrList, &outtext, &accelChar, &err); 227 228 if (err !is null) 229 { 230 throw new GException( new ErrorG(err) ); 231 } 232 233 attrList = ObjectG.getDObject!(PgAttributeList)(outattrList); 234 text = Str.toString(outtext); 235 return p; 236 } 237 238 /** 239 * Allocate a new attribute type ID. The attribute type name can be accessed 240 * later by using pango_attr_type_get_name(). 241 * Params: 242 * name = an identifier for the type 243 * Returns: the new type ID. 244 */ 245 public static PangoAttrType typeRegister(string name) 246 { 247 // PangoAttrType pango_attr_type_register (const gchar *name); 248 return pango_attr_type_register(Str.toStringz(name)); 249 } 250 251 /** 252 * Fetches the attribute type name passed in when registering the type using 253 * pango_attr_type_register(). 254 * The returned value is an interned string (see g_intern_string() for what 255 * that means) that should not be modified or freed. 256 * Since 1.22 257 * Params: 258 * type = an attribute type ID to fetch the name for 259 * Returns: the type ID name (which may be NULL), or NULL if type is a built-in Pango attribute type or invalid. 260 */ 261 public static string typeGetName(PangoAttrType type) 262 { 263 // const char * pango_attr_type_get_name (PangoAttrType type); 264 return Str.toString(pango_attr_type_get_name(type)); 265 } 266 267 /** 268 * Initializes attr's klass to klass, 269 * it's start_index to PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING 270 * and end_index to PANGO_ATTR_INDEX_TO_TEXT_END 271 * such that the attribute applies 272 * to the entire text by default. 273 * Since 1.20 274 * Params: 275 * attr = a PangoAttribute 276 * klass = a PangoAttributeClass 277 */ 278 public void attributeInit(PangoAttrClass* klass) 279 { 280 // void pango_attribute_init (PangoAttribute *attr, const PangoAttrClass *klass); 281 pango_attribute_init(pangoAttribute, klass); 282 } 283 284 /** 285 * Make a copy of an attribute. 286 * Params: 287 * attr = a PangoAttribute 288 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 289 */ 290 public PgAttribute attributeCopy() 291 { 292 // PangoAttribute * pango_attribute_copy (const PangoAttribute *attr); 293 auto p = pango_attribute_copy(pangoAttribute); 294 295 if(p is null) 296 { 297 return null; 298 } 299 300 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 301 } 302 303 /** 304 * Compare two attributes for equality. This compares only the 305 * actual value of the two attributes and not the ranges that the 306 * attributes apply to. 307 * Params: 308 * attr2 = another PangoAttribute 309 * Returns: TRUE if the two attributes have the same value. 310 */ 311 public int attributeEqual(PgAttribute attr2) 312 { 313 // gboolean pango_attribute_equal (const PangoAttribute *attr1, const PangoAttribute *attr2); 314 return pango_attribute_equal(pangoAttribute, (attr2 is null) ? null : attr2.getPgAttributeStruct()); 315 } 316 317 /** 318 * Destroy a PangoAttribute and free all associated memory. 319 * Params: 320 * attr = a PangoAttribute. 321 */ 322 public void attributeDestroy() 323 { 324 // void pango_attribute_destroy (PangoAttribute *attr); 325 pango_attribute_destroy(pangoAttribute); 326 } 327 328 /** 329 * Create a new language tag attribute. 330 * Params: 331 * language = language tag 332 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 333 */ 334 public static PgAttribute languageNew(PgLanguage language) 335 { 336 // PangoAttribute * pango_attr_language_new (PangoLanguage *language); 337 auto p = pango_attr_language_new((language is null) ? null : language.getPgLanguageStruct()); 338 339 if(p is null) 340 { 341 return null; 342 } 343 344 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 345 } 346 347 /** 348 * Create a new font family attribute. 349 * Params: 350 * family = the family or comma separated list of families 351 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 352 */ 353 public static PgAttribute familyNew(string family) 354 { 355 // PangoAttribute * pango_attr_family_new (const char *family); 356 auto p = pango_attr_family_new(Str.toStringz(family)); 357 358 if(p is null) 359 { 360 return null; 361 } 362 363 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 364 } 365 366 /** 367 * Create a new font slant style attribute. 368 * Params: 369 * style = the slant style 370 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 371 */ 372 public static PgAttribute styleNew(PangoStyle style) 373 { 374 // PangoAttribute * pango_attr_style_new (PangoStyle style); 375 auto p = pango_attr_style_new(style); 376 377 if(p is null) 378 { 379 return null; 380 } 381 382 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 383 } 384 385 /** 386 * Create a new font variant attribute (normal or small caps) 387 * Params: 388 * variant = the variant 389 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 390 */ 391 public static PgAttribute variantNew(PangoVariant variant) 392 { 393 // PangoAttribute * pango_attr_variant_new (PangoVariant variant); 394 auto p = pango_attr_variant_new(variant); 395 396 if(p is null) 397 { 398 return null; 399 } 400 401 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 402 } 403 404 /** 405 * Create a new font stretch attribute 406 * Params: 407 * stretch = the stretch 408 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 409 */ 410 public static PgAttribute stretchNew(PangoStretch stretch) 411 { 412 // PangoAttribute * pango_attr_stretch_new (PangoStretch stretch); 413 auto p = pango_attr_stretch_new(stretch); 414 415 if(p is null) 416 { 417 return null; 418 } 419 420 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 421 } 422 423 /** 424 * Create a new font weight attribute. 425 * Params: 426 * weight = the weight 427 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 428 */ 429 public static PgAttribute weightNew(PangoWeight weight) 430 { 431 // PangoAttribute * pango_attr_weight_new (PangoWeight weight); 432 auto p = pango_attr_weight_new(weight); 433 434 if(p is null) 435 { 436 return null; 437 } 438 439 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 440 } 441 442 /** 443 * Create a new font-size attribute in fractional points. 444 * Params: 445 * size = the font size, in PANGO_SCALEths of a point. 446 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 447 */ 448 public static PgAttribute sizeNew(int size) 449 { 450 // PangoAttribute * pango_attr_size_new (int size); 451 auto p = pango_attr_size_new(size); 452 453 if(p is null) 454 { 455 return null; 456 } 457 458 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 459 } 460 461 /** 462 * Create a new font-size attribute in device units. 463 * Since 1.8 464 * Params: 465 * size = the font size, in PANGO_SCALEths of a device unit. 466 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). 467 */ 468 public static PgAttribute sizeNewAbsolute(int size) 469 { 470 // PangoAttribute * pango_attr_size_new_absolute (int size); 471 auto p = pango_attr_size_new_absolute(size); 472 473 if(p is null) 474 { 475 return null; 476 } 477 478 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 479 } 480 481 /** 482 * Create a new font description attribute. This attribute 483 * allows setting family, style, weight, variant, stretch, 484 * and size simultaneously. 485 * Params: 486 * desc = the font description 487 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 488 */ 489 public static PgAttribute fontDescNew(PgFontDescription desc) 490 { 491 // PangoAttribute * pango_attr_font_desc_new (const PangoFontDescription *desc); 492 auto p = pango_attr_font_desc_new((desc is null) ? null : desc.getPgFontDescriptionStruct()); 493 494 if(p is null) 495 { 496 return null; 497 } 498 499 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 500 } 501 502 /** 503 * Create a new foreground color attribute. 504 * Params: 505 * red = the red value (ranging from 0 to 65535) 506 * green = the green value 507 * blue = the blue value 508 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 509 */ 510 public static PgAttribute foregroundNew(ushort red, ushort green, ushort blue) 511 { 512 // PangoAttribute * pango_attr_foreground_new (guint16 red, guint16 green, guint16 blue); 513 auto p = pango_attr_foreground_new(red, green, blue); 514 515 if(p is null) 516 { 517 return null; 518 } 519 520 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 521 } 522 523 /** 524 * Create a new background color attribute. 525 * Params: 526 * red = the red value (ranging from 0 to 65535) 527 * green = the green value 528 * blue = the blue value 529 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 530 */ 531 public static PgAttribute backgroundNew(ushort red, ushort green, ushort blue) 532 { 533 // PangoAttribute * pango_attr_background_new (guint16 red, guint16 green, guint16 blue); 534 auto p = pango_attr_background_new(red, green, blue); 535 536 if(p is null) 537 { 538 return null; 539 } 540 541 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 542 } 543 544 /** 545 * Create a new strike-through attribute. 546 * Params: 547 * strikethrough = TRUE if the text should be struck-through. 548 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 549 */ 550 public static PgAttribute strikethroughNew(int strikethrough) 551 { 552 // PangoAttribute * pango_attr_strikethrough_new (gboolean strikethrough); 553 auto p = pango_attr_strikethrough_new(strikethrough); 554 555 if(p is null) 556 { 557 return null; 558 } 559 560 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 561 } 562 563 /** 564 * Create a new strikethrough color attribute. This attribute 565 * modifies the color of strikethrough lines. If not set, strikethrough 566 * lines will use the foreground color. 567 * Since 1.8 568 * Params: 569 * red = the red value (ranging from 0 to 65535) 570 * green = the green value 571 * blue = the blue value 572 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 573 */ 574 public static PgAttribute strikethroughColorNew(ushort red, ushort green, ushort blue) 575 { 576 // PangoAttribute * pango_attr_strikethrough_color_new (guint16 red, guint16 green, guint16 blue); 577 auto p = pango_attr_strikethrough_color_new(red, green, blue); 578 579 if(p is null) 580 { 581 return null; 582 } 583 584 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 585 } 586 587 /** 588 * Create a new underline-style attribute. 589 * Params: 590 * underline = the underline style. 591 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 592 */ 593 public static PgAttribute underlineNew(PangoUnderline underline) 594 { 595 // PangoAttribute * pango_attr_underline_new (PangoUnderline underline); 596 auto p = pango_attr_underline_new(underline); 597 598 if(p is null) 599 { 600 return null; 601 } 602 603 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 604 } 605 606 /** 607 * Create a new underline color attribute. This attribute 608 * modifies the color of underlines. If not set, underlines 609 * will use the foreground color. 610 * Since 1.8 611 * Params: 612 * red = the red value (ranging from 0 to 65535) 613 * green = the green value 614 * blue = the blue value 615 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 616 */ 617 public static PgAttribute underlineColorNew(ushort red, ushort green, ushort blue) 618 { 619 // PangoAttribute * pango_attr_underline_color_new (guint16 red, guint16 green, guint16 blue); 620 auto p = pango_attr_underline_color_new(red, green, blue); 621 622 if(p is null) 623 { 624 return null; 625 } 626 627 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 628 } 629 630 /** 631 * Create a new shape attribute. A shape is used to impose a 632 * particular ink and logical rectangle on the result of shaping a 633 * particular glyph. This might be used, for instance, for 634 * embedding a picture or a widget inside a PangoLayout. 635 * Params: 636 * inkRect = ink rectangle to assign to each character 637 * logicalRect = logical rectangle to assign to each character 638 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 639 */ 640 public static PgAttribute shapeNew(PangoRectangle* inkRect, PangoRectangle* logicalRect) 641 { 642 // PangoAttribute * pango_attr_shape_new (const PangoRectangle *ink_rect, const PangoRectangle *logical_rect); 643 auto p = pango_attr_shape_new(inkRect, logicalRect); 644 645 if(p is null) 646 { 647 return null; 648 } 649 650 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 651 } 652 653 /** 654 * Like pango_attr_shape_new(), but a user data pointer is also 655 * provided; this pointer can be accessed when later 656 * rendering the glyph. 657 * Since 1.8 658 * Params: 659 * inkRect = ink rectangle to assign to each character 660 * logicalRect = logical rectangle to assign to each character 661 * data = user data pointer 662 * copyFunc = function to copy data when the 663 * attribute is copied. If NULL, data is simply 664 * copied as a pointer. [allow-none] 665 * destroyFunc = function to free data when the 666 * attribute is freed, or NULL. [allow-none] 667 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). 668 */ 669 public static PgAttribute shapeNewWithData(PangoRectangle* inkRect, PangoRectangle* logicalRect, void* data, PangoAttrDataCopyFunc copyFunc, GDestroyNotify destroyFunc) 670 { 671 // PangoAttribute * pango_attr_shape_new_with_data (const PangoRectangle *ink_rect, const PangoRectangle *logical_rect, gpointer data, PangoAttrDataCopyFunc copy_func, GDestroyNotify destroy_func); 672 auto p = pango_attr_shape_new_with_data(inkRect, logicalRect, data, copyFunc, destroyFunc); 673 674 if(p is null) 675 { 676 return null; 677 } 678 679 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 680 } 681 682 /** 683 * Create a new font size scale attribute. The base font for the 684 * affected text will have its size multiplied by scale_factor. 685 * Params: 686 * scaleFactor = factor to scale the font 687 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 688 */ 689 public static PgAttribute scaleNew(double scaleFactor) 690 { 691 // PangoAttribute * pango_attr_scale_new (double scale_factor); 692 auto p = pango_attr_scale_new(scaleFactor); 693 694 if(p is null) 695 { 696 return null; 697 } 698 699 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 700 } 701 702 /** 703 * Create a new baseline displacement attribute. 704 * Params: 705 * rise = the amount that the text should be displaced vertically, 706 * in Pango units. Positive values displace the text upwards. 707 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 708 */ 709 public static PgAttribute riseNew(int rise) 710 { 711 // PangoAttribute * pango_attr_rise_new (int rise); 712 auto p = pango_attr_rise_new(rise); 713 714 if(p is null) 715 { 716 return null; 717 } 718 719 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 720 } 721 722 /** 723 * Create a new letter-spacing attribute. 724 * Since 1.6 725 * Params: 726 * letterSpacing = amount of extra space to add between graphemes 727 * of the text, in Pango units. 728 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 729 */ 730 public static PgAttribute letterSpacingNew(int letterSpacing) 731 { 732 // PangoAttribute * pango_attr_letter_spacing_new (int letter_spacing); 733 auto p = pango_attr_letter_spacing_new(letterSpacing); 734 735 if(p is null) 736 { 737 return null; 738 } 739 740 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 741 } 742 743 /** 744 * Create a new font fallback attribute. 745 * If fallback is disabled, characters will only be used from the 746 * closest matching font on the system. No fallback will be done to 747 * other fonts on the system that might contain the characters in the 748 * text. 749 * Since 1.4 750 * Params: 751 * enableFallback = TRUE if we should fall back on other fonts 752 * for characters the active font is missing. 753 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 754 */ 755 public static PgAttribute fallbackNew(int enableFallback) 756 { 757 // PangoAttribute * pango_attr_fallback_new (gboolean enable_fallback); 758 auto p = pango_attr_fallback_new(enableFallback); 759 760 if(p is null) 761 { 762 return null; 763 } 764 765 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 766 } 767 768 /** 769 * Create a new gravity attribute. 770 * Since 1.16 771 * Params: 772 * gravity = the gravity value; should not be PANGO_GRAVITY_AUTO. 773 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 774 */ 775 public static PgAttribute gravityNew(PangoGravity gravity) 776 { 777 // PangoAttribute * pango_attr_gravity_new (PangoGravity gravity); 778 auto p = pango_attr_gravity_new(gravity); 779 780 if(p is null) 781 { 782 return null; 783 } 784 785 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 786 } 787 788 /** 789 * Create a new gravity hint attribute. 790 * Since 1.16 791 * Params: 792 * hint = the gravity hint value. 793 * Returns: the newly allocated PangoAttribute, which should be freed with pango_attribute_destroy(). [transfer full] 794 */ 795 public static PgAttribute gravityHintNew(PangoGravityHint hint) 796 { 797 // PangoAttribute * pango_attr_gravity_hint_new (PangoGravityHint hint); 798 auto p = pango_attr_gravity_hint_new(hint); 799 800 if(p is null) 801 { 802 return null; 803 } 804 805 return ObjectG.getDObject!(PgAttribute)(cast(PangoAttribute*) p); 806 } 807 }