/usr/include/d/gtkd-3/pango/PgFontDescription.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module pango.PgFontDescription;
private import glib.ConstructionException;
private import glib.Str;
private import gobject.ObjectG;
public import gtkc.pangotypes;
private import gtkd.Loader;
private import pango.c.functions;
public import pango.c.types;
/**
* The #PangoFontDescription structure represents the description
* of an ideal font. These structures are used both to list
* what fonts are available on the system and also for specifying
* the characteristics of a font to load.
*/
public class PgFontDescription
{
/** the main Gtk struct */
protected PangoFontDescription* pangoFontDescription;
protected bool ownedRef;
/** Get the main Gtk struct */
public PangoFontDescription* getPgFontDescriptionStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return pangoFontDescription;
}
/** the main Gtk struct as a void* */
protected void* getStruct()
{
return cast(void*)pangoFontDescription;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (PangoFontDescription* pangoFontDescription, bool ownedRef = false)
{
this.pangoFontDescription = pangoFontDescription;
this.ownedRef = ownedRef;
}
~this ()
{
if ( Linker.isLoaded(LIBRARY_PANGO) && ownedRef )
pango_font_description_free(pangoFontDescription);
}
/**
* Creates a nwe font description and set the family nd the size
* Params:
* family = Family
* size = Size
*/
public this(string family, int size)
{
this();
setFamily(family);
setSize(size * PANGO_SCALE);
}
/**
*/
/** */
public static GType getType()
{
return pango_font_description_get_type();
}
/**
* Creates a new font description structure with all fields unset.
*
* Returns: the newly allocated #PangoFontDescription, which
* should be freed using pango_font_description_free().
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = pango_font_description_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(PangoFontDescription*) p);
}
/**
* Determines if the style attributes of @new_match are a closer match
* for @desc than those of @old_match are, or if @old_match is %NULL,
* determines if @new_match is a match at all.
* Approximate matching is done for
* weight and style; other style attributes must match exactly.
* Style attributes are all attributes other than family and size-related
* attributes. Approximate matching for style considers PANGO_STYLE_OBLIQUE
* and PANGO_STYLE_ITALIC as matches, but not as good a match as when the
* styles are equal.
*
* Note that @old_match must match @desc.
*
* Params:
* oldMatch = a #PangoFontDescription, or %NULL
* newMatch = a #PangoFontDescription
*
* Returns: %TRUE if @new_match is a better match
*/
public bool betterMatch(PgFontDescription oldMatch, PgFontDescription newMatch)
{
return pango_font_description_better_match(pangoFontDescription, (oldMatch is null) ? null : oldMatch.getPgFontDescriptionStruct(), (newMatch is null) ? null : newMatch.getPgFontDescriptionStruct()) != 0;
}
/**
* Make a copy of a #PangoFontDescription.
*
* Returns: the newly allocated
* #PangoFontDescription, which should be freed with
* pango_font_description_free(), or %NULL if @desc was
* %NULL.
*/
public PgFontDescription copy()
{
auto p = pango_font_description_copy(pangoFontDescription);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p, true);
}
/**
* Like pango_font_description_copy(), but only a shallow copy is made
* of the family name and other allocated fields. The result can only
* be used until @desc is modified or freed. This is meant to be used
* when the copy is only needed temporarily.
*
* Returns: the newly allocated
* #PangoFontDescription, which should be freed with
* pango_font_description_free(), or %NULL if @desc was
* %NULL.
*/
public PgFontDescription copyStatic()
{
auto p = pango_font_description_copy_static(pangoFontDescription);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p, true);
}
/**
* Compares two font descriptions for equality. Two font descriptions
* are considered equal if the fonts they describe are provably identical.
* This means that their masks do not have to match, as long as other fields
* are all the same. (Two font descriptions may result in identical fonts
* being loaded, but still compare %FALSE.)
*
* Params:
* desc2 = another #PangoFontDescription
*
* Returns: %TRUE if the two font descriptions are identical,
* %FALSE otherwise.
*/
public bool equal(PgFontDescription desc2)
{
return pango_font_description_equal(pangoFontDescription, (desc2 is null) ? null : desc2.getPgFontDescriptionStruct()) != 0;
}
/**
* Frees a font description.
*/
public void free()
{
pango_font_description_free(pangoFontDescription);
ownedRef = false;
}
/**
* Gets the family name field of a font description. See
* pango_font_description_set_family().
*
* Returns: the family name field for the font
* description, or %NULL if not previously set. This
* has the same life-time as the font description itself
* and should not be freed.
*/
public string getFamily()
{
return Str.toString(pango_font_description_get_family(pangoFontDescription));
}
/**
* Gets the gravity field of a font description. See
* pango_font_description_set_gravity().
*
* Returns: the gravity field for the font description. Use
* pango_font_description_get_set_fields() to find out if
* the field was explicitly set or not.
*
* Since: 1.16
*/
public PangoGravity getGravity()
{
return pango_font_description_get_gravity(pangoFontDescription);
}
/**
* Determines which fields in a font description have been set.
*
* Returns: a bitmask with bits set corresponding to the
* fields in @desc that have been set.
*/
public PangoFontMask getSetFields()
{
return pango_font_description_get_set_fields(pangoFontDescription);
}
/**
* Gets the size field of a font description.
* See pango_font_description_set_size().
*
* Returns: the size field for the font description in points or device units.
* You must call pango_font_description_get_size_is_absolute()
* to find out which is the case. Returns 0 if the size field has not
* previously been set or it has been set to 0 explicitly.
* Use pango_font_description_get_set_fields() to
* find out if the field was explicitly set or not.
*/
public int getSize()
{
return pango_font_description_get_size(pangoFontDescription);
}
/**
* Determines whether the size of the font is in points (not absolute) or device units (absolute).
* See pango_font_description_set_size() and pango_font_description_set_absolute_size().
*
* Returns: whether the size for the font description is in
* points or device units. Use pango_font_description_get_set_fields() to
* find out if the size field of the font description was explicitly set or not.
*
* Since: 1.8
*/
public bool getSizeIsAbsolute()
{
return pango_font_description_get_size_is_absolute(pangoFontDescription) != 0;
}
/**
* Gets the stretch field of a font description.
* See pango_font_description_set_stretch().
*
* Returns: the stretch field for the font description. Use
* pango_font_description_get_set_fields() to find out if
* the field was explicitly set or not.
*/
public PangoStretch getStretch()
{
return pango_font_description_get_stretch(pangoFontDescription);
}
/**
* Gets the style field of a #PangoFontDescription. See
* pango_font_description_set_style().
*
* Returns: the style field for the font description.
* Use pango_font_description_get_set_fields() to find out if
* the field was explicitly set or not.
*/
public PangoStyle getStyle()
{
return pango_font_description_get_style(pangoFontDescription);
}
/**
* Gets the variant field of a #PangoFontDescription. See
* pango_font_description_set_variant().
*
* Returns: the variant field for the font description. Use
* pango_font_description_get_set_fields() to find out if
* the field was explicitly set or not.
*/
public PangoVariant getVariant()
{
return pango_font_description_get_variant(pangoFontDescription);
}
/**
* Gets the weight field of a font description. See
* pango_font_description_set_weight().
*
* Returns: the weight field for the font description. Use
* pango_font_description_get_set_fields() to find out if
* the field was explicitly set or not.
*/
public PangoWeight getWeight()
{
return pango_font_description_get_weight(pangoFontDescription);
}
/**
* Computes a hash of a #PangoFontDescription structure suitable
* to be used, for example, as an argument to g_hash_table_new().
* The hash value is independent of @desc->mask.
*
* Returns: the hash value.
*/
public uint hash()
{
return pango_font_description_hash(pangoFontDescription);
}
/**
* Merges the fields that are set in @desc_to_merge into the fields in
* @desc. If @replace_existing is %FALSE, only fields in @desc that
* are not already set are affected. If %TRUE, then fields that are
* already set will be replaced as well.
*
* If @desc_to_merge is %NULL, this function performs nothing.
*
* Params:
* descToMerge = the #PangoFontDescription to merge from, or %NULL
* replaceExisting = if %TRUE, replace fields in @desc with the
* corresponding values from @desc_to_merge, even if they
* are already exist.
*/
public void merge(PgFontDescription descToMerge, bool replaceExisting)
{
pango_font_description_merge(pangoFontDescription, (descToMerge is null) ? null : descToMerge.getPgFontDescriptionStruct(), replaceExisting);
}
/**
* Like pango_font_description_merge(), but only a shallow copy is made
* of the family name and other allocated fields. @desc can only be
* used until @desc_to_merge is modified or freed. This is meant
* to be used when the merged font description is only needed temporarily.
*
* Params:
* descToMerge = the #PangoFontDescription to merge from
* replaceExisting = if %TRUE, replace fields in @desc with the
* corresponding values from @desc_to_merge, even if they
* are already exist.
*/
public void mergeStatic(PgFontDescription descToMerge, bool replaceExisting)
{
pango_font_description_merge_static(pangoFontDescription, (descToMerge is null) ? null : descToMerge.getPgFontDescriptionStruct(), replaceExisting);
}
/**
* Sets the size field of a font description, in device units. This is mutually
* exclusive with pango_font_description_set_size() which sets the font size
* in points.
*
* Params:
* size = the new size, in Pango units. There are %PANGO_SCALE Pango units in one
* device unit. For an output backend where a device unit is a pixel, a @size
* value of 10 * PANGO_SCALE gives a 10 pixel font.
*
* Since: 1.8
*/
public void setAbsoluteSize(double size)
{
pango_font_description_set_absolute_size(pangoFontDescription, size);
}
/**
* Sets the family name field of a font description. The family
* name represents a family of related font styles, and will
* resolve to a particular #PangoFontFamily. In some uses of
* #PangoFontDescription, it is also possible to use a comma
* separated list of family names for this field.
*
* Params:
* family = a string representing the family name.
*/
public void setFamily(string family)
{
pango_font_description_set_family(pangoFontDescription, Str.toStringz(family));
}
/**
* Like pango_font_description_set_family(), except that no
* copy of @family is made. The caller must make sure that the
* string passed in stays around until @desc has been freed
* or the name is set again. This function can be used if
* @family is a static string such as a C string literal, or
* if @desc is only needed temporarily.
*
* Params:
* family = a string representing the family name.
*/
public void setFamilyStatic(string family)
{
pango_font_description_set_family_static(pangoFontDescription, Str.toStringz(family));
}
/**
* Sets the gravity field of a font description. The gravity field
* specifies how the glyphs should be rotated. If @gravity is
* %PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on
* the font description.
*
* This function is seldom useful to the user. Gravity should normally
* be set on a #PangoContext.
*
* Params:
* gravity = the gravity for the font description.
*
* Since: 1.16
*/
public void setGravity(PangoGravity gravity)
{
pango_font_description_set_gravity(pangoFontDescription, gravity);
}
/**
* Sets the size field of a font description in fractional points. This is mutually
* exclusive with pango_font_description_set_absolute_size().
*
* Params:
* size = the size of the font in points, scaled by PANGO_SCALE. (That is,
* a @size value of 10 * PANGO_SCALE is a 10 point font. The conversion
* factor between points and device units depends on system configuration
* and the output device. For screen display, a logical DPI of 96 is
* common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3
* pixel font. Use pango_font_description_set_absolute_size() if you need
* a particular size in device units.
*/
public void setSize(int size)
{
pango_font_description_set_size(pangoFontDescription, size);
}
/**
* Sets the stretch field of a font description. The stretch field
* specifies how narrow or wide the font should be.
*
* Params:
* stretch = the stretch for the font description
*/
public void setStretch(PangoStretch stretch)
{
pango_font_description_set_stretch(pangoFontDescription, stretch);
}
/**
* Sets the style field of a #PangoFontDescription. The
* #PangoStyle enumeration describes whether the font is slanted and
* the manner in which it is slanted; it can be either
* #PANGO_STYLE_NORMAL, #PANGO_STYLE_ITALIC, or #PANGO_STYLE_OBLIQUE.
* Most fonts will either have a italic style or an oblique
* style, but not both, and font matching in Pango will
* match italic specifications with oblique fonts and vice-versa
* if an exact match is not found.
*
* Params:
* style = the style for the font description
*/
public void setStyle(PangoStyle style)
{
pango_font_description_set_style(pangoFontDescription, style);
}
/**
* Sets the variant field of a font description. The #PangoVariant
* can either be %PANGO_VARIANT_NORMAL or %PANGO_VARIANT_SMALL_CAPS.
*
* Params:
* variant = the variant type for the font description.
*/
public void setVariant(PangoVariant variant)
{
pango_font_description_set_variant(pangoFontDescription, variant);
}
/**
* Sets the weight field of a font description. The weight field
* specifies how bold or light the font should be. In addition
* to the values of the #PangoWeight enumeration, other intermediate
* numeric values are possible.
*
* Params:
* weight = the weight for the font description.
*/
public void setWeight(PangoWeight weight)
{
pango_font_description_set_weight(pangoFontDescription, weight);
}
/**
* Creates a filename representation of a font description. The
* filename is identical to the result from calling
* pango_font_description_to_string(), but with underscores instead of
* characters that are untypical in filenames, and in lower case only.
*
* Returns: a new string that must be freed with g_free().
*/
public string toFilename()
{
auto retStr = pango_font_description_to_filename(pangoFontDescription);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Creates a string representation of a font description. See
* pango_font_description_from_string() for a description of the
* format of the string representation. The family list in the
* string description will only have a terminating comma if the
* last word of the list is a valid style option.
*
* Returns: a new string that must be freed with g_free().
*/
public override string toString()
{
auto retStr = pango_font_description_to_string(pangoFontDescription);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Unsets some of the fields in a #PangoFontDescription. The unset
* fields will get back to their default values.
*
* Params:
* toUnset = bitmask of fields in the @desc to unset.
*/
public void unsetFields(PangoFontMask toUnset)
{
pango_font_description_unset_fields(pangoFontDescription, toUnset);
}
/**
* Creates a new font description from a string representation in the
* form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
* comma separated list of families optionally terminated by a comma,
* STYLE_OPTIONS is a whitespace separated list of words where each word
* describes one of style, variant, weight, stretch, or gravity, and SIZE
* is a decimal number (size in points) or optionally followed by the
* unit modifier "px" for absolute size. Any one of the options may
* be absent. If FAMILY-LIST is absent, then the family_name field of
* the resulting font description will be initialized to %NULL. If
* STYLE-OPTIONS is missing, then all style options will be set to the
* default values. If SIZE is missing, the size in the resulting font
* description will be set to 0.
*
* Params:
* str = string representation of a font description.
*
* Returns: a new #PangoFontDescription.
*/
public static PgFontDescription fromString(string str)
{
auto p = pango_font_description_from_string(Str.toStringz(str));
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p, true);
}
}
|