FontCairoHarfbuzzNG.cpp [plain text]
#include "config.h"
#include "Font.h"
#include "GraphicsContext.h"
#include "HarfBuzzShaper.h"
#include "Logging.h"
#include "NotImplemented.h"
#include "PlatformContextCairo.h"
#include "SimpleFontData.h"
#include <cairo.h>
namespace WebCore {
void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int, int) const
{
GlyphBuffer glyphBuffer;
HarfBuzzShaper shaper(this, run);
if (shaper.shape(&glyphBuffer))
drawGlyphBuffer(context, run, glyphBuffer, point);
else
LOG_ERROR("Shaper couldn't shape glyphBuffer.");
}
void Font::drawEmphasisMarksForComplexText(GraphicsContext* , const TextRun& , const AtomicString& , const FloatPoint& , int , int ) const
{
notImplemented();
}
bool Font::canReturnFallbackFontsForComplexText()
{
return false;
}
bool Font::canExpandAroundIdeographsInComplexText()
{
return false;
}
float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape())
return shaper.totalWidth();
LOG_ERROR("Shaper couldn't shape text run.");
return 0;
}
int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape())
return shaper.offsetForPosition(x);
LOG_ERROR("Shaper couldn't shape text run.");
return 0;
}
FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape())
return shaper.selectionRect(point, h, from, to);
LOG_ERROR("Shaper couldn't shape text run.");
return FloatRect();
}
}