w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Segment.h File Reference
#include "graphite2/Types.h"
#include "graphite2/Font.h"
Include dependency graph for Segment.h:

Go to the source code of this file.

Typedefs

typedef struct gr_char_info gr_char_info
 
typedef struct gr_segment gr_segment
 
typedef struct gr_slot gr_slot
 

Enumerations

enum  gr_break_weight {
  gr_breakNone = 0 , gr_breakWhitespace = 10 , gr_breakWord = 15 , gr_breakIntra = 20 ,
  gr_breakLetter = 30 , gr_breakClip = 40 , gr_breakBeforeWhitespace = -10 , gr_breakBeforeWord = -15 ,
  gr_breakBeforeIntra = -20 , gr_breakBeforeLetter = -30 , gr_breakBeforeClip = -40 , gr_breakNone = 0 ,
  gr_breakWhitespace = 10 , gr_breakWord = 15 , gr_breakIntra = 20 , gr_breakLetter = 30 ,
  gr_breakClip = 40 , gr_breakBeforeWhitespace = -10 , gr_breakBeforeWord = -15 , gr_breakBeforeIntra = -20 ,
  gr_breakBeforeLetter = -30 , gr_breakBeforeClip = -40
}
 
enum  gr_justFlags {
  gr_justCompleteLine = 0 , gr_justStartInline = 1 , gr_justEndInline = 2 , gr_justCompleteLine = 0 ,
  gr_justStartInline = 1 , gr_justEndInline = 2
}
 
enum  gr_attrCode {
  gr_slatAdvX = 0 , gr_slatAdvY , gr_slatAttTo , gr_slatAttX ,
  gr_slatAttY , gr_slatAttGpt , gr_slatAttXOff , gr_slatAttYOff ,
  gr_slatAttWithX , gr_slatAttWithY , gr_slatWithGpt , gr_slatAttWithXOff ,
  gr_slatAttWithYOff , gr_slatAttLevel , gr_slatBreak , gr_slatCompRef ,
  gr_slatDir , gr_slatInsert , gr_slatPosX , gr_slatPosY ,
  gr_slatShiftX , gr_slatShiftY , gr_slatUserDefnV1 , gr_slatMeasureSol ,
  gr_slatMeasureEol , gr_slatJStretch , gr_slatJShrink , gr_slatJStep ,
  gr_slatJWeight , gr_slatJWidth = 29 , gr_slatSegSplit = gr_slatJStretch + 29 , gr_slatUserDefn ,
  gr_slatBidiLevel = 56 , gr_slatColFlags , gr_slatColLimitblx , gr_slatColLimitbly ,
  gr_slatColLimittrx , gr_slatColLimittry , gr_slatColShiftx , gr_slatColShifty ,
  gr_slatColMargin , gr_slatColMarginWt , gr_slatColExclGlyph , gr_slatColExclOffx ,
  gr_slatColExclOffy , gr_slatSeqClass , gr_slatSeqProxClass , gr_slatSeqOrder ,
  gr_slatSeqAboveXoff , gr_slatSeqAboveWt , gr_slatSeqBelowXlim , gr_slatSeqBelowWt ,
  gr_slatSeqValignHt , gr_slatSeqValignWt , gr_slatMax , gr_slatNoEffect = gr_slatMax + 1 ,
  gr_slatAdvX = 0 , gr_slatAdvY , gr_slatAttTo , gr_slatAttX ,
  gr_slatAttY , gr_slatAttGpt , gr_slatAttXOff , gr_slatAttYOff ,
  gr_slatAttWithX , gr_slatAttWithY , gr_slatWithGpt , gr_slatAttWithXOff ,
  gr_slatAttWithYOff , gr_slatAttLevel , gr_slatBreak , gr_slatCompRef ,
  gr_slatDir , gr_slatInsert , gr_slatPosX , gr_slatPosY ,
  gr_slatShiftX , gr_slatShiftY , gr_slatUserDefnV1 , gr_slatMeasureSol ,
  gr_slatMeasureEol , gr_slatJStretch , gr_slatJShrink , gr_slatJStep ,
  gr_slatJWeight , gr_slatJWidth = 29 , gr_slatSegSplit = gr_slatJStretch + 29 , gr_slatUserDefn ,
  gr_slatBidiLevel = 56 , gr_slatColFlags , gr_slatColLimitblx , gr_slatColLimitbly ,
  gr_slatColLimittrx , gr_slatColLimittry , gr_slatColShiftx , gr_slatColShifty ,
  gr_slatColMargin , gr_slatColMarginWt , gr_slatColExclGlyph , gr_slatColExclOffx ,
  gr_slatColExclOffy , gr_slatSeqClass , gr_slatSeqProxClass , gr_slatSeqOrder ,
  gr_slatSeqAboveXoff , gr_slatSeqAboveWt , gr_slatSeqBelowXlim , gr_slatSeqBelowWt ,
  gr_slatSeqValignHt , gr_slatSeqValignWt , gr_slatMax , gr_slatNoEffect = gr_slatMax + 1
}
 
