This source file includes following definitions.
- fontDataForCharacter
- containsCharacter
- isCustomFont
- isLoading
- isLoadingFallback
- isSegmented
- shouldSkipDrawing
- description
#include "config.h"
#include "platform/fonts/SegmentedFontData.h"
#include "platform/fonts/SimpleFontData.h"
#include "wtf/Assertions.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
SegmentedFontData::~SegmentedFontData()
{
GlyphPageTreeNode::pruneTreeCustomFontData(this);
}
const SimpleFontData* SegmentedFontData::fontDataForCharacter(UChar32 c) const
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
if (it->from() <= c && it->to() >= c)
return it->fontData().get();
}
return m_ranges[0].fontData().get();
}
bool SegmentedFontData::containsCharacter(UChar32 c) const
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
if (c >= it->from() && c <= it->to())
return true;
}
return false;
}
bool SegmentedFontData::isCustomFont() const
{
return true;
}
bool SegmentedFontData::isLoading() const
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
if (it->fontData()->isLoading())
return true;
}
return false;
}
bool SegmentedFontData::isLoadingFallback() const
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
if (it->fontData()->isLoadingFallback())
return true;
}
return false;
}
bool SegmentedFontData::isSegmented() const
{
return true;
}
bool SegmentedFontData::shouldSkipDrawing() const
{
Vector<FontDataRange>::const_iterator end = m_ranges.end();
for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
if (it->fontData()->shouldSkipDrawing())
return true;
}
return false;
}
#ifndef NDEBUG
String SegmentedFontData::description() const
{
return "[segmented font]";
}
#endif
}