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)  

gr_segment.cpp File Reference
#include "graphite2/Segment.h"
#include "inc/UtfCodec.h"
#include "inc/Segment.h"
Include dependency graph for gr_segment.cpp:

Go to the source code of this file.

Functions

size_t gr_count_unicode_characters (gr_encform enc, const void *buffer_begin, const void *buffer_end, const void **pError)
 
gr_segmentgr_make_seg (const gr_font *font, const gr_face *face, gr_uint32 script, const gr_feature_val *pFeats, gr_encform enc, const void *pStart, size_t nChars, int dir)
 
void gr_seg_destroy (gr_segment *p)
 
float gr_seg_advance_X (const gr_segment *pSeg)
 
float gr_seg_advance_Y (const gr_segment *pSeg)
 
unsigned int gr_seg_n_cinfo (const gr_segment *pSeg)
 
const gr_char_infogr_seg_cinfo (const gr_segment *pSeg, unsigned int index)
 
unsigned int gr_seg_n_slots (const gr_segment *pSeg)
 
const gr_slotgr_seg_first_slot (gr_segment *pSeg)
 
const gr_slotgr_seg_last_slot (gr_segment *pSeg)
 
float gr_seg_justify (gr_segment *pSeg, const gr_slot *pSlot, const gr_font *pFont, double width, enum gr_justFlags flags, const gr_slot *pFirst, const gr_slot *pLast)
 

Function Documentation

◆ gr_count_unicode_characters()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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().