enum  gr_bidirtl {
  gr_rtl = 1 , gr_nobidi = 2 , gr_nomirror = 4 , gr_rtl = 1 ,
  gr_nobidi = 2 , gr_nomirror = 4
}
 

Functions

GR2_API unsigned int gr_cinfo_unicode_char (const gr_char_info *p)
 
GR2_API int gr_cinfo_break_weight (const gr_char_info *p)
 
GR2_API int gr_cinfo_after (const gr_char_info *p)
 
GR2_API int gr_cinfo_before (const gr_char_info *p)
 
GR2_API size_t gr_cinfo_base (const gr_char_info *p)
 
GR2_API size_t gr_count_unicode_characters (enum gr_encform enc, const void *buffer_begin, const void *buffer_end, const void **pError)
 
GR2_API gr_segmentgr_make_seg (const gr_font *font, const gr_face *face, gr_uint32 script, const gr_feature_val *pFeats, enum gr_encform enc, const void *pStart, size_t nChars, int dir)
 
GR2_API void gr_seg_destroy (gr_segment *p)
 
GR2_API float gr_seg_advance_X (const gr_segment *pSeg)
 
GR2_API float gr_seg_advance_Y (const gr_segment *pSeg)
 
GR2_API unsigned int gr_seg_n_cinfo (const gr_segment *pSeg)
 
GR2_API const gr_char_infogr_seg_cinfo (const gr_segment *pSeg, unsigned int index)
 
GR2_API unsigned int gr_seg_n_slots (const gr_segment *pSeg)
 
GR2_API const gr_slotgr_seg_first_slot (gr_segment *pSeg)
 
GR2_API const gr_slotgr_seg_last_slot (gr_segment *pSeg)
 
GR2_API float gr_seg_justify (gr_segment *pSeg, const gr_slot *pStart, const gr_font *pFont, double width, enum gr_justFlags flags, const gr_slot *pFirst, const gr_slot *pLast)
 
GR2_API const gr_slotgr_slot_next_in_segment (const gr_slot *p)
 
GR2_API const gr_slotgr_slot_prev_in_segment (const gr_slot *p)
 
GR2_API const gr_slotgr_slot_attached_to (const gr_slot *p)
 
GR2_API const gr_slotgr_slot_first_attachment (const gr_slot *p)
 
GR2_API const gr_slotgr_slot_next_sibling_attachment (const gr_slot *p)
 
GR2_API unsigned short gr_slot_gid (const gr_slot *p)
 
GR2_API float gr_slot_origin_X (const gr_slot *p)
 
GR2_API float gr_slot_origin_Y (const gr_slot *p)
 
GR2_API float gr_slot_advance_X (const gr_slot *p, const gr_face *face, const gr_font *font)
 
GR2_API float gr_slot_advance_Y (const gr_slot *p, const gr_face *face, const gr_font *font)
 
GR2_API int gr_slot_before (const gr_slot *p)
 
GR2_API int gr_slot_after (const gr_slot *p)
 
GR2_API unsigned int gr_slot_index (const gr_slot *p)
 
GR2_API int gr_slot_attr (const gr_slot *p, const gr_segment *pSeg, enum gr_attrCode index, gr_uint8 subindex)
 
