1,295
edits
No edit summary |
|||
| Line 20: | Line 20: | ||
*/ | */ | ||
class gfxTextRun { | class gfxTextRun { | ||
// these do not copy the text. it is the caller's | // these constructors do not copy the text. it is the caller's | ||
// the text alive during the lifetime of the text run. | // responsibility to keep the text alive during the lifetime of the text run. | ||
// ASCII must be genuine ASCII text, i.e., all values less than 128. | |||
gfxTextRun(const char* ASCII, int length, nsFontMetrics* font, PRBool RTL, nsIAtom* language, gfxContext* referenceContext); | gfxTextRun(const char* ASCII, int length, nsFontMetrics* font, PRBool RTL, nsIAtom* language, gfxContext* referenceContext); | ||
gfxTextRun(const PRUnichar* unicode, int length, nsFontMetrics* font, PRBool RTL, nsIAtom* language, gfxContext* referenceContext); | gfxTextRun(const PRUnichar* unicode, int length, nsFontMetrics* font, PRBool RTL, nsIAtom* language, gfxContext* referenceContext); | ||
| Line 52: | Line 54: | ||
void SetSpacing(gfxFloat* spacingArray); | void SetSpacing(gfxFloat* spacingArray); | ||
// The substring must not contain any partial clusters. | // The substring must not contain any partial clusters. The | ||
// | // baseline of the visually left edge of the visually leftmost cluster | ||
void Draw(gfxContext* ctx | // is drawn at the context's current point. (That is, the substring's | ||
// xOffset is NOT used.) | |||
void Draw(gfxContext* ctx, int pos, int len); | |||
// The substring must not contain any partial clusters. | // The substring must not contain any partial clusters. The | ||
// | // baseline of the visually left edge of the visually leftmost cluster | ||
// is drawn at the context's current point. (That is, the substring's | |||
// xOffset is NOT used.) | |||
// The outlines of the characters are added to the current path. | // The outlines of the characters are added to the current path. | ||
void AddToPath(gfxContext* ctx | void AddToPath(gfxContext* ctx, int pos, int len); | ||
struct Dimensions { | struct Dimensions { | ||
// advance of substring start from the origin of the whole | // left-to-right advance of substring start from the origin of the whole | ||
// always | // string, always non-negative regardless of RTL. If 'pos' is zero then | ||
// xOffset is zero. | |||
gfxFloat xOffset; | gfxFloat xOffset; | ||
// advance of the substring, always | // left-to-right advance width of the substring, always non-negative | ||
gfxFloat | // regardless of RTL | ||
gfxFloat advanceWidth; | |||
// font ascent and descent for this substring, both always positive | // font ascent and descent for this substring, both always positive | ||
gfxFloat ascent, descent; | gfxFloat ascent, descent; | ||
// the bounding box of area actually rendered by the glyphs in the | // the bounding box of area actually rendered by the glyphs in the | ||
// substring, relative to the | // substring, relative to the left end of the baseline of the whole string; | ||
// if this can't be accurately determined, then at least this must contain | |||
// | // the true bounding box. This box encodes left and right bearing | ||
// information. | |||
gfxRect boundingBox; | gfxRect boundingBox; | ||
}; | }; | ||
| Line 98: | Line 107: | ||
// character visually to the right. If the point is before the start of | // character visually to the right. If the point is before the start of | ||
// the string, return -1. If the point is beyond the end of the string, | // the string, return -1. If the point is beyond the end of the string, | ||
// return the full string length. | // return the full string length. Apart from those cases, the character | ||
// returned will always be the first character of a cluster. | |||
int GetPositionInString(gfxPoint& pt, PRBool preferLeft); | int GetPositionInString(gfxPoint& pt, PRBool preferLeft); | ||
}; | }; | ||
edits