/usr/include/d/gtkd-3/pango/PgContext.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 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | /*
* 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.PgContext;
private import glib.ConstructionException;
private import glib.ListG;
private import glib.Str;
private import gobject.ObjectG;
public import gtkc.pangotypes;
private import pango.PgAttributeIterator;
private import pango.PgAttributeList;
private import pango.PgFont;
private import pango.PgFontDescription;
private import pango.PgFontFamily;
private import pango.PgFontMap;
private import pango.PgFontMetrics;
private import pango.PgFontset;
private import pango.PgGlyphString;
private import pango.PgItem;
private import pango.PgLanguage;
private import pango.PgMatrix;
private import pango.c.functions;
public import pango.c.types;
/**
* The #PangoContext structure stores global information
* used to control the itemization process.
*/
public class PgContext : ObjectG
{
/** the main Gtk struct */
protected PangoContext* pangoContext;
/** Get the main Gtk struct */
public PangoContext* getPgContextStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return pangoContext;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)pangoContext;
}
protected override void setStruct(GObject* obj)
{
pangoContext = cast(PangoContext*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (PangoContext* pangoContext, bool ownedRef = false)
{
this.pangoContext = pangoContext;
super(cast(GObject*)pangoContext, ownedRef);
}
/** */
public static GType getType()
{
return pango_context_get_type();
}
/**
* Creates a new #PangoContext initialized to default values.
*
* This function is not particularly useful as it should always
* be followed by a pango_context_set_font_map() call, and the
* function pango_font_map_create_context() does these two steps
* together and hence users are recommended to use that.
*
* If you are using Pango as part of a higher-level system,
* that system may have it's own way of create a #PangoContext.
* For instance, the GTK+ toolkit has, among others,
* gdk_pango_context_get_for_screen(), and
* gtk_widget_get_pango_context(). Use those instead.
*
* Returns: the newly allocated #PangoContext, which should
* be freed with g_object_unref().
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = pango_context_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(PangoContext*) p, true);
}
/**
* Forces a change in the context, which will cause any #PangoLayout
* using this context to re-layout.
*
* This function is only useful when implementing a new backend
* for Pango, something applications won't do. Backends should
* call this function if they have attached extra data to the context
* and such data is changed.
*
* Since: 1.32.4
*/
public void changed()
{
pango_context_changed(pangoContext);
}
/**
* Retrieves the base direction for the context. See
* pango_context_set_base_dir().
*
* Returns: the base direction for the context.
*/
public PangoDirection getBaseDir()
{
return pango_context_get_base_dir(pangoContext);
}
/**
* Retrieves the base gravity for the context. See
* pango_context_set_base_gravity().
*
* Returns: the base gravity for the context.
*
* Since: 1.16
*/
public PangoGravity getBaseGravity()
{
return pango_context_get_base_gravity(pangoContext);
}
/**
* Retrieve the default font description for the context.
*
* Returns: a pointer to the context's default font
* description. This value must not be modified or freed.
*/
public PgFontDescription getFontDescription()
{
auto p = pango_context_get_font_description(pangoContext);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
}
/**
* Gets the #PangoFontMap used to look up fonts for this context.
*
* Returns: the font map for the #PangoContext.
* This value is owned by Pango and should not be unreferenced.
*
* Since: 1.6
*/
public PgFontMap getFontMap()
{
auto p = pango_context_get_font_map(pangoContext);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontMap)(cast(PangoFontMap*) p);
}
/**
* Retrieves the gravity for the context. This is similar to
* pango_context_get_base_gravity(), except for when the base gravity
* is %PANGO_GRAVITY_AUTO for which pango_gravity_get_for_matrix() is used
* to return the gravity from the current context matrix.
*
* Returns: the resolved gravity for the context.
*
* Since: 1.16
*/
public PangoGravity getGravity()
{
return pango_context_get_gravity(pangoContext);
}
/**
* Retrieves the gravity hint for the context. See
* pango_context_set_gravity_hint() for details.
*
* Returns: the gravity hint for the context.
*
* Since: 1.16
*/
public PangoGravityHint getGravityHint()
{
return pango_context_get_gravity_hint(pangoContext);
}
/**
* Retrieves the global language tag for the context.
*
* Returns: the global language tag.
*/
public PgLanguage getLanguage()
{
auto p = pango_context_get_language(pangoContext);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p, true);
}
/**
* Gets the transformation matrix that will be applied when
* rendering with this context. See pango_context_set_matrix().
*
* Returns: the matrix, or %NULL if no matrix has
* been set (which is the same as the identity matrix). The returned
* matrix is owned by Pango and must not be modified or freed.
*
* Since: 1.6
*/
public PgMatrix getMatrix()
{
auto p = pango_context_get_matrix(pangoContext);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgMatrix)(cast(PangoMatrix*) p);
}
/**
* Get overall metric information for a particular font
* description. Since the metrics may be substantially different for
* different scripts, a language tag can be provided to indicate that
* the metrics should be retrieved that correspond to the script(s)
* used by that language.
*
* The #PangoFontDescription is interpreted in the same way as
* by pango_itemize(), and the family name may be a comma separated
* list of figures. If characters from multiple of these families
* would be used to render the string, then the returned fonts would
* be a composite of the metrics for the fonts loaded for the
* individual families.
*
* Params:
* desc = a #PangoFontDescription structure. %NULL means that the
* font description from the context will be used.
* language = language tag used to determine which script to get
* the metrics for. %NULL means that the language tag from the context
* will be used. If no language tag is set on the context, metrics
* for the default language (as determined by pango_language_get_default())
* will be returned.
*
* Returns: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
* when finished using the object.
*/
public PgFontMetrics getMetrics(PgFontDescription desc, PgLanguage language)
{
auto p = pango_context_get_metrics(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct(), (language is null) ? null : language.getPgLanguageStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p, true);
}
/**
* Returns the current serial number of @context. The serial number is
* initialized to an small number larger than zero when a new context
* is created and is increased whenever the context is changed using any
* of the setter functions, or the #PangoFontMap it uses to find fonts has
* changed. The serial may wrap, but will never have the value 0. Since it
* can wrap, never compare it with "less than", always use "not equals".
*
* This can be used to automatically detect changes to a #PangoContext, and
* is only useful when implementing objects that need update when their
* #PangoContext changes, like #PangoLayout.
*
* Returns: The current serial number of @context.
*
* Since: 1.32.4
*/
public uint getSerial()
{
return pango_context_get_serial(pangoContext);
}
/**
* List all families for a context.
*
* Params:
* families = location to store a pointer to
* an array of #PangoFontFamily *. This array should be freed
* with g_free().
*/
public void listFamilies(out PgFontFamily[] families)
{
PangoFontFamily** outfamilies = null;
int nFamilies;
pango_context_list_families(pangoContext, &outfamilies, &nFamilies);
families = new PgFontFamily[nFamilies];
for(size_t i = 0; i < nFamilies; i++)
{
families[i] = ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) outfamilies[i]);
}
}
/**
* Loads the font in one of the fontmaps in the context
* that is the closest match for @desc.
*
* Params:
* desc = a #PangoFontDescription describing the font to load
*
* Returns: the newly allocated #PangoFont
* that was loaded, or %NULL if no font matched.
*/
public PgFont loadFont(PgFontDescription desc)
{
auto p = pango_context_load_font(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p, true);
}
/**
* Load a set of fonts in the context that can be used to render
* a font matching @desc.
*
* Params:
* desc = a #PangoFontDescription describing the fonts to load
* language = a #PangoLanguage the fonts will be used for
*
* Returns: the newly allocated
* #PangoFontset loaded, or %NULL if no font matched.
*/
public PgFontset loadFontset(PgFontDescription desc, PgLanguage language)
{
auto p = pango_context_load_fontset(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct(), (language is null) ? null : language.getPgLanguageStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgFontset)(cast(PangoFontset*) p, true);
}
/**
* Sets the base direction for the context.
*
* The base direction is used in applying the Unicode bidirectional
* algorithm; if the @direction is %PANGO_DIRECTION_LTR or
* %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
* direction in the Unicode bidirectional algorithm. A value of
* %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
* for paragraphs that do not contain any strong characters themselves.
*
* Params:
* direction = the new base direction
*/
public void setBaseDir(PangoDirection direction)
{
pango_context_set_base_dir(pangoContext, direction);
}
/**
* Sets the base gravity for the context.
*
* The base gravity is used in laying vertical text out.
*
* Params:
* gravity = the new base gravity
*
* Since: 1.16
*/
public void setBaseGravity(PangoGravity gravity)
{
pango_context_set_base_gravity(pangoContext, gravity);
}
/**
* Set the default font description for the context
*
* Params:
* desc = the new pango font description
*/
public void setFontDescription(PgFontDescription desc)
{
pango_context_set_font_description(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct());
}
/**
* Sets the font map to be searched when fonts are looked-up in this context.
* This is only for internal use by Pango backends, a #PangoContext obtained
* via one of the recommended methods should already have a suitable font map.
*
* Params:
* fontMap = the #PangoFontMap to set.
*/
public void setFontMap(PgFontMap fontMap)
{
pango_context_set_font_map(pangoContext, (fontMap is null) ? null : fontMap.getPgFontMapStruct());
}
/**
* Sets the gravity hint for the context.
*
* The gravity hint is used in laying vertical text out, and is only relevant
* if gravity of the context as returned by pango_context_get_gravity()
* is set %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST.
*
* Params:
* hint = the new gravity hint
*
* Since: 1.16
*/
public void setGravityHint(PangoGravityHint hint)
{
pango_context_set_gravity_hint(pangoContext, hint);
}
/**
* Sets the global language tag for the context. The default language
* for the locale of the running process can be found using
* pango_language_get_default().
*
* Params:
* language = the new language tag.
*/
public void setLanguage(PgLanguage language)
{
pango_context_set_language(pangoContext, (language is null) ? null : language.getPgLanguageStruct());
}
/**
* Sets the transformation matrix that will be applied when rendering
* with this context. Note that reported metrics are in the user space
* coordinates before the application of the matrix, not device-space
* coordinates after the application of the matrix. So, they don't scale
* with the matrix, though they may change slightly for different
* matrices, depending on how the text is fit to the pixel grid.
*
* Params:
* matrix = a #PangoMatrix, or %NULL to unset any existing
* matrix. (No matrix set is the same as setting the identity matrix.)
*
* Since: 1.6
*/
public void setMatrix(PgMatrix matrix)
{
pango_context_set_matrix(pangoContext, (matrix is null) ? null : matrix.getPgMatrixStruct());
}
/**
* Determines the normative bidirectional character type of a
* character, as specified in the Unicode Character Database.
*
* A simplified version of this function is available as
* pango_unichar_direction().
*
* Params:
* ch = a Unicode character
*
* Returns: the bidirectional character type, as used in the
* Unicode bidirectional algorithm.
*
* Since: 1.22
*/
public static PangoBidiType bidiTypeForUnichar(dchar ch)
{
return pango_bidi_type_for_unichar(ch);
}
/**
* Determines possible line, word, and character breaks
* for a string of Unicode text with a single analysis. For most
* purposes you may want to use pango_get_log_attrs().
*
* Params:
* text = the text to process
* length = length of @text in bytes (may be -1 if @text is nul-terminated)
* analysis = #PangoAnalysis structure from pango_itemize()
* attrs = an array to store character
* information in
*/
public static void pangoBreak(string text, int length, PangoAnalysis* analysis, PangoLogAttr[] attrs)
{
pango_break(Str.toStringz(text), length, analysis, attrs.ptr, cast(int)attrs.length);
}
/**
* This is the default break algorithm, used if no language
* engine overrides it. Normally you should use pango_break()
* instead. Unlike pango_break(),
* @analysis can be %NULL, but only do that if you know what
* you're doing. If you need an analysis to pass to pango_break(),
* you need to pango_itemize(). In most cases however you should
* simply use pango_get_log_attrs().
*
* Params:
* text = text to break
* length = length of text in bytes (may be -1 if @text is nul-terminated)
* analysis = a #PangoAnalysis for the @text
* attrs = logical attributes to fill in
* attrsLen = size of the array passed as @attrs
*/
public static void defaultBreak(string text, int length, PangoAnalysis* analysis, PangoLogAttr* attrs, int attrsLen)
{
pango_default_break(Str.toStringz(text), length, analysis, attrs, attrsLen);
}
/**
* Searches a string the first character that has a strong
* direction, according to the Unicode bidirectional algorithm.
*
* Params:
* text = the text to process
* length = length of @text in bytes (may be -1 if @text is nul-terminated)
*
* Returns: The direction corresponding to the first strong character.
* If no such character is found, then %PANGO_DIRECTION_NEUTRAL is returned.
*
* Since: 1.4
*/
public static PangoDirection findBaseDir(string text, int length)
{
return pango_find_base_dir(Str.toStringz(text), length);
}
/**
* Locates a paragraph boundary in @text. A boundary is caused by
* delimiter characters, such as a newline, carriage return, carriage
* return-newline pair, or Unicode paragraph separator character. The
* index of the run of delimiters is returned in
* @paragraph_delimiter_index. The index of the start of the paragraph
* (index after all delimiters) is stored in @next_paragraph_start.
*
* If no delimiters are found, both @paragraph_delimiter_index and
* @next_paragraph_start are filled with the length of @text (an index one
* off the end).
*
* Params:
* text = UTF-8 text
* length = length of @text in bytes, or -1 if nul-terminated
* paragraphDelimiterIndex = return location for index of
* delimiter
* nextParagraphStart = return location for start of next
* paragraph
*/
public static void findParagraphBoundary(string text, int length, out int paragraphDelimiterIndex, out int nextParagraphStart)
{
pango_find_paragraph_boundary(Str.toStringz(text), length, ¶graphDelimiterIndex, &nextParagraphStart);
}
/**
* Computes a #PangoLogAttr for each character in @text. The @log_attrs
* array must have one #PangoLogAttr for each position in @text; if
* @text contains N characters, it has N+1 positions, including the
* last position at the end of the text. @text should be an entire
* paragraph; logical attributes can't be computed without context
* (for example you need to see spaces on either side of a word to know
* the word is a word).
*
* Params:
* text = text to process
* length = length in bytes of @text
* level = embedding level, or -1 if unknown
* language = language tag
* logAttrs = array with one #PangoLogAttr
* per character in @text, plus one extra, to be filled in
*/
public static void getLogAttrs(string text, int length, int level, PgLanguage language, PangoLogAttr[] logAttrs)
{
pango_get_log_attrs(Str.toStringz(text), length, level, (language is null) ? null : language.getPgLanguageStruct(), logAttrs.ptr, cast(int)logAttrs.length);
}
/**
* If @ch has the Unicode mirrored property and there is another Unicode
* character that typically has a glyph that is the mirror image of @ch's
* glyph, puts that character in the address pointed to by @mirrored_ch.
*
* Use g_unichar_get_mirror_char() instead; the docs for that function
* provide full details.
*
* Params:
* ch = a Unicode character
* mirroredCh = location to store the mirrored character
*
* Returns: %TRUE if @ch has a mirrored character and @mirrored_ch is
* filled in, %FALSE otherwise
*/
public static bool getMirrorChar(dchar ch, dchar* mirroredCh)
{
return pango_get_mirror_char(ch, mirroredCh) != 0;
}
/**
* Breaks a piece of text into segments with consistent
* directional level and shaping engine. Each byte of @text will
* be contained in exactly one of the items in the returned list;
* the generated list of items will be in logical order (the start
* offsets of the items are ascending).
*
* @cached_iter should be an iterator over @attrs currently positioned at a
* range before or containing @start_index; @cached_iter will be advanced to
* the range covering the position just after @start_index + @length.
* (i.e. if itemizing in a loop, just keep passing in the same @cached_iter).
*
* Params:
* context = a structure holding information that affects
* the itemization process.
* text = the text to itemize.
* startIndex = first byte in @text to process
* length = the number of bytes (not characters) to process
* after @start_index.
* This must be >= 0.
* attrs = the set of attributes that apply to @text.
* cachedIter = Cached attribute iterator, or %NULL
*
* Returns: a #GList of #PangoItem
* structures. The items should be freed using pango_item_free()
* probably in combination with g_list_foreach(), and the list itself
* using g_list_free().
*/
public static ListG itemize(PgContext context, string text, int startIndex, int length, PgAttributeList attrs, PgAttributeIterator cachedIter)
{
auto p = pango_itemize((context is null) ? null : context.getPgContextStruct(), Str.toStringz(text), startIndex, length, (attrs is null) ? null : attrs.getPgAttributeListStruct(), (cachedIter is null) ? null : cachedIter.getPgAttributeIteratorStruct());
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p, true);
}
/**
* Like pango_itemize(), but the base direction to use when
* computing bidirectional levels (see pango_context_set_base_dir ()),
* is specified explicitly rather than gotten from the #PangoContext.
*
* Params:
* context = a structure holding information that affects
* the itemization process.
* baseDir = base direction to use for bidirectional processing
* text = the text to itemize.
* startIndex = first byte in @text to process
* length = the number of bytes (not characters) to process
* after @start_index. This must be >= 0.
* attrs = the set of attributes that apply to @text.
* cachedIter = Cached attribute iterator, or %NULL
*
* Returns: a #GList of
* #PangoItem structures. The items should be freed using
* pango_item_free() probably in combination with
* g_list_foreach(), and the list itself using g_list_free().
*
* Since: 1.4
*/
public static ListG itemizeWithBaseDir(PgContext context, PangoDirection baseDir, string text, int startIndex, int length, PgAttributeList attrs, PgAttributeIterator cachedIter)
{
auto p = pango_itemize_with_base_dir((context is null) ? null : context.getPgContextStruct(), baseDir, Str.toStringz(text), startIndex, length, (attrs is null) ? null : attrs.getPgAttributeListStruct(), (cachedIter is null) ? null : cachedIter.getPgAttributeIteratorStruct());
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p, true);
}
/**
* From a list of items in logical order and the associated
* directional levels, produce a list in visual order.
* The original list is unmodified.
*
* Params:
* logicalItems = a #GList of #PangoItem in logical order.
*
* Returns: a #GList
* of #PangoItem structures in visual order.
*
* (Please open a bug if you use this function.
* It is not a particularly convenient interface, and the code
* is duplicated elsewhere in Pango for that reason.)
*/
public static ListG reorderItems(ListG logicalItems)
{
auto p = pango_reorder_items((logicalItems is null) ? null : logicalItems.getListGStruct());
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p, true);
}
/**
* Given a segment of text and the corresponding
* #PangoAnalysis structure returned from pango_itemize(),
* convert the characters into glyphs. You may also pass
* in only a substring of the item from pango_itemize().
*
* It is recommended that you use pango_shape_full() instead, since
* that API allows for shaping interaction happening across text item
* boundaries.
*
* Params:
* text = the text to process
* length = the length (in bytes) of @text
* analysis = #PangoAnalysis structure from pango_itemize()
* glyphs = glyph string in which to store results
*/
public static void shape(string text, int length, PangoAnalysis* analysis, PgGlyphString glyphs)
{
pango_shape(Str.toStringz(text), length, analysis, (glyphs is null) ? null : glyphs.getPgGlyphStringStruct());
}
/**
* Given a segment of text and the corresponding
* #PangoAnalysis structure returned from pango_itemize(),
* convert the characters into glyphs. You may also pass
* in only a substring of the item from pango_itemize().
*
* This is similar to pango_shape(), except it also can optionally take
* the full paragraph text as input, which will then be used to perform
* certain cross-item shaping interactions. If you have access to the broader
* text of which @item_text is part of, provide the broader text as
* @paragraph_text. If @paragraph_text is %NULL, item text is used instead.
*
* Params:
* itemText = valid UTF-8 text to shape.
* itemLength = the length (in bytes) of @item_text. -1 means nul-terminated text.
* paragraphText = text of the paragraph (see details). May be %NULL.
* paragraphLength = the length (in bytes) of @paragraph_text. -1 means nul-terminated text.
* analysis = #PangoAnalysis structure from pango_itemize().
* glyphs = glyph string in which to store results.
*
* Since: 1.32
*/
public static void shapeFull(string itemText, int itemLength, string paragraphText, int paragraphLength, PangoAnalysis* analysis, PgGlyphString glyphs)
{
pango_shape_full(Str.toStringz(itemText), itemLength, Str.toStringz(paragraphText), paragraphLength, analysis, (glyphs is null) ? null : glyphs.getPgGlyphStringStruct());
}
/**
* Determines the inherent direction of a character; either
* %PANGO_DIRECTION_LTR, %PANGO_DIRECTION_RTL, or
* %PANGO_DIRECTION_NEUTRAL.
*
* This function is useful to categorize characters into left-to-right
* letters, right-to-left letters, and everything else. If full
* Unicode bidirectional type of a character is needed,
* pango_bidi_type_for_unichar() can be used instead.
*
* Params:
* ch = a Unicode character
*
* Returns: the direction of the character.
*/
public static PangoDirection unicharDirection(dchar ch)
{
return pango_unichar_direction(ch);
}
}
|