Skip to content

Commit

Permalink
Simple implementation of complex text rendering.
Browse files Browse the repository at this point in the history
Just call BView::DrawString and BFont::StringWidth. This gets at least
the most obvious cases working.

Fixes #7053.
  • Loading branch information
pulkomandy committed Dec 16, 2013
1 parent b0c5e58 commit 8ed0d37
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions Source/WebCore/platform/graphics/haiku/FontHaiku.cpp
Expand Up @@ -89,26 +89,38 @@ bool Font::canExpandAroundIdeographsInComplexText()
return false;
}

/* the "complex" text is used for text-rendering: optimizeLegibility, and other
* cases such as SVG text. Other platforms use HarfBuzz for layouting the text,
* but we should handle this all on BView size and make use of
* ICU LayoutEngine - once properly integrated in the BeAPI, that is.
*
* For now, we just call the usual DrawString method. It's better to at least
* try displaying something.
*/
void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point,
int from, int to) const
{
notImplemented();
BView* view = ctx->platformContext();
view->SetFont(primaryFont()->platformData().font());
view->DrawString(run.string().utf8().data() + from, to - from + 1, point);
}


float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
notImplemented();
return 0;
const BFont* font = primaryFont()->platformData().font();
ASSERT(font);
float width = font->StringWidth(run.string().utf8().data());
return width;
}

FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const
FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint&, int, int, int) const
{
notImplemented();
return FloatRect();
}

int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const
int Font::offsetForPositionForComplexText(const TextRun& run, float, bool) const
{
notImplemented();
return 0;
Expand Down

2 comments on commit 8ed0d37

@waddlesplash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with the changes to the defs for selectionRectForComplexText and offsetForPositionForComplexText but no changes to the functions themselves? Won't that just cause compiler warnings?

@pulkomandy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. We should implement those someday if we want to be able to select and navigate that text, anway :)

Please sign in to comment.