Reviewed by Steve.
Added a new text drawing method that allows caller to override the font smoothing level.
* WebKit.vcproj/WebKit.def:
* WebKit.vcproj/WebKit_debug.def:
* WebKitGraphics.cpp:
(WebDrawText):
* WebKitGraphics.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24553
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-07-23 Ada Chan <adachan@apple.com>
+
+ Reviewed by Steve.
+
+ Added a new text drawing method that allows caller to override the font smoothing level.
+
+ * WebKit.vcproj/WebKit.def:
+ * WebKit.vcproj/WebKit_debug.def:
+ * WebKitGraphics.cpp:
+ (WebDrawText):
+ * WebKitGraphics.h:
+
2007-07-22 Adam Roben <aroben@apple.com>
Implement IDOMElement::setAttribute
WebLocalizedLPCTSTR
SetWebLocalizedStringMainBundle
DrawTextAtPoint
+ WebDrawText
FontMetrics
TextFloatWidth
CenterTruncateStringToWidth
WebLocalizedLPCTSTR
SetWebLocalizedStringMainBundle
DrawTextAtPoint
+ WebDrawText
FontMetrics
TextFloatWidth
CenterTruncateStringToWidth
#include <CoreGraphics/CoreGraphics.h>
#pragma warning(pop)
-#include <windows.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
using namespace WebCore;
WebCoreDrawTextAtPoint(context, drawString, point, makeFont(description), textColor, underlinedIndex);
}
+void WebDrawText(WebTextRenderInfo* info)
+{
+ if (!info || info->structSize != sizeof(WebTextRenderInfo) || !info->cgContext || !info->description)
+ return;
+
+ int oldFontSmoothingLevel = -1;
+ if (info->overrideSmoothingLevel >= 0) {
+ oldFontSmoothingLevel = wkGetFontSmoothingLevel();
+ wkSetFontSmoothingLevel(info->overrideSmoothingLevel);
+ }
+
+ DrawTextAtPoint(info->cgContext, info->text, info->length, info->pt, *(info->description), info->color, info->underlinedIndex, info->drawAsPassword);
+
+ if (info->overrideSmoothingLevel >= 0)
+ wkSetFontSmoothingLevel(oldFontSmoothingLevel);
+}
+
float TextFloatWidth(LPCTSTR text, int length, const WebFontDescription& description)
{
return WebCoreTextFloatWidth(String(text, length), makeFont(description));
#ifndef WebKitGraphics_h
#define WebKitGraphics_h
+#include <windows.h>
+
typedef struct CGColor* CGColorRef;
typedef struct CGContext* CGContextRef;
-typedef struct tagPOINT POINT;
typedef wchar_t WCHAR;
typedef __nullterminated const WCHAR* LPCWSTR;
bool italic;
};
+struct WebTextRenderInfo
+{
+ DWORD structSize;
+ CGContextRef cgContext;
+ LPCTSTR text;
+ int length;
+ POINT pt;
+ const WebFontDescription* description;
+ CGColorRef color;
+ int underlinedIndex;
+ bool drawAsPassword;
+ int overrideSmoothingLevel; // pass in -1 if caller does not want to override smoothing level
+};
+
void DrawTextAtPoint(CGContextRef, LPCTSTR text, int length, POINT, const WebFontDescription&, CGColorRef, int underlinedIndex = -1, bool drawAsPassword = false);
+void WebDrawText(WebTextRenderInfo*);
float TextFloatWidth(LPCTSTR text, int length, const WebFontDescription&);
void FontMetrics(const WebFontDescription&, int* ascent, int* descent, int* lineSpacing);