1,295
edits
| Line 12: | Line 12: | ||
// ClusterStart: character is the first character of a cluster | // ClusterStart: character is the first character of a cluster | ||
void GetCharacterFlags(int pos, int len, CharFlags* flags); | void GetCharacterFlags(int pos, int len, CharFlags* flags); | ||
void SetWordStartEnd(PRBool startsWord, PRBool endsWord); | |||
void SetLineStartEnd(PRBool startsLine, PRBool endsLine); | |||
// Set the spacing between clusters. For each character index i that is | |||
// the start of a cluster, spacingArray[i] is the amount of space to insert | |||
// before that cluster (possibly negative). For each character index i that | |||
// is not the start of a cluster, spacingArray[i] must be zero. | |||
// spacingArray[0] must be zero. | |||
void SetSpacing(gfxFloat* spacingArray); | |||
// The substring must not contain any partial clusters. 'pt' is the | |||
// the baseline of the visually left edge of the visually leftmost cluster. | |||
void Draw(gfxContext* ctx, gfxPoint& pt, int pos, int len); | |||
struct Dimensions { | struct Dimensions { | ||
gfxFloat ascent, descent, | // start of the substring relative to the origin of the whole string | ||
gfxFloat xOffset; | |||
// width of the substring; | |||
gfxFloat width; | |||
// amount by which the glyphs visually extend to the left of xOffset and | |||
// to the right of xOffset+width | |||
gfxFloat leftBearing, rightBearing; | |||
// font ascent and descent for this substring | |||
gfxFloat ascent, descent; | |||
// visual ascent and descent for this substring (area actually drawn by | |||
// glyphs --- needed for MathML I think) | |||
gfxFloat visualAscent, visualDescent; | |||
}; | }; | ||
// The substring must not contain any partial clusters | |||
Dimensions MeasureText(int pos, int len); | Dimensions MeasureText(int pos, int len); | ||
| Line 24: | Line 50: | ||
// We will usually want to call MeasureText right afterwards, | // We will usually want to call MeasureText right afterwards, | ||
// the implementor could optimize for that. | // the implementor could optimize for that. | ||
// The substring must not contain any partial clusters | |||
int GetCharsFit(int pos, int len, gfxFloat width, int breakflags); | int GetCharsFit(int pos, int len, gfxFloat width, int breakflags); | ||
// If the user clicks the mouse at point pt, | |||
int GetPositionInString(gfxPoint& pt); | int GetPositionInString(gfxPoint& pt); | ||
}; | }; | ||
edits