Class Pango
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Whether the segment should be shifted to center around the baseline.static final int
Whether this run holds ellipsized text.static final int
Whether to add a hyphen at the end of the run during shaping.static final int
Value forstartIndex
inPangoAttribute
that indicates the beginning of the text.static final int
Value forendIndex
inPangoAttribute
that indicates the end of the text.static final Glyph
APangoGlyph
value that indicates a zero-width empty glpyh.static final Glyph
APangoGlyph
value for invalid input.static final Glyph
Flag used inPangoGlyph
to turn agunichar
value of a valid Unicode character into an unknown-character glyph for thatgunichar
.static final int
The scale between dimensions used for Pango distances and device units.static final int
The major component of the version of Pango available at compile-time.static final int
The micro component of the version of Pango available at compile-time.static final int
The minor component of the version of Pango available at compile-time.static final String
A string literal containing the version of Pango available at compile-time. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Attribute
attrAllowBreaksNew
(boolean allowBreaks) Create a new allow-breaks attribute.static Attribute
attrBackgroundAlphaNew
(short alpha) Create a new background alpha attribute.static Attribute
attrBackgroundNew
(short red, short green, short blue) Create a new background color attribute.static Attribute
attrBaselineShiftNew
(int shift) Create a new baseline displacement attribute.static void
Apply customization from attributes to the breaks inattrs
.static Attribute
attrFallbackNew
(boolean enableFallback) Create a new font fallback attribute.static Attribute
attrFamilyNew
(String family) Create a new font family attribute.static Attribute
attrFontScaleNew
(FontScale scale) Create a new font scale attribute.static Attribute
attrForegroundAlphaNew
(short alpha) Create a new foreground alpha attribute.static Attribute
attrForegroundNew
(short red, short green, short blue) Create a new foreground color attribute.static Attribute
Create a new gravity hint attribute.static Attribute
attrGravityNew
(Gravity gravity) Create a new gravity attribute.static Attribute
attrInsertHyphensNew
(boolean insertHyphens) Create a new insert-hyphens attribute.static Attribute
attrLetterSpacingNew
(int letterSpacing) Create a new letter-spacing attribute.static Attribute
attrLineHeightNew
(double factor) Modify the height of logical line extents by a factor.static Attribute
attrLineHeightNewAbsolute
(int height) Override the height of logical line extents to beheight
.static Attribute
attrOverlineColorNew
(short red, short green, short blue) Create a new overline color attribute.static Attribute
attrOverlineNew
(Overline overline) Create a new overline-style attribute.static Attribute
attrRiseNew
(int rise) Create a new baseline displacement attribute.static Attribute
attrScaleNew
(double scaleFactor) Create a new font size scale attribute.static Attribute
Marks the range of the attribute as a single sentence.static Attribute
attrShowNew
(Set<ShowFlags> flags) Create a new attribute that influences how invisible characters are rendered.static Attribute
attrShowNew
(ShowFlags... flags) Create a new attribute that influences how invisible characters are rendered.static Attribute
attrStretchNew
(Stretch stretch) Create a new font stretch attribute.static Attribute
attrStrikethroughColorNew
(short red, short green, short blue) Create a new strikethrough color attribute.static Attribute
attrStrikethroughNew
(boolean strikethrough) Create a new strike-through attribute.static Attribute
attrStyleNew
(Style style) Create a new font slant style attribute.static Attribute
attrTextTransformNew
(TextTransform transform) Create a new attribute that influences how characters are transformed during shaping.static Attribute
attrUnderlineColorNew
(short red, short green, short blue) Create a new underline color attribute.static Attribute
attrUnderlineNew
(Underline underline) Create a new underline-style attribute.static Attribute
attrVariantNew
(Variant variant) Create a new font variant attribute (normal or small caps).static Attribute
attrWeightNew
(Weight weight) Create a new font weight attribute.static Attribute
Marks the range of the attribute as a single word.static void
Deprecated.static void
defaultBreak
(String text, int length, @Nullable Analysis analysis, LogAttr attrs, int attrsLen) This is the default break algorithm.static void
extentsToPixels
(@Nullable Rectangle inclusive, @Nullable Rectangle nearest) Converts extents from Pango units to device units.static Direction
findBaseDir
(String text, int length) Searches a string the first character that has a strong direction, according to the Unicode bidirectional algorithm.static void
findParagraphBoundary
(String text, int length, Out<Integer> paragraphDelimiterIndex, Out<Integer> nextParagraphStart) Locates a paragraph boundary intext
.static void
getLogAttrs
(String text, int length, int level, Language language, LogAttr[] attrs) Computes aPangoLogAttr
for each character intext
.static boolean
getMirrorChar
(int ch, MemorySegment mirroredCh) Deprecated.UseGLib.unicharGetMirrorChar(int, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
instead; the docs for that function provide full details.static boolean
isZeroWidth
(int ch) Checks if a character that should not be normally rendered.itemize
(Context context, String text, int startIndex, int length, AttrList attrs, @Nullable AttrIterator cachedIter) Breaks a piece of text into segments with consistent directional level and font.itemizeWithBaseDir
(Context context, Direction baseDir, String text, int startIndex, int length, AttrList attrs, @Nullable AttrIterator cachedIter) Likepango_itemize()
, but with an explicitly specified base direction.static void
static MemorySegment
log2visGetEmbeddingLevels
(String text, int length, MemorySegment pbaseDir) Return the bidirectional embedding levels of the input paragraph.static boolean
markupParserFinish
(MarkupParseContext context, @Nullable Out<AttrList> attrList, @Nullable Out<String> text, @Nullable Out<Integer> accelChar) Finishes parsing markup.static MarkupParseContext
markupParserNew
(int accelMarker) Incrementally parses marked-up text to create a plain-text string and an attribute list.static boolean
parseEnum
(Type type, @Nullable String str, @Nullable Out<Integer> value, boolean warn, @Nullable Out<String> possibleValues) Deprecated.static boolean
parseMarkup
(String markupText, int length, int accelMarker, @Nullable Out<AttrList> attrList, @Nullable Out<String> text, @Nullable Out<Integer> accelChar) Parses marked-up text to create a plain-text string and an attribute list.static boolean
parseStretch
(String str, Out<Stretch> stretch, boolean warn) Parses a font stretch.static boolean
parseStyle
(String str, Out<Style> style, boolean warn) Parses a font style.static boolean
parseVariant
(String str, Out<Variant> variant, boolean warn) Parses a font variant.static boolean
parseWeight
(String str, Out<Weight> weight, boolean warn) Parses a font weight.static void
quantizeLineGeometry
(Out<Integer> thickness, Out<Integer> position) Quantizes the thickness and position of a line to whole device pixels.static int
readLine
(@Nullable MemorySegment stream, GString str) Deprecated.reorderItems
(List<Item> items) Reorder items from logical order to visual order.static boolean
Deprecated.static boolean
scanString
(Out<String> pos, GString out) Deprecated.static boolean
Deprecated.static void
shape
(String text, int length, Analysis analysis, GlyphString glyphs) Convert the characters intext
into glyphs.static void
shapeFull
(String itemText, int itemLength, @Nullable String paragraphText, int paragraphLength, Analysis analysis, GlyphString glyphs) Convert the characters intext
into glyphs.static void
shapeItem
(Item item, @Nullable String paragraphText, int paragraphLength, @Nullable LogAttr logAttrs, GlyphString glyphs, Set<ShapeFlags> flags) Convert the characters initem
into glyphs.static void
shapeItem
(Item item, @Nullable String paragraphText, int paragraphLength, @Nullable LogAttr logAttrs, GlyphString glyphs, ShapeFlags... flags) Convert the characters initem
into glyphs.static void
shapeWithFlags
(String itemText, int itemLength, @Nullable String paragraphText, int paragraphLength, Analysis analysis, GlyphString glyphs, Set<ShapeFlags> flags) Convert the characters intext
into glyphs.static void
shapeWithFlags
(String itemText, int itemLength, @Nullable String paragraphText, int paragraphLength, Analysis analysis, GlyphString glyphs, ShapeFlags... flags) Convert the characters intext
into glyphs.static boolean
Deprecated.static String[]
splitFileList
(String str) Deprecated.static void
tailorBreak
(String text, int length, Analysis analysis, int offset, LogAttr[] attrs) Apply language-specific tailoring to the breaks inattrs
.static String
trimString
(String str) Deprecated.static Direction
unicharDirection
(int ch) Determines the inherent direction of a character.static int
unitsFromDouble
(double d) Converts a floating-point number to Pango units.static double
unitsToDouble
(int i) Converts a number in Pango units to floating-point.static int
version()
Returns the encoded version of Pango available at run-time.static String
versionCheck
(int requiredMajor, int requiredMinor, int requiredMicro) Checks that the Pango library in use is compatible with the given version.static String
Returns the version of Pango available at run-time.
-
Field Details
-
ANALYSIS_FLAG_CENTERED_BASELINE
public static final int ANALYSIS_FLAG_CENTERED_BASELINEWhether the segment should be shifted to center around the baseline.This is mainly used in vertical writing directions.
- See Also:
-
ANALYSIS_FLAG_IS_ELLIPSIS
public static final int ANALYSIS_FLAG_IS_ELLIPSISWhether this run holds ellipsized text.- See Also:
-
ANALYSIS_FLAG_NEED_HYPHEN
public static final int ANALYSIS_FLAG_NEED_HYPHENWhether to add a hyphen at the end of the run during shaping.- See Also:
-
ATTR_INDEX_FROM_TEXT_BEGINNING
public static final int ATTR_INDEX_FROM_TEXT_BEGINNINGValue forstartIndex
inPangoAttribute
that indicates the beginning of the text.- See Also:
-
ATTR_INDEX_TO_TEXT_END
public static final int ATTR_INDEX_TO_TEXT_ENDValue forendIndex
inPangoAttribute
that indicates the end of the text.- See Also:
-
GLYPH_EMPTY
APangoGlyph
value that indicates a zero-width empty glpyh.This is useful for example in shaper modules, to use as the glyph for various zero-width Unicode characters (those passing
isZeroWidth(int)
). -
GLYPH_INVALID_INPUT
APangoGlyph
value for invalid input.PangoLayout
produces one such glyph per invalid input UTF-8 byte and such a glyph is rendered as a crossed box.Note that this value is defined such that it has the
PANGO_GLYPH_UNKNOWN_FLAG
set. -
GLYPH_UNKNOWN_FLAG
Flag used inPangoGlyph
to turn agunichar
value of a valid Unicode character into an unknown-character glyph for thatgunichar
.Such unknown-character glyphs may be rendered as a 'hex box'.
-
SCALE
public static final int SCALEThe scale between dimensions used for Pango distances and device units.The definition of device units is dependent on the output device; it will typically be pixels for a screen, and points for a printer.
PANGO_SCALE
is currently 1024, but this may be changed in the future.When setting font sizes, device units are always considered to be points (as in "12 point font"), rather than pixels.
- See Also:
-
VERSION_MAJOR
public static final int VERSION_MAJORThe major component of the version of Pango available at compile-time.- See Also:
-
VERSION_MICRO
public static final int VERSION_MICROThe micro component of the version of Pango available at compile-time.- See Also:
-
VERSION_MINOR
public static final int VERSION_MINORThe minor component of the version of Pango available at compile-time.- See Also:
-
VERSION_STRING
A string literal containing the version of Pango available at compile-time.- See Also:
-
-
Constructor Details
-
Pango
public Pango()
-
-
Method Details
-
javagi$ensureInitialized
public static void javagi$ensureInitialized() -
attrAllowBreaksNew
Create a new allow-breaks attribute.If breaks are disabled, the range will be kept in a single run, as far as possible.
- Parameters:
allowBreaks
-true
if we line breaks are allowed- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrBackgroundAlphaNew
Create a new background alpha attribute.- Parameters:
alpha
- the alpha value, between 1 and 65536- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrBackgroundNew
Create a new background color attribute.- Parameters:
red
- the red value (ranging from 0 to 65535)green
- the green valueblue
- the blue value- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrBaselineShiftNew
Create a new baseline displacement attribute.The effect of this attribute is to shift the baseline of a run, relative to the run of preceding run.
<picture> <source srcset="baseline-shift-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Baseline Shift" src="baseline-shift-light.png"> </picture>
- Parameters:
shift
- either aPangoBaselineShift
enumeration value or an absolute value (> 1024) in Pango units, relative to the baseline of the previous run. Positive values displace the text upwards.- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrBreak
public static void attrBreak(String text, int length, AttrList attrList, int offset, LogAttr[] attrs) Apply customization from attributes to the breaks inattrs
.The line breaks are assumed to have been produced by
defaultBreak(java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.LogAttr, int)
andtailorBreak(java.lang.String, int, org.gnome.pango.Analysis, int, org.gnome.pango.LogAttr[])
.- Parameters:
text
- text to break. Must be valid UTF-8length
- length of text in bytes (may be -1 iftext
is nul-terminated)attrList
-PangoAttrList
to applyoffset
- Byte offset oftext
from the beginning of the paragraphattrs
- array with onePangoLogAttr
per character intext
, plus one extra, to be filled in
-
attrFallbackNew
Create a new font fallback attribute.If fallback is disabled, characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text.
- Parameters:
enableFallback
-true
if we should fall back on other fonts for characters the active font is missing- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrFamilyNew
Create a new font family attribute.- Parameters:
family
- the family or comma-separated list of families- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrFontScaleNew
Create a new font scale attribute.The effect of this attribute is to change the font size of a run, relative to the size of preceding run.
- Parameters:
scale
- aPangoFontScale
value, which indicates font size change relative to the size of the previous run.- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrForegroundAlphaNew
Create a new foreground alpha attribute.- Parameters:
alpha
- the alpha value, between 1 and 65536- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrForegroundNew
Create a new foreground color attribute.- Parameters:
red
- the red value (ranging from 0 to 65535)green
- the green valueblue
- the blue value- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrGravityHintNew
Create a new gravity hint attribute.- Parameters:
hint
- the gravity hint value- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrGravityNew
Create a new gravity attribute.- Parameters:
gravity
- the gravity value; should not beGravity.AUTO
- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrInsertHyphensNew
Create a new insert-hyphens attribute.Pango will insert hyphens when breaking lines in the middle of a word. This attribute can be used to suppress the hyphen.
- Parameters:
insertHyphens
-true
if hyphens should be inserted- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrLetterSpacingNew
Create a new letter-spacing attribute.- Parameters:
letterSpacing
- amount of extra space to add between graphemes of the text, in Pango units- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrLineHeightNew
Modify the height of logical line extents by a factor.This affects the values returned by
LayoutLine.getExtents(org.gnome.pango.Rectangle, org.gnome.pango.Rectangle)
,LayoutLine.getPixelExtents(org.gnome.pango.Rectangle, org.gnome.pango.Rectangle)
andLayoutIter.getLineExtents(org.gnome.pango.Rectangle, org.gnome.pango.Rectangle)
.- Parameters:
factor
- the scaling factor to apply to the logical height
-
attrLineHeightNewAbsolute
Override the height of logical line extents to beheight
.This affects the values returned by
LayoutLine.getExtents(org.gnome.pango.Rectangle, org.gnome.pango.Rectangle)
,LayoutLine.getPixelExtents(org.gnome.pango.Rectangle, org.gnome.pango.Rectangle)
andLayoutIter.getLineExtents(org.gnome.pango.Rectangle, org.gnome.pango.Rectangle)
.- Parameters:
height
- the line height, inPANGO_SCALE
-ths of a point
-
attrOverlineColorNew
Create a new overline color attribute.This attribute modifies the color of overlines. If not set, overlines will use the foreground color.
- Parameters:
red
- the red value (ranging from 0 to 65535)green
- the green valueblue
- the blue value- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrOverlineNew
Create a new overline-style attribute.- Parameters:
overline
- the overline style- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrRiseNew
Create a new baseline displacement attribute.- Parameters:
rise
- the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrScaleNew
Create a new font size scale attribute.The base font for the affected text will have its size multiplied by
scaleFactor
.- Parameters:
scaleFactor
- factor to scale the font- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrSentenceNew
Marks the range of the attribute as a single sentence.Note that this may require adjustments to word and sentence classification around the range.
- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrShowNew
Create a new attribute that influences how invisible characters are rendered.- Parameters:
flags
-PangoShowFlags
to apply- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrShowNew
Create a new attribute that influences how invisible characters are rendered.- Parameters:
flags
-PangoShowFlags
to apply- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrStretchNew
Create a new font stretch attribute.- Parameters:
stretch
- the stretch- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrStrikethroughColorNew
Create a new strikethrough color attribute.This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color.
- Parameters:
red
- the red value (ranging from 0 to 65535)green
- the green valueblue
- the blue value- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrStrikethroughNew
Create a new strike-through attribute.- Parameters:
strikethrough
-true
if the text should be struck-through- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrStyleNew
Create a new font slant style attribute.- Parameters:
style
- the slant style- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrTextTransformNew
Create a new attribute that influences how characters are transformed during shaping.- Parameters:
transform
-PangoTextTransform
to apply- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrUnderlineColorNew
Create a new underline color attribute.This attribute modifies the color of underlines. If not set, underlines will use the foreground color.
- Parameters:
red
- the red value (ranging from 0 to 65535)green
- the green valueblue
- the blue value- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrUnderlineNew
Create a new underline-style attribute.- Parameters:
underline
- the underline style- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrVariantNew
Create a new font variant attribute (normal or small caps).- Parameters:
variant
- the variant- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
.
-
attrWeightNew
Create a new font weight attribute.- Parameters:
weight
- the weight- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
attrWordNew
Marks the range of the attribute as a single word.Note that this may require adjustments to word and sentence classification around the range.
- Returns:
- the newly allocated
PangoAttribute
, which should be freed withAttribute.destroy()
-
break_
Deprecated.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
getLogAttrs(java.lang.String, int, int, org.gnome.pango.Language, org.gnome.pango.LogAttr[])
.- Parameters:
text
- the text to process. Must be valid UTF-8length
- length oftext
in bytes (may be -1 iftext
is nul-terminated)analysis
-PangoAnalysis
structure fortext
attrs
- an array to store character information in
-
defaultBreak
public static void defaultBreak(String text, int length, @Nullable @Nullable Analysis analysis, LogAttr attrs, int attrsLen) This is the default break algorithm.It applies rules from the Unicode Line Breaking Algorithm without language-specific tailoring, therefore the
analyis
argument is unused and can benull
.See
tailorBreak(java.lang.String, int, org.gnome.pango.Analysis, int, org.gnome.pango.LogAttr[])
for language-specific breaks.See
attrBreak(java.lang.String, int, org.gnome.pango.AttrList, int, org.gnome.pango.LogAttr[])
for attribute-based customization.- Parameters:
text
- text to break. Must be valid UTF-8length
- length of text in bytes (may be -1 iftext
is nul-terminated)analysis
- aPangoAnalysis
structure for thetext
attrs
- logical attributes to fill inattrsLen
- size of the array passed asattrs
-
extentsToPixels
public static void extentsToPixels(@Nullable @Nullable Rectangle inclusive, @Nullable @Nullable Rectangle nearest) Converts extents from Pango units to device units.The conversion is done by dividing by the
PANGO_SCALE
factor and performing rounding.The
inclusive
rectangle is converted by flooring the x/y coordinates and extending width/height, such that the final rectangle completely includes the original rectangle.The
nearest
rectangle is converted by rounding the coordinates of the rectangle to the nearest device unit (pixel).The rule to which argument to use is: if you want the resulting device-space rectangle to completely contain the original rectangle, pass it in as
inclusive
. If you want two touching-but-not-overlapping rectangles stay touching-but-not-overlapping after rounding to device units, pass them in asnearest
.- Parameters:
inclusive
- rectangle to round to pixels inclusivelynearest
- rectangle to round to nearest pixels
-
findBaseDir
Searches a string the first character that has a strong direction, according to the Unicode bidirectional algorithm.- Parameters:
text
- the text to process. Must be valid UTF-8length
- length oftext
in bytes (may be -1 iftext
is nul-terminated)- Returns:
- The direction corresponding to the first strong character.
If no such character is found, then
Direction.NEUTRAL
is returned.
-
findParagraphBoundary
public static void findParagraphBoundary(String text, int length, Out<Integer> paragraphDelimiterIndex, Out<Integer> nextParagraphStart) Locates a paragraph boundary intext
.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
paragraphDelimiterIndex
. The index of the start of the next paragraph (index after all delimiters) is stored nnextParagraphStart
.If no delimiters are found, both
paragraphDelimiterIndex
andnextParagraphStart
are filled with the length oftext
(an index one off the end).- Parameters:
text
- UTF-8 textlength
- length oftext
in bytes, or -1 if nul-terminatedparagraphDelimiterIndex
- return location for index of delimiternextParagraphStart
- return location for start of next paragraph
-
getLogAttrs
public static void getLogAttrs(String text, int length, int level, Language language, LogAttr[] attrs) Computes aPangoLogAttr
for each character intext
.The
attrs
array must have onePangoLogAttr
for each position intext
; iftext
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).- Parameters:
text
- text to process. Must be valid UTF-8length
- length in bytes oftext
level
- embedding level, or -1 if unknownlanguage
- language tagattrs
- array with onePangoLogAttr
per character intext
, plus one extra, to be filled in
-
getMirrorChar
Deprecated.UseGLib.unicharGetMirrorChar(int, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
instead; the docs for that function provide full details.Returns the mirrored character of a Unicode character.Mirror characters are determined by the Unicode mirrored property.
- Parameters:
ch
- a Unicode charactermirroredCh
- location to store the mirrored character- Returns:
true
ifch
has a mirrored character andmirroredCh
is filled in,false
otherwise
-
isZeroWidth
public static boolean isZeroWidth(int ch) Checks if a character that should not be normally rendered.This includes all Unicode characters with "ZERO WIDTH" in their name, as well as bidi formatting characters, and a few other ones.
This is totally different from
GLib.unicharIszerowidth(int)
and is at best misnamed.- Parameters:
ch
- a Unicode character- Returns:
true
ifch
is a zero-width character,false
otherwise
-
itemize
public static List<Item> itemize(Context context, String text, int startIndex, int length, AttrList attrs, @Nullable @Nullable AttrIterator cachedIter) Breaks a piece of text into segments with consistent directional level and font.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).cachedIter
should be an iterator overattrs
currently positioned at a range before or containingstartIndex
;cachedIter
will be advanced to the range covering the position just afterstartIndex
+length
. (i.e. if itemizing in a loop, just keep passing in the samecachedIter
).- Parameters:
context
- a structure holding information that affects the itemization process.text
- the text to itemize. Must be valid UTF-8startIndex
- first byte intext
to processlength
- the number of bytes (not characters) to process afterstartIndex
. This must be >= 0.attrs
- the set of attributes that apply totext
.cachedIter
- Cached attribute iterator- Returns:
- a
GList
ofPango.Item
structures. The items should be freed usingItem.free()
in combination withinvalid reference
org.gnome.glib.List#freeFull
-
itemizeWithBaseDir
public static List<Item> itemizeWithBaseDir(Context context, Direction baseDir, String text, int startIndex, int length, AttrList attrs, @Nullable @Nullable AttrIterator cachedIter) Likepango_itemize()
, but with an explicitly specified base direction.The base direction is used when computing bidirectional levels.
itemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
gets the base direction from thePangoContext
(seeContext.setBaseDir(org.gnome.pango.Direction)
).- Parameters:
context
- a structure holding information that affects the itemization process.baseDir
- base direction to use for bidirectional processingtext
- the text to itemize.startIndex
- first byte intext
to processlength
- the number of bytes (not characters) to process afterstartIndex
. This must be >= 0.attrs
- the set of attributes that apply totext
.cachedIter
- Cached attribute iterator- Returns:
- a
GList
ofPango.Item
structures. The items should be freed usingItem.free()
probably in combination withinvalid reference
org.gnome.glib.List#freeFull
-
log2visGetEmbeddingLevels
public static MemorySegment log2visGetEmbeddingLevels(String text, int length, MemorySegment pbaseDir) Return the bidirectional embedding levels of the input paragraph.The bidirectional embedding levels are defined by the [Unicode Bidirectional Algorithm](http://www.unicode.org/reports/tr9/).
If the input base direction is a weak direction, the direction of the characters in the text will determine the final resolved direction.
- Parameters:
text
- the text to itemize.length
- the number of bytes (not characters) to process, or -1 iftext
is nul-terminated and the length should be calculated.pbaseDir
- input base direction, and output resolved direction.- Returns:
- a newly allocated array of embedding levels, one item per
character (not byte), that should be freed using
GLib.free(java.lang.foreign.MemorySegment)
.
-
markupParserFinish
public static boolean markupParserFinish(MarkupParseContext context, @Nullable @Nullable Out<AttrList> attrList, @Nullable @Nullable Out<String> text, @Nullable @Nullable Out<Integer> accelChar) throws GErrorException Finishes parsing markup.After feeding a Pango markup parser some data with
MarkupParseContext.parse(java.lang.String, long)
, use this function to get the list of attributes and text out of the markup. This function will not freecontext
, useMarkupParseContext.free()
to do so.- Parameters:
context
- A valid parse context that was returned frommarkupParserNew(int)
attrList
- address of return location for aPangoAttrList
text
- address of return location for text with tags strippedaccelChar
- address of return location for accelerator char- Returns:
false
iferror
is set, otherwisetrue
- Throws:
GErrorException
- seeGError
-
markupParserNew
Incrementally parses marked-up text to create a plain-text string and an attribute list.See the Pango Markup docs for details about the supported markup.
If
accelMarker
is nonzero, the given character will mark the character following it as an accelerator. For example,accelMarker
might be an ampersand or underscore. All characters marked as an accelerator will receive aUnderline.LOW
attribute, and the first character so marked will be returned inaccelChar
, when callingmarkupParserFinish(org.gnome.glib.MarkupParseContext, io.github.jwharm.javagi.base.Out<org.gnome.pango.AttrList>, io.github.jwharm.javagi.base.Out<java.lang.String>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
. TwoaccelMarker
characters following each other produce a single literalaccelMarker
character.To feed markup to the parser, use
MarkupParseContext.parse(java.lang.String, long)
on the returnedGLib.MarkupParseContext
. When done with feeding markup to the parser, usemarkupParserFinish(org.gnome.glib.MarkupParseContext, io.github.jwharm.javagi.base.Out<org.gnome.pango.AttrList>, io.github.jwharm.javagi.base.Out<java.lang.String>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
to get the data out of it, and then useMarkupParseContext.free()
to free it.This function is designed for applications that read Pango markup from streams. To simply parse a string containing Pango markup, the
parseMarkup(java.lang.String, int, int, io.github.jwharm.javagi.base.Out<org.gnome.pango.AttrList>, io.github.jwharm.javagi.base.Out<java.lang.String>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
API is recommended instead.- Parameters:
accelMarker
- character that precedes an accelerator, or 0 for none- Returns:
- a
GMarkupParseContext
that should be destroyed withMarkupParseContext.free()
.
-
parseEnum
@Deprecated public static boolean parseEnum(Type type, @Nullable @Nullable String str, @Nullable @Nullable Out<Integer> value, boolean warn, @Nullable @Nullable Out<String> possibleValues) Deprecated.Parses an enum type and stores the result invalue
.If
str
does not match the nick name of any of the possible values for the enum and is not an integer,false
is returned, a warning is issued ifwarn
istrue
, and a string representing the list of possible values is stored inpossibleValues
. The list is slash-separated, eg. "none/start/middle/end".If failed and
possibleValues
is notnull
, returned string should be freed using g_free().- Parameters:
type
- enum type to parse, eg.PANGO_TYPE_ELLIPSIZE_MODE
str
- string to parsevalue
- integer to store the result inwarn
- iftrue
, issue a g_warning() on bad inputpossibleValues
- place to store list of possible values on failure- Returns:
true
ifstr
was successfully parsed
-
parseMarkup
public static boolean parseMarkup(String markupText, int length, int accelMarker, @Nullable @Nullable Out<AttrList> attrList, @Nullable @Nullable Out<String> text, @Nullable @Nullable Out<Integer> accelChar) throws GErrorException Parses marked-up text to create a plain-text string and an attribute list.See the Pango Markup docs for details about the supported markup.
If
accelMarker
is nonzero, the given character will mark the character following it as an accelerator. For example,accelMarker
might be an ampersand or underscore. All characters marked as an accelerator will receive aUnderline.LOW
attribute, and the first character so marked will be returned inaccelChar
. TwoaccelMarker
characters following each other produce a single literalaccelMarker
character.To parse a stream of pango markup incrementally, use
markupParserNew(int)
.If any error happens, none of the output arguments are touched except for
error
.- Parameters:
markupText
- markup to parse (see the Pango Markup docs)length
- length ofmarkupText
, or -1 if nul-terminatedaccelMarker
- character that precedes an accelerator, or 0 for noneattrList
- address of return location for aPangoAttrList
text
- address of return location for text with tags strippedaccelChar
- address of return location for accelerator char- Returns:
false
iferror
is set, otherwisetrue
- Throws:
GErrorException
- seeGError
-
parseStretch
Parses a font stretch.The allowed values are "ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" and "ultra_expanded". Case variations are ignored and the '_' characters may be omitted.
- Parameters:
str
- a string to parse.stretch
- aPangoStretch
to store the result in.warn
- iftrue
, issue a g_warning() on bad input.- Returns:
true
ifstr
was successfully parsed.
-
parseStyle
Parses a font style.The allowed values are "normal", "italic" and "oblique", case variations being ignored.
- Parameters:
str
- a string to parse.style
- aPangoStyle
to store the result in.warn
- iftrue
, issue a g_warning() on bad input.- Returns:
true
ifstr
was successfully parsed.
-
parseVariant
Parses a font variant.The allowed values are "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase" and "title-caps", case variations being ignored.
- Parameters:
str
- a string to parse.variant
- aPangoVariant
to store the result in.warn
- iftrue
, issue a g_warning() on bad input.- Returns:
true
ifstr
was successfully parsed.
-
parseWeight
Parses a font weight.The allowed values are "heavy", "ultrabold", "bold", "normal", "light", "ultraleight" and integers. Case variations are ignored.
- Parameters:
str
- a string to parse.weight
- aPangoWeight
to store the result in.warn
- iftrue
, issue a g_warning() on bad input.- Returns:
true
ifstr
was successfully parsed.
-
quantizeLineGeometry
Quantizes the thickness and position of a line to whole device pixels.This is typically used for underline or strikethrough. The purpose of this function is to avoid such lines looking blurry.
Care is taken to make sure
thickness
is at least one pixel when this function returns, but returnedposition
may become zero as a result of rounding.- Parameters:
thickness
- pointer to the thickness of a line, in Pango unitsposition
- corresponding position
-
readLine
Deprecated.Reads an entire line from a file into a buffer.Lines may be delimited with '\\n', '\\r', '\\n\\r', or '\\r\\n'. The delimiter is not written into the buffer. Text after a '
'
character is treated as a comment and skipped. '\\' can be used to escape a # character. '\\' proceeding a line delimiter combines adjacent lines. A '\\' proceeding any other character is ignored and written into the output buffer unmodified.- Parameters:
stream
- a stdio streamstr
-GString
buffer into which to write the result- Returns:
- 0 if the stream was already at an
EOF
character, otherwise the number of lines read (this is useful for maintaining a line number counter which doesn't combine lines with '\\')
-
reorderItems
Reorder items from logical order to visual order.The visual order is determined from the associated directional levels of the items. The original list is unmodified.
(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.)
- Parameters:
items
- aGList
ofPangoItem
in logical order.- Returns:
- a
GList
ofPangoItem
structures in visual order.
-
scanInt
Deprecated.Scans an integer.Leading white space is skipped.
- Parameters:
pos
- in/out string positionout
- an int into which to write the result- Returns:
false
if a parse error occurred
-
scanString
Deprecated.Scans a string into aGString
buffer.The string may either be a sequence of non-white-space characters, or a quoted string with '"'. Instead a quoted string, '\\"' represents a literal quote. Leading white space outside of quotes is skipped.
- Parameters:
pos
- in/out string positionout
- aGString
into which to write the result- Returns:
false
if a parse error occurred
-
scanWord
Deprecated.Scans a word into aGString
buffer.A word consists of [A-Za-z_] followed by zero or more [A-Za-z_0-9]. Leading white space is skipped.
- Parameters:
pos
- in/out string positionout
- aGString
into which to write the result- Returns:
false
if a parse error occurred
-
shape
Convert the characters intext
into glyphs.Given a segment of text and the corresponding
PangoAnalysis
structure returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
, convert the characters into glyphs. You may also pass in only a substring of the item fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
.It is recommended that you use
shapeFull(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString)
instead, since that API allows for shaping interaction happening across text item boundaries.Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by
shapeItem(org.gnome.pango.Item, java.lang.String, int, org.gnome.pango.LogAttr, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.Note that the extra attributes in the
analyis
that is returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
have indices that are relative to the entire paragraph, so you need to subtract the item offset from their indices before callingshape(java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString)
.- Parameters:
text
- the text to processlength
- the length (in bytes) oftext
analysis
-PangoAnalysis
structure fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
glyphs
- glyph string in which to store results
-
shapeFull
public static void shapeFull(String itemText, int itemLength, @Nullable @Nullable String paragraphText, int paragraphLength, Analysis analysis, GlyphString glyphs) Convert the characters intext
into glyphs.Given a segment of text and the corresponding
PangoAnalysis
structure returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
, convert the characters into glyphs. You may also pass in only a substring of the item fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
.This is similar to
shape(java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString)
, 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 whichitemText
is part of, provide the broader text asparagraphText
. IfparagraphText
isnull
, item text is used instead.Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by
shapeItem(org.gnome.pango.Item, java.lang.String, int, org.gnome.pango.LogAttr, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.Note that the extra attributes in the
analyis
that is returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraphText
, you need to subtract the item offset from their indices before callingshapeFull(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString)
.- Parameters:
itemText
- valid UTF-8 text to shape.itemLength
- the length (in bytes) ofitemText
. -1 means nul-terminated text.paragraphText
- text of the paragraph (see details).paragraphLength
- the length (in bytes) ofparagraphText
. -1 means nul-terminated text.analysis
-PangoAnalysis
structure fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
.glyphs
- glyph string in which to store results.
-
shapeItem
public static void shapeItem(Item item, @Nullable @Nullable String paragraphText, int paragraphLength, @Nullable @Nullable LogAttr logAttrs, GlyphString glyphs, Set<ShapeFlags> flags) Convert the characters initem
into glyphs.This is similar to
shapeWithFlags(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
, except it takes aPangoItem
instead of separateitemText
andanalysis
arguments.It also takes
logAttrs
, which are needed for implementing some aspects of hyphen insertion and text transforms (in particular, capitalization).Note that the extra attributes in the
analyis
that is returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraphText
, you need to subtract the item offset from their indices before callingshapeWithFlags(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.- Parameters:
item
-PangoItem
to shapeparagraphText
- text of the paragraph (see details).paragraphLength
- the length (in bytes) ofparagraphText
. -1 means nul-terminated text.logAttrs
- array ofPangoLogAttr
foritem
glyphs
- glyph string in which to store resultsflags
- flags influencing the shaping process
-
shapeItem
public static void shapeItem(Item item, @Nullable @Nullable String paragraphText, int paragraphLength, @Nullable @Nullable LogAttr logAttrs, GlyphString glyphs, ShapeFlags... flags) Convert the characters initem
into glyphs.This is similar to
shapeWithFlags(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
, except it takes aPangoItem
instead of separateitemText
andanalysis
arguments.It also takes
logAttrs
, which are needed for implementing some aspects of hyphen insertion and text transforms (in particular, capitalization).Note that the extra attributes in the
analyis
that is returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraphText
, you need to subtract the item offset from their indices before callingshapeWithFlags(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.- Parameters:
item
-PangoItem
to shapeparagraphText
- text of the paragraph (see details).paragraphLength
- the length (in bytes) ofparagraphText
. -1 means nul-terminated text.logAttrs
- array ofPangoLogAttr
foritem
glyphs
- glyph string in which to store resultsflags
- flags influencing the shaping process
-
shapeWithFlags
public static void shapeWithFlags(String itemText, int itemLength, @Nullable @Nullable String paragraphText, int paragraphLength, Analysis analysis, GlyphString glyphs, Set<ShapeFlags> flags) Convert the characters intext
into glyphs.Given a segment of text and the corresponding
PangoAnalysis
structure returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
, convert the characters into glyphs. You may also pass in only a substring of the item fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
.This is similar to
shapeFull(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString)
, except it also takes flags that can influence the shaping process.Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by
shapeItem(org.gnome.pango.Item, java.lang.String, int, org.gnome.pango.LogAttr, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.Note that the extra attributes in the
analyis
that is returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraphText
, you need to subtract the item offset from their indices before callingshapeWithFlags(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.- Parameters:
itemText
- valid UTF-8 text to shapeitemLength
- the length (in bytes) ofitemText
. -1 means nul-terminated text.paragraphText
- text of the paragraph (see details).paragraphLength
- the length (in bytes) ofparagraphText
. -1 means nul-terminated text.analysis
-PangoAnalysis
structure fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
glyphs
- glyph string in which to store resultsflags
- flags influencing the shaping process
-
shapeWithFlags
public static void shapeWithFlags(String itemText, int itemLength, @Nullable @Nullable String paragraphText, int paragraphLength, Analysis analysis, GlyphString glyphs, ShapeFlags... flags) Convert the characters intext
into glyphs.Given a segment of text and the corresponding
PangoAnalysis
structure returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
, convert the characters into glyphs. You may also pass in only a substring of the item fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
.This is similar to
shapeFull(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString)
, except it also takes flags that can influence the shaping process.Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by
shapeItem(org.gnome.pango.Item, java.lang.String, int, org.gnome.pango.LogAttr, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.Note that the extra attributes in the
analyis
that is returned fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
have indices that are relative to the entire paragraph, so you do not pass the full paragraph text asparagraphText
, you need to subtract the item offset from their indices before callingshapeWithFlags(java.lang.String, int, java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.GlyphString, java.util.Set<org.gnome.pango.ShapeFlags>)
.- Parameters:
itemText
- valid UTF-8 text to shapeitemLength
- the length (in bytes) ofitemText
. -1 means nul-terminated text.paragraphText
- text of the paragraph (see details).paragraphLength
- the length (in bytes) ofparagraphText
. -1 means nul-terminated text.analysis
-PangoAnalysis
structure fromitemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator)
glyphs
- glyph string in which to store resultsflags
- flags influencing the shaping process
-
skipSpace
Deprecated.Skips 0 or more characters of white space.- Parameters:
pos
- in/out string position- Returns:
false
if skipping the white space leaves the position at a '\\0' character.
-
splitFileList
Deprecated.Splits aG_SEARCHPATH_SEPARATOR
-separated list of files, stripping white space and substituting ~/ with $HOME/.- Parameters:
str
- aG_SEARCHPATH_SEPARATOR
separated list of filenames- Returns:
- a list of strings to be freed with g_strfreev()
-
tailorBreak
public static void tailorBreak(String text, int length, Analysis analysis, int offset, LogAttr[] attrs) Apply language-specific tailoring to the breaks inattrs
.The line breaks are assumed to have been produced by
defaultBreak(java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.LogAttr, int)
.If
offset
is not -1, it is used to apply attributes fromanalysis
that are relevant to line breaking.Note that it is better to pass -1 for
offset
and useattrBreak(java.lang.String, int, org.gnome.pango.AttrList, int, org.gnome.pango.LogAttr[])
to apply attributes to the whole paragraph.- Parameters:
text
- text to process. Must be valid UTF-8length
- length in bytes oftext
analysis
-PangoAnalysis
fortext
offset
- Byte offset oftext
from the beginning of the paragraph, or -1 to ignore attributes fromanalysis
attrs
- array with onePangoLogAttr
per character intext
, plus one extra, to be filled in
-
trimString
Deprecated.Trims leading and trailing whitespace from a string.- Parameters:
str
- a string- Returns:
- A newly-allocated string that must be freed with g_free()
-
unicharDirection
Determines the inherent direction of a character.The inherent direction is either
PANGO_DIRECTION_LTR
,PANGO_DIRECTION_RTL
, orPANGO_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,
BidiType.forUnichar(int)
can be used instead.- Parameters:
ch
- a Unicode character- Returns:
- the direction of the character.
-
unitsFromDouble
public static int unitsFromDouble(double d) Converts a floating-point number to Pango units.The conversion is done by multiplying
d
byPANGO_SCALE
and rounding the result to nearest integer.- Parameters:
d
- double floating-point value- Returns:
- the value in Pango units.
-
unitsToDouble
public static double unitsToDouble(int i) Converts a number in Pango units to floating-point.The conversion is done by dividing
i
byPANGO_SCALE
.- Parameters:
i
- value in Pango units- Returns:
- the double value.
-
version
public static int version()Returns the encoded version of Pango available at run-time.This is similar to the macro
PANGO_VERSION
except that the macro returns the encoded version available at compile-time. A version number can be encoded into an integer using PANGO_VERSION_ENCODE().- Returns:
- The encoded version of Pango library available at run time.
-
versionCheck
Checks that the Pango library in use is compatible with the given version.Generally you would pass in the constants
PANGO_VERSION_MAJOR
,PANGO_VERSION_MINOR
,PANGO_VERSION_MICRO
as the three arguments to this function; that produces a check that the library in use at run-time is compatible with the version of Pango the application or module was compiled against.Compatibility is defined by two things: first the version of the running library is newer than the version
requiredMajor
.required_minor.requiredMicro
. Second the running library must be binary compatible with the versionrequiredMajor
.required_minor.requiredMicro
(same major version.)For compile-time version checking use PANGO_VERSION_CHECK().
- Parameters:
requiredMajor
- the required major versionrequiredMinor
- the required minor versionrequiredMicro
- the required major version- Returns:
null
if the Pango library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by Pango and should not be modified or freed.
-
versionString
Returns the version of Pango available at run-time.This is similar to the macro
PANGO_VERSION_STRING
except that the macro returns the version available at compile-time.- Returns:
- A string containing the version of Pango library available at run time. The returned string is owned by Pango and should not be modified or freed.
-
defaultBreak(java.lang.String, int, org.gnome.pango.Analysis, org.gnome.pango.LogAttr, int)
,tailorBreak(java.lang.String, int, org.gnome.pango.Analysis, int, org.gnome.pango.LogAttr[])
andattrBreak(java.lang.String, int, org.gnome.pango.AttrList, int, org.gnome.pango.LogAttr[])
.