Mozilla2:GFXTextRun: Difference between revisions
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
[http://lxr.mozilla.org/mozilla/source/gfx/thebes/public/gfxTextRun.h gfxTextRun.h] | [http://lxr.mozilla.org/mozilla/source/gfx/thebes/public/gfxTextRun.h gfxTextRun.h] | ||
<pre> | |||
class gfxTextRun { | |||
// these do not copy the text | |||
gfxTextRun(const char* ASCII, int length, nsIFontMetrics* font, nsIAtom* language); | |||
gfxTextRun(const PRUnichar* unicode, int length, nsIFontMetrics* font, nsIAtom* language); | |||
enum { ClusterStart = 0x1 } CharFlags; | |||
// ClusterStart: character is the first character of a cluster | |||
void GetCharacterFlags(int pos, int len, CharFlags* flags); | |||
struct Dimensions { | |||
gfxFloat ascent, descent, width, leftBearing, rightBearing; | |||
}; | |||
Dimensions MeasureText(int pos, int len); | |||
// Compute how many characters from this string starting at | |||
// character 'pos' and up to length 'len' fit | |||
// into the given width. 'breakflags' indicates our | |||
// preferences about where we allow breaks. | |||
// We will usually want to call MeasureText right afterwards, | |||
// the implementor could optimize for that. | |||
int GetCharsFit(int pos, int len, gfxFloat width, int breakflags); | |||
int GetPositionInString(gfxPoint& pt); | |||
}; | |||
</pre> | |||
See [[Gecko2:NewTextAPI]] | See [[Gecko2:NewTextAPI]] | ||
Revision as of 23:54, 11 October 2005
Class gfxTextRun
class gfxTextRun {
// these do not copy the text
gfxTextRun(const char* ASCII, int length, nsIFontMetrics* font, nsIAtom* language);
gfxTextRun(const PRUnichar* unicode, int length, nsIFontMetrics* font, nsIAtom* language);
enum { ClusterStart = 0x1 } CharFlags;
// ClusterStart: character is the first character of a cluster
void GetCharacterFlags(int pos, int len, CharFlags* flags);
struct Dimensions {
gfxFloat ascent, descent, width, leftBearing, rightBearing;
};
Dimensions MeasureText(int pos, int len);
// Compute how many characters from this string starting at
// character 'pos' and up to length 'len' fit
// into the given width. 'breakflags' indicates our
// preferences about where we allow breaks.
// We will usually want to call MeasureText right afterwards,
// the implementor could optimize for that.
int GetCharsFit(int pos, int len, gfxFloat width, int breakflags);
int GetPositionInString(gfxPoint& pt);
};