From 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Wed, 17 Dec 2008 18:05:15 -0800 Subject: Code drop from //branches/cupcake/...@124589 --- WebCore/platform/graphics/wx/FontWx.cpp | 36 +++++++-------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) (limited to 'WebCore/platform/graphics/wx/FontWx.cpp') diff --git a/WebCore/platform/graphics/wx/FontWx.cpp b/WebCore/platform/graphics/wx/FontWx.cpp index e94ae3b..07223e9 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 "fontprops.h" -#include #include +#include "fontprops.h" +#include "non-kerned-drawing.h" namespace WebCore { @@ -45,33 +45,11 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo // prepare DC Color color = graphicsContext->fillColor(); -#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(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); + // 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/ for the implementations. + drawTextWithSpacing(graphicsContext, font, color, glyphBuffer, from, numGlyphs, point); } FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const -- cgit v1.1