GR2_API int gr_slot_can_insert_before (const gr_slot *p)
 
GR2_API int gr_slot_original (const gr_slot *p)
 
GR2_API void gr_slot_linebreak_before (gr_slot *p)
 

Typedef Documentation

◆ gr_char_info

typedef struct gr_char_info gr_char_info

Definition at line 1 of file Segment.h.

◆ gr_segment

typedef struct gr_segment gr_segment

Definition at line 1 of file Segment.h.

◆ gr_slot

typedef struct gr_slot gr_slot

Definition at line 1 of file Segment.h.

Enumeration Type Documentation

◆ gr_attrCode

Used for looking up slot attributes. Most are already available in other functions

Enumerator
gr_slatAdvX 

adjusted glyph advance in x direction in design units

gr_slatAdvY 

adjusted glyph advance in y direction (usually 0) in design units

gr_slatAttTo 

returns 0. Deprecated.

gr_slatAttX 

This slot attaches to its parent at the given design units in the x direction.

gr_slatAttY 

This slot attaches to its parent at the given design units in the y direction.

gr_slatAttGpt 

This slot attaches to its parent at the given glyph point (not implemented)

gr_slatAttXOff 

x-direction adjustment from the given glyph point (not implemented)

gr_slatAttYOff 

y-direction adjustment from the given glyph point (not implemented)

gr_slatAttWithX 

Where on this glyph should align with the attachment point on the parent glyph in the x-direction.

gr_slatAttWithY 

Where on this glyph should align with the attachment point on the parent glyph in the y-direction.

gr_slatWithGpt 

Which glyph point on this glyph should align with the attachment point on the parent glyph (not implemented).

gr_slatAttWithXOff 

Adjustment to gr_slatWithGpt in x-direction (not implemented)

gr_slatAttWithYOff 

Adjustment to gr_slatWithGpt in y-direction (not implemented)

gr_slatAttLevel 

Attach at given nesting level (not implemented)

gr_slatBreak 

Line break breakweight for this glyph.

gr_slatCompRef 

Ligature component reference (not implemented)

gr_slatDir 

bidi directionality of this glyph (not implemented)

gr_slatInsert 

Whether insertion is allowed before this glyph.

gr_slatPosX 

Final positioned position of this glyph relative to its parent in x-direction in pixels.

gr_slatPosY 

Final positioned position of this glyph relative to its parent in y-direction in pixels.

gr_slatShiftX 

Amount to shift glyph by in x-direction design units.

gr_slatShiftY 

Amount to shift glyph by in y-direction design units.

gr_slatUserDefnV1 

attribute user1

gr_slatMeasureSol 

not implemented

gr_slatMeasureEol 

not implemented

gr_slatJStretch 

Amount this slot can stretch (not implemented)

gr_slatJShrink 

Amount this slot can shrink (not implemented)

gr_slatJStep 

Granularity by which this slot can stretch or shrink (not implemented)

gr_slatJWeight 

Justification weight for this glyph (not implemented)

gr_slatJWidth 

Amount this slot mush shrink or stretch in design units.

gr_slatSegSplit 

SubSegment split point.

gr_slatUserDefn 

User defined attribute, see subattr for user attr number.

gr_slatBidiLevel 

Bidi level.

gr_slatColFlags 

Collision flags.

gr_slatColLimitblx 

Collision constraint rectangle left (bl.x)

gr_slatColLimitbly 

Collision constraint rectangle lower (bl.y)

gr_slatColLimittrx 

Collision constraint rectangle right (tr.x)

gr_slatColLimittry 

Collision constraint rectangle upper (tr.y)

gr_slatColShiftx 

Collision shift x.

gr_slatColShifty 

Collision shift y.

gr_slatColMargin 

Collision margin.

gr_slatColMarginWt 

Margin cost weight.

gr_slatColExclGlyph 
gr_slatColExclOffx 
gr_slatColExclOffy 
gr_slatSeqClass 
gr_slatSeqProxClass 
gr_slatSeqOrder 
gr_slatSeqAboveXoff 
gr_slatSeqAboveWt 
gr_slatSeqBelowXlim 
gr_slatSeqBelowWt 
gr_slatSeqValignHt 
gr_slatSeqValignWt 
gr_slatMax 

