FontCairoHarfbuzzNG.cpp [plain text]
#include "config.h"
#include "FontCascade.h"
#if USE(CAIRO)
#include "Font.h"
#include "GraphicsContext.h"
#include "HarfBuzzShaper.h"
#include "LayoutRect.h"
#include "Logging.h"
#include "NotImplemented.h"
#include "PlatformContextCairo.h"
#include <cairo.h>
namespace WebCore {
float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, int, int, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot ) const
{
HarfBuzzShaper shaper(this, run);
if (!shaper.shape(&glyphBuffer)) {
LOG_ERROR("Shaper couldn't shape glyphBuffer.");
return 0;
}
return 0;
}
void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& , const TextRun& , const AtomicString& , const FloatPoint& , int , int ) const
{
notImplemented();
}
bool FontCascade::canReturnFallbackFontsForComplexText()
{
return false;
}
bool FontCascade::canExpandAroundIdeographsInComplexText()
{
return false;
}
float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>*, GlyphOverflow*) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape())
return shaper.totalWidth();
LOG_ERROR("Shaper couldn't shape text run.");
return 0;
}
int FontCascade::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;
}
void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape()) {
FloatRect rect = shaper.selectionRect(FloatPoint(selectionRect.location()), selectionRect.height().toInt(), from, to);
selectionRect = LayoutRect(rect);
return;
}
LOG_ERROR("Shaper couldn't shape text run.");
}
}
#endif // USE(CAIRO)