WebCoreTextRenderer.h [plain text]
#import <Cocoa/Cocoa.h>
#ifndef ROUND_TO_INT
#define ROUND_TO_INT(x) (unsigned int)((x)+.5)
#endif
struct WebCoreTextStyle
{
NSColor *textColor;
NSColor *backgroundColor;
int letterSpacing;
int wordSpacing;
int padding;
NSString **families;
unsigned smallCaps : 1;
unsigned rtl : 1;
unsigned visuallyOrdered : 1;
unsigned applyRunRounding : 1;
unsigned applyWordRounding : 1;
unsigned attemptFontSubstitution : 1;
};
struct WebCoreTextRun
{
const UniChar *characters;
unsigned int length;
int from;
int to;
};
struct WebCoreTextGeometry
{
NSPoint point;
float selectionY;
float selectionHeight;
bool useFontMetricsForSelectionYAndHeight : 1;
};
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WebCoreTextRun WebCoreTextRun;
typedef struct WebCoreTextStyle WebCoreTextStyle;
typedef struct WebCoreTextGeometry WebCoreTextGeometry;
extern void WebCoreInitializeTextRun(WebCoreTextRun *run, const UniChar *characters, unsigned int length, int from, int to);
extern void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style);
extern void WebCoreInitializeEmptyTextGeometry(WebCoreTextGeometry *geometry);
#ifdef __cplusplus
}
#endif
@protocol WebCoreTextRenderer <NSObject>
- (int)ascent;
- (int)descent;
- (int)lineSpacing;
- (float)xHeight;
- (float)floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths:(float *)buffer;
- (void)drawRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style geometry:(const WebCoreTextGeometry *)geometry;
- (void)drawHighlightForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style geometry:(const WebCoreTextGeometry *)geometry;
- (void)drawLineForCharacters:(NSPoint)point yOffset:(float)yOffset width: (int)width color:(NSColor *)color thickness:(float)thickness;
- (void)drawLineForMisspelling:(NSPoint)point withWidth:(int)width;
- (int)misspellingLineThickness;
- (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed includePartialGlyphs:(BOOL)includePartialGlyphs;
@end