not implemented

gr_slatNoEffect 

not implemented

gr_slatAdvX 

adjusted glyph advance in x direction in design units

gr_slatAdvY 

adjusted glyph advance in y direction (usually 0) in design units

gr_slatAttTo 

returns 0. Deprecated.

gr_slatAttX 

This slot attaches to its parent at the given design units in the x direction.

gr_slatAttY 

This slot attaches to its parent at the given design units in the y direction.

gr_slatAttGpt 

This slot attaches to its parent at the given glyph point (not implemented)

gr_slatAttXOff 

x-direction adjustment from the given glyph point (not implemented)

gr_slatAttYOff 

y-direction adjustment from the given glyph point (not implemented)

gr_slatAttWithX 

Where on this glyph should align with the attachment point on the parent glyph in the x-direction.

gr_slatAttWithY 

Where on this glyph should align with the attachment point on the parent glyph in the y-direction.

gr_slatWithGpt 

Which glyph point on this glyph should align with the attachment point on the parent glyph (not implemented).

gr_slatAttWithXOff 

Adjustment to gr_slatWithGpt in x-direction (not implemented)

gr_slatAttWithYOff 

Adjustment to gr_slatWithGpt in y-direction (not implemented)

gr_slatAttLevel 

Attach at given nesting level (not implemented)

gr_slatBreak 

Line break breakweight for this glyph.

gr_slatCompRef 

Ligature component reference (not implemented)

gr_slatDir 

bidi directionality of this glyph (not implemented)

gr_slatInsert 

Whether insertion is allowed before this glyph.

gr_slatPosX 

Final positioned position of this glyph relative to its parent in x-direction in pixels.

gr_slatPosY 

Final positioned position of this glyph relative to its parent in y-direction in pixels.

gr_slatShiftX 

Amount to shift glyph by in x-direction design units.

gr_slatShiftY 

Amount to shift glyph by in y-direction design units.

gr_slatUserDefnV1 

attribute user1

gr_slatMeasureSol 

not implemented

gr_slatMeasureEol 

not implemented

gr_slatJStretch 

Amount this slot can stretch (not implemented)

gr_slatJShrink 

Amount this slot can shrink (not implemented)

gr_slatJStep 

Granularity by which this slot can stretch or shrink (not implemented)

gr_slatJWeight 

Justification weight for this glyph (not implemented)

gr_slatJWidth 

Amount this slot mush shrink or stretch in design units.

gr_slatSegSplit 

SubSegment split point.

gr_slatUserDefn 

User defined attribute, see subattr for user attr number.

gr_slatBidiLevel 

Bidi level.

gr_slatColFlags 

Collision flags.

gr_slatColLimitblx 

Collision constraint rectangle left (bl.x)

gr_slatColLimitbly 

Collision constraint rectangle lower (bl.y)

gr_slatColLimittrx 

Collision constraint rectangle right (tr.x)

gr_slatColLimittry 

Collision constraint rectangle upper (tr.y)

gr_slatColShiftx 

Collision shift x.

gr_slatColShifty 

Collision shift y.

gr_slatColMargin 

Collision margin.

gr_slatColMarginWt 

Margin cost weight.

gr_slatColExclGlyph 
gr_slatColExclOffx 
gr_slatColExclOffy 
gr_slatSeqClass 
gr_slatSeqProxClass 
gr_slatSeqOrder 
gr_slatSeqAboveXoff 
gr_slatSeqAboveWt 
gr_slatSeqBelowXlim 
gr_slatSeqBelowWt 
gr_slatSeqValignHt 
gr_slatSeqValignWt 
gr_slatMax 

not implemented

gr_slatNoEffect 

not implemented

Definition at line 63 of file Segment.h.

◆ gr_bidirtl

enum gr_bidirtl
Enumerator
gr_rtl 

Underlying paragraph direction is RTL.

gr_nobidi 

Set this to not run the bidi pass internally, even if the font asks for it. This presumes that the segment is in a single direction. Most of the time this bit should be set unless you know you are passing full paragraphs of text.

