summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/wx/FontWx.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commit9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch)
treed49911209b132da58d838efa852daf28d516df21 /WebCore/platform/graphics/wx/FontWx.cpp
parent87eb0cb35bad8784770ebc807e6c982432e47107 (diff)
downloadexternal_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip
external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz
external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2
Initial Contribution
Diffstat (limited to 'WebCore/platform/graphics/wx/FontWx.cpp')
-rw-r--r--WebCore/platform/graphics/wx/FontWx.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp
index 07223e9..e94ae3b 100644
--- a/WebCore/platform/graphics/wx/FontWx.cpp
+++ b/WebCore/platform/graphics/wx/FontWx.cpp
@@ -33,9 +33,9 @@
#include "NotImplemented.h"
#include "SimpleFontData.h"
-#include <wx/dcclient.h>
#include "fontprops.h"
-#include "non-kerned-drawing.h"
+#include <wx/defs.h>
+#include <wx/dcclient.h>
namespace WebCore {
@@ -45,11 +45,33 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo
// prepare DC
Color color = graphicsContext->fillColor();
- // We can't use wx drawing methods on Win/Linux because they automatically kern text
- // so we've created a function with platform dependent drawing implementations that
- // will hopefully be folded into wx once the API has solidified.
- // see platform/wx/wxcode/<platform> for the implementations.
- drawTextWithSpacing(graphicsContext, font, color, glyphBuffer, from, numGlyphs, point);
+#if USE(WXGC)
+ wxGCDC* dc = (wxGCDC*)graphicsContext->platformContext();
+ wxFont wxfont = font->getWxFont();
+ if (wxfont.IsOk())
+ dc->SetFont(wxfont);
+ dc->SetTextForeground(color);
+#else
+ wxDC* dc = graphicsContext->platformContext();
+ dc->SetTextBackground(color);
+ dc->SetTextForeground(color);
+ dc->SetFont(font->getWxFont());
+#endif
+
+ // convert glyphs to wxString
+ GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from));
+ int offset = point.x();
+ wxString text = wxEmptyString;
+ for (unsigned i = 0; i < numGlyphs; i++) {
+ text = text.Append((wxChar)glyphs[i]);
+ offset += glyphBuffer.advanceAt(from + i);
+ }
+
+ // the y point is actually the bottom point of the text, turn it into the top
+ float height = font->ascent() - font->descent();
+ wxCoord ypoint = (wxCoord) (point.y() - height);
+
+ dc->DrawText(text, (wxCoord)point.x(), ypoint);
}
FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const