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 applyRounding:1;
unsigned attemptFontSubstitution:1;
};
struct WebCoreTextRun
{
const UniChar *characters;
unsigned int length;
int from;
int to;
};
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WebCoreTextRun WebCoreTextRun;
typedef struct WebCoreTextStyle WebCoreTextStyle;
extern void WebCoreInitializeTextRun(WebCoreTextRun *run, const UniChar *characters, unsigned int length, int from, int to);
extern void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style);
#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 atPoint:(NSPoint)point;
- (void)drawHighlightForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style atPoint:(NSPoint)point;
- (void)drawLineForCharacters:(NSPoint)point yOffset:(float)yOffset withWidth:(int)width withColor:(NSColor *)color;
- (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed;
@end