gr_nomirror 

Disable auto mirroring for rtl text.

gr_rtl 

Underlying paragraph direction is RTL.

gr_nobidi 

Set this to not run the bidi pass internally, even if the font asks for it. This presumes that the segment is in a single direction. Most of the time this bit should be set unless you know you are passing full paragraphs of text.

gr_nomirror 

Disable auto mirroring for rtl text.

Definition at line 169 of file Segment.h.

◆ gr_break_weight

Enumerator
gr_breakNone 
gr_breakWhitespace 
gr_breakWord 
gr_breakIntra 
gr_breakLetter 
gr_breakClip 
gr_breakBeforeWhitespace 
gr_breakBeforeWord 
gr_breakBeforeIntra 
gr_breakBeforeLetter 
gr_breakBeforeClip 
gr_breakNone 
gr_breakWhitespace 
gr_breakWord 
gr_breakIntra 
gr_breakLetter 
gr_breakClip 
gr_breakBeforeWhitespace 
gr_breakBeforeWord 
gr_breakBeforeIntra 
gr_breakBeforeLetter 
gr_breakBeforeClip 

Definition at line 37 of file Segment.h.

◆ gr_justFlags

Enumerator
gr_justCompleteLine 

Indicates that this segment is a complete line.

gr_justStartInline 

Indicates that the start of the slot list is not at the start of a line.

gr_justEndInline 

Indicates that the end of the slot list is not at the end of a line.

gr_justCompleteLine 

Indicates that this segment is a complete line.

gr_justStartInline 

Indicates that the start of the slot list is not at the start of a line.

gr_justEndInline 

Indicates that the end of the slot list is not at the end of a line.

Definition at line 53 of file Segment.h.

Function Documentation

◆ gr_cinfo_after()

GR2_API int gr_cinfo_after ( const gr_char_info p)

Returns the slot index that after this character is after in the slot stream

In effect each character is associated with a set of slots and this returns the index of the last slot in the segment this character is associated with.

Returns
after slot index between 0 and gr_seg_n_slots()
Parameters
pPointer to charinfo to return information on.

Definition at line 47 of file gr_char_info.cpp.

References assert(), and p.

◆ gr_cinfo_base()

GR2_API size_t gr_cinfo_base ( const gr_char_info p)

Returns the code unit index of this character in the input string

Returns
code unit index between 0 and the end of the string
Parameters
pPointer to charinfo to return information on.

Definition at line 59 of file gr_char_info.cpp.

References assert(), and p.

Referenced by findNextGraphiteBreak().

◆ gr_cinfo_before()

GR2_API int gr_cinfo_before ( const gr_char_info p)

Returns the slot index that before this character is before in the slot stream

In effect each character is associated with a set of slots and this returns the index of the first slot in the segment this character is associated with.

Returns
before slot index between 0 and gr_seg_n_slots()
Parameters
pPointer to charinfo to return information on.

Definition at line 53 of file gr_char_info.cpp.

References assert(), and p.

◆ gr_cinfo_break_weight()

GR2_API int gr_cinfo_break_weight ( const gr_char_info p)

Returns breakweight for a charinfo.

Returns
Breakweight is a number between -50 and 50 indicating the cost of a break before or after this character. If the value < 0, the absolute value is this character's contribution to the overall breakweight before it. If the value

0, then the value is this character's contribution to the overall breakweight after it.

The overall breakweight between two characters is the maximum of the breakweight contributions from the characters either side of it. If a character makes no contribution to the breakweight on one side of it, the contribution is considered to be 0.
Parameters
pPointer to charinfo to return information on.

Definition at line 41 of file gr_char_info.cpp.

References assert(), and p.

Referenced by findNextGraphiteBreak().

◆ gr_cinfo_unicode_char()

GR2_API unsigned int gr_cinfo_unicode_char ( const gr_char_info p)

Returns Unicode character for a charinfo.

Parameters
pPointer to charinfo to return information on.

Definition at line 34 of file gr_char_info.cpp.

References assert(), and p.

◆ gr_count_unicode_characters()

