[haiku-webkit-commits] r312 - webkit/trunk/WebCore/platform/graphics/haiku

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Mon, 15 Mar 2010 16:49:35 +0000

Author: stippi
Date: Mon Mar 15 16:49:35 2010
New Revision: 312
URL: http://mmlr.dyndns.org/changeset/312

Log:
Modified to use the new DrawString() with offsets per glyph, so that justified
text and other stuff (CSS spacing) works again.

Modified:
   webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp

Modified: webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp
==============================================================================
--- webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp  Sun Mar 14 
23:23:38 2010        (r311)
+++ webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp  Mon Mar 15 
16:49:35 2010        (r312)
@@ -64,8 +64,16 @@
     view->SetFont(font->platformData().font());
 
     GlyphBufferGlyph* glyphs = 
const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from));
-    CString converted = UTF8Encoding().encode((const UChar *)glyphs, 
numGlyphs, URLEncodedEntitiesForUnencodables);
-    view->DrawString(converted.data(), converted.length(), BPoint(point.x(), 
point.y()));
+    CString converted = UTF8Encoding().encode((const UChar*)glyphs, numGlyphs, 
URLEncodedEntitiesForUnencodables);
+       BPoint offsets[numGlyphs];
+       float offset = point.x();
+    for (int i = 0; i < numGlyphs; i++) {
+        offsets[i].x = offset;
+        offsets[i].y = point.y();
+        offset += glyphBuffer.advanceAt(from + i);
+    }
+
+    view->DrawString(converted.data(), converted.length(), offsets, numGlyphs);
 
     view->SetHighColor(oldColor);
     view->SetDrawingMode(oldMode);

Other related posts: