struct LineFormatDesc { const wchar_t* pParaText; UPInt ParaTextLen; const float* pWidths; UPInt LineStartPos; UPInt NumCharsInLine; float VisibleRectWidth; float CurrentLineWidth; float LineWidthBeforeWordWrap; float DashSymbolWidth; enum { Align_Left = 0, Align_Right = 1, Align_Center = 2, Align_Justify = 3 }; UInt8 Alignment; UPInt ProposedWordWrapPoint; bool UseHyphenation; };
LineFormatDesc provides information of the line text to be formatted like the length of the text, text position etc. This structure is mainly used by OnWordWrapping to control word wrapping of the text.
Note that all members of LineFormatDesc marked as "[in]" are used as input values only and shouldn't be modified. Members marked as "[out]" or "[in, out]" might be modified.
Members |
Description |
const wchar_t* pParaText; |
[in], text of the current paragraph, wide-characters are used. |
UPInt ParaTextLen; |
Length of the paragraph text, in characters, [in]. |
const float* pWidths; |
[in] an array of line widths, in pixels, before the character at the corresponding index. The size of the array is NumCharsInLine + 1. Note, this is not the array of character widths. For example, there is a line that contains three characters: ABC. The NumCharInLine will be equal 3, the size of the pWidths will be 4; the pWidth[0] will be always 0 (since there are no characters before the A), the pWidth[1] will contain width of A symbol, pWidths[2] will contain width of A PLUS width of B, and, finally, pWidths[3] will contain total width of the line (width of A PLUS width of B PLUS width of C). |
UPInt LineStartPos; |
[in], the text position of the first character in line. ParaTextLen[LineStartPos] might be used to get the value of this character. |
UPInt NumCharsInLine; |
Number of characters currently in the line, [in]. |
float VisibleRectWidth; |
[in], width, in pixels, of client rectangle. This width might be used in calculation of word wrapping position: the total width of line should not exceed this width. |
float CurrentLineWidth; |
Current line width, in pixels, [in]. |
float LineWidthBeforeWordWrap; |
[in], line width before the ProposedWordWrapPoint, in pixels. For example, if line is ABC DEF and ProposedWordWrapPoint = 3 (space) then LineWidthBeforeWordWrap will contain the width of ABC (w/o space) part of the line. |
float DashSymbolWidth; |
[in], supplementary member, width of the hyphen symbol, in pixels. It might be used to calculate hyphenation. |
UInt8 Alignment; |
Alignment of the line, [in]. |
UPInt ProposedWordWrapPoint; |
[in,out], an index in the line of the proposed word wrap position. For example, if the line text is "ABC DEF" and only "ABC DE" fits in VisibleRectWidth then the ProposedWordWrapPoint will be equal to 3. Note, this is the index in line, not in text (pParaText), not in line. Use LineStartPos to calculate the proposed word wrapping position in the text. The user's OnWordWrapping method should change this member if it is necessary to change the word wrapping position according to custom rules. |
bool UseHyphenation; |
[out], the OnWordWrapping method may set this to true to indicate to put hyphen symbol at the word-wrapping position. This might be useful for implementing hyphenation. |
GFx_Loader.h