GR2_API size_t gr_count_unicode_characters ( enum gr_encform  enc,
const void buffer_begin,
const void buffer_end,
const void **  pError 
)

Returns the number of unicode characters in a string.

Returns
number of characters in the string
Parameters
encSpecifies the type of data in the string: utf8, utf16, utf32
buffer_beginThe start of the string
buffer_endMeasure up to the first nul or when end is reached, whichever is earliest. This parameter may be NULL.
pErrorIf there is a structural fault in the string, the location is returned in this variable. If no error occurs, pError will contain NULL. NULL may be passed for pError if no such information is required.

Definition at line 89 of file gr_segment.cpp.

References assert(), buffer_end, gr_utf16, gr_utf32, and gr_utf8.

◆ gr_make_seg()

GR2_API gr_segment* gr_make_seg ( const gr_font font,
const gr_face face,
gr_uint32  script,
const gr_feature_val pFeats,
enum gr_encform  enc,
const void pStart,
size_t  nChars,
int  dir 
)

Creates and returns a segment.

Returns
a segment that needs seg_destroy called on it. May return NULL if bad problems in segment processing.
Parameters
fontGives the size of the font in pixels per em for final positioning. If NULL, positions are returned in design units, i.e. at a ppm of the upem of the face.
faceThe face containing all the non-size dependent information.
scriptThis is a tag containing a script identifier that is used to choose which graphite table within the font to use. Maybe 0. Tag may be 4 chars NULL padded in LSBs or space padded in LSBs.
pFeatsPointer to a feature values to be used for the segment. Only one feature values may be used for a segment. If NULL the default features for the font will be used.
encSpecifies what encoding form the string is in (utf8, utf16, utf32)
pStartStart of the string
nCharsNumber of unicode characters to process in the string. The string will be processed either up to the first NULL or until nChars have been processed. nChars is also used to initialise the internal memory allocations of the segment. So it is wise not to make nChars too much greater than the actual number of characters being processed.
dirSpecifies whether the segment is processed right to left (1) or left to right (0) and whether to run the internal bidi pass, if a font requests it. See enum gr_bidirtl for details.

Definition at line 103 of file gr_segment.cpp.

References dir, face, script, and seg.

Referenced by initGraphiteBreaking().

◆ gr_seg_advance_X()

GR2_API float gr_seg_advance_X ( const gr_segment pSeg)

Returns the advance for the whole segment.

Returns the width of the segment up to the next glyph origin after the segment

Definition at line 123 of file gr_segment.cpp.

References graphite2::Segment::advance(), assert(), and graphite2::Position::x.

◆ gr_seg_advance_Y()

GR2_API float gr_seg_advance_Y ( const gr_segment pSeg)

Returns the height advance for the segment.

Definition at line 130 of file gr_segment.cpp.

References graphite2::Segment::advance(), assert(), and graphite2::Position::y.

◆ gr_seg_cinfo()

GR2_API const gr_char_info* gr_seg_cinfo ( const gr_segment pSeg,
unsigned int  index 
)

Returns a gr_char_info at a given index in the segment.

Definition at line 144 of file gr_segment.cpp.

References assert(), and graphite2::Segment::charinfo().

Referenced by findNextGraphiteBreak().

◆ gr_seg_destroy()

GR2_API void gr_seg_destroy ( gr_segment p)

Destroys a segment, freeing the memory.

Parameters
pThe segment to destroy

Definition at line 117 of file gr_segment.cpp.

References p.

Referenced by initGraphiteBreaking().

◆ gr_seg_first_slot()

GR2_API const gr_slot* gr_seg_first_slot ( gr_segment pSeg)

Returns the first gr_slot in the segment.

The first slot in a segment has a gr_slot_prev_in_segment() of NULL. Slots are owned by their segment and are destroyed along with the segment.

Definition at line 156 of file gr_segment.cpp.

References assert(), and graphite2::Segment::first().

Referenced by initGraphiteBreaking().

◆ gr_seg_justify()

GR2_API float gr_seg_justify ( gr_segment pSeg,
const gr_slot pStart,
const gr_font pFont,
double  width,
enum gr_justFlags  flags,
const gr_slot pFirst,
const gr_slot pLast 
)

