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