Justifies a linked list of slots for a line to a given width

Passed a pointer to the start of a linked list of slots corresponding to a line, as set up by gr_slot_linebreak_before, this function will position the glyphs in the line to take up the given width. It is possible to specify a subrange within the line to process. This allows skipping of line initial or final whitespace, for example. While this will ensure that the subrange fits width, the line will still be positioned with the first glyph of the line at 0. So the resulting positions may be beyond width.

Returns
float The resulting width of the range of slots justified.
Parameters
pSegPointer to the segment
pStartPointer to the start of the line linked list (including skipped characters)
pFontFont to use for positioning
widthWidth in pixels in which to fit the line. If < 0. don't adjust natural width, just run justification passes to handle line end contextuals, if there are any.
flagsIndicates line ending types. Default is linked list is a full line
pFirstIf not NULL, the first slot in the list to be considered part of the line (so can skip)
pLastIf not NULL, the last slot to process in the line (allow say trailing whitespace to be skipped)

Definition at line 168 of file gr_segment.cpp.

References assert(), flags, graphite2::Segment::justify(), and width.

◆ gr_seg_last_slot()

GR2_API const gr_slot* gr_seg_last_slot ( gr_segment pSeg)

Returns the last gr_slot in the segment.

The last slot in a segment has a gr_slot_next_in_segment() of NULL

Definition at line 162 of file gr_segment.cpp.

References assert(), and graphite2::Segment::last().

Referenced by findNextGraphiteBreak().

◆ gr_seg_n_cinfo()

GR2_API unsigned int gr_seg_n_cinfo ( const gr_segment pSeg)

Returns the number of gr_char_infos in the segment.

Definition at line 137 of file gr_segment.cpp.

References assert(), and graphite2::Segment::charInfoCount().

◆ gr_seg_n_slots()

GR2_API unsigned int gr_seg_n_slots ( const gr_segment pSeg)

Returns the number of glyph gr_slots in the segment.

Definition at line 150 of file gr_segment.cpp.

References assert(), and graphite2::Segment::slotCount().

◆ gr_slot_advance_X()

GR2_API float gr_slot_advance_X ( const gr_slot p,
const gr_face face,
const gr_font font 
)

Returns the glyph advance for this glyph as adjusted for kerning

Parameters
pSlot to give results for
facegr_face of the glyphs. May be NULL if unhinted advances used
fontgr_font to scale for pixel results. If NULL returns design units advance. If not NULL then returns pixel advance based on hinted or scaled glyph advances in the font. face must be passed for hinted advances to be used.

Definition at line 90 of file gr_slot.cpp.

References assert(), face, FT_FaceRec_::glyph, glyphs(), p, res, and scale.

◆ gr_slot_advance_Y()

GR2_API float gr_slot_advance_Y ( const gr_slot p,
const gr_face face,
const gr_font font 
)

Returns the vertical advance for the glyph in the slot adjusted for kerning

Returns design units unless font is not NULL in which case the pixel value is returned scaled for the given font

◆ gr_slot_after()

GR2_API int gr_slot_after ( const gr_slot p)

Returns the gr_char_info index after us

Returns the index of the gr_char_info that a cursor after this slot would put an underlying cursor after. This may also be interpretted as each slot holding a set of char_infos that it is associated with and this function returning the index of the char_info with the highest index, from this set.

Definition at line 124 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_attached_to()

GR2_API const gr_slot* gr_slot_attached_to ( const gr_slot p)

Returns the attachment parent slot of this slot.

Attached slots form a tree. This returns the parent of this slot in that tree. A base glyph which is not attached to another glyph, always returns NULL.

Definition at line 48 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_attr()

GR2_API int gr_slot_attr ( const gr_slot p,
const gr_segment pSeg,
enum gr_attrCode  index,
gr_uint8  subindex 
)

Return a slot attribute value

Given a slot and an attribute along with a possible subattribute, return the corresponding value in the slot. See enum gr_attrCode for details of each attribute.

Definition at line 136 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_before()

GR2_API int gr_slot_before ( const gr_slot p)

Returns the gr_char_info index before us

Returns the index of the gr_char_info that a cursor before this slot, would put an underlying cursor before. This may also be interpretted as each slot holding a set of char_infos that it is associated with and this function returning the index of the char_info with lowest index, from this set.

Definition at line 117 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_can_insert_before()

GR2_API int gr_slot_can_insert_before ( const gr_slot p)

Returns whether text may be inserted before this glyph.

This indicates whether a cursor can be put before this slot. It applies to base glyphs that have no parent as well as attached glyphs that have the .insert attribute explicitly set to true. This is the primary mechanism for identifying contiguous sequences of base plus diacritics.

Definition at line 143 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_first_attachment()

GR2_API const gr_slot* gr_slot_first_attachment ( const gr_slot p)

Returns the first slot attached to this slot.

Attached slots form a singly linked list from the parent. This returns the first slot in that list. Note that this is a reference to another slot that is also in the main segment doubly linked list.

if gr_slot_first_attachment(p) != NULL then gr_slot_attached_to(gr_slot_first_attachment(p)) == p.

Definition at line 55 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_gid()

GR2_API unsigned short gr_slot_gid ( const gr_slot p)

Returns glyph id of the slot

Each slot has a glyphid which is rendered at the position given by the slot. This glyphid is the real glyph to be rendered and never a pseudo glyph.

Definition at line 69 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_index()

GR2_API unsigned int gr_slot_index ( const gr_slot p)

Returns the index of this slot in the segment

Returns the index given to this slot during final positioning. This corresponds to the value returned br gr_cinfo_before() and gr_cinfo_after()

Definition at line 130 of file gr_slot.cpp.

References assert(), and p.

Referenced by findNextGraphiteBreak().

◆ gr_slot_linebreak_before()

GR2_API void gr_slot_linebreak_before ( gr_slot p)

Breaks a segment into lines.

Breaks the slot linked list at the given point in the linked list. It is up to the application to keep track of the first slot on each line.

Definition at line 156 of file gr_slot.cpp.

References assert(), NULL, p, and prev.

◆ gr_slot_next_in_segment()

GR2_API const gr_slot* gr_slot_next_in_segment ( const gr_slot p)

Returns the next slot along in the segment.

Slots are held in a linked list. This returns the next in the linked list. The slot may or may not be attached to another slot. Returns NULL at the end of the segment.

Definition at line 36 of file gr_slot.cpp.

References assert(), and p.

Referenced by findNextGraphiteBreak().

◆ gr_slot_next_sibling_attachment()

GR2_API const gr_slot* gr_slot_next_sibling_attachment ( const gr_slot p)

Returns the next slot attached to our attachment parent.

This returns the next slot in the singly linked list of slots attached to this slot's parent. If there are no more such slots, NULL is returned. If there is no parent, i.e. the passed slot is a cluster base, then the next cluster base in graphical order (ltr, even for rtl text) is returned.

if gr_slot_next_sibling_attachment(p) != NULL then gr_slot_attached_to(gr_slot_next_sibling_attachment(p)) == gr_slot_attached_to(p).

Definition at line 62 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_origin_X()

GR2_API float gr_slot_origin_X ( const gr_slot p)

Returns X offset of glyph from start of segment

Definition at line 76 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_origin_Y()

GR2_API float gr_slot_origin_Y ( const gr_slot p)

Returns Y offset of glyph from start of segment

Definition at line 83 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_original()

GR2_API int gr_slot_original ( const gr_slot p)

Returns the original gr_char_info index this slot refers to.

Each Slot has a gr_char_info that it originates from. This is that gr_char_info. The index is passed to gr_seg_cinfo(). This information is useful for testing.

Definition at line 150 of file gr_slot.cpp.

References assert(), and p.

◆ gr_slot_prev_in_segment()

GR2_API const gr_slot* gr_slot_prev_in_segment ( const gr_slot p)

Returns the previous slot along in the segment.

Slots are held in a doubly linked list. This returns the previos slot in the linked list. This slot may or may not be attached to it. Returns NULL at the start of the segment.

Definition at line 42 of file gr_slot.cpp.

References assert(), and p.