本文整理汇总了C++中FontPtr::setAntialiasColour方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPtr::setAntialiasColour方法的具体用法?C++ FontPtr::setAntialiasColour怎么用?C++ FontPtr::setAntialiasColour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPtr
的用法示例。
在下文中一共展示了FontPtr::setAntialiasColour方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseAttribute
//.........这里部分代码省略.........
if (params.size() != 2)
{
logBadAttrib(line, pFont);
return;
}
// Set
pFont->setSource(params[1]);
}
else if (attrib == "glyph")
{
// Check params
if (params.size() != 6)
{
logBadAttrib(line, pFont);
return;
}
// Set
// Support numeric and character glyph specification
Font::CodePoint cp;
if (params[1].at(0) == 'u' && params[1].size() > 1)
{
// Unicode glyph spec
String trimmed = params[1].substr(1);
cp = StringConverter::parseUnsignedInt(trimmed);
}
else
{
// Direct character
cp = params[1].at(0);
}
pFont->setGlyphTexCoords(
cp,
StringConverter::parseReal(params[2]),
StringConverter::parseReal(params[3]),
StringConverter::parseReal(params[4]),
StringConverter::parseReal(params[5]), 1.0 ); // assume image is square
}
else if (attrib == "size")
{
// Check params
if (params.size() != 2)
{
logBadAttrib(line, pFont);
return;
}
// Set
pFont->setTrueTypeSize(
StringConverter::parseReal(params[1]));
}
else if (attrib == "character_spacer")
{
// Check params
if (params.size() != 2)
{
logBadAttrib(line, pFont);
return;
}
// Set
pFont->setCharacterSpacer(
StringConverter::parseUnsignedInt(params[1]));
}
else if (attrib == "resolution")
{
// Check params
if (params.size() != 2)
{
logBadAttrib(line, pFont);
return;
}
// Set
pFont->setTrueTypeResolution(
(uint)StringConverter::parseReal(params[1]) );
}
else if (attrib == "antialias_colour")
{
// Check params
if (params.size() != 2)
{
logBadAttrib(line, pFont);
return;
}
// Set
pFont->setAntialiasColour(StringConverter::parseBool(params[1]));
}
else if (attrib == "code_points")
{
for (size_t c = 1; c < params.size(); ++c)
{
String& item = params[c];
StringVector itemVec = StringUtil::split(item, "-");
if (itemVec.size() == 2)
{
pFont->addCodePointRange(Font::CodePointRange(
StringConverter::parseUnsignedInt(itemVec[0]),
StringConverter::parseUnsignedInt(itemVec[1])));
}
}
}
}
示例2: parseAttribute
void FontTranslator::parseAttribute(ScriptCompiler* compiler, FontPtr& pFont,
PropertyAbstractNode* prop)
{
String& attrib = prop->name;
String val;
if (attrib == "glyph")
{
float coords[4];
if (prop->values.size() != 5 || !getString(prop->values.front(), &val) ||
!getFloats(++prop->values.begin(), prop->values.end(), coords, 4))
{
compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
return;
}
// Set
// Support numeric and character glyph specification
Font::CodePoint cp;
if (val.size() > 1 && val[0] == 'u')
{
// Unicode glyph spec
String trimmed = val.substr(1);
cp = StringConverter::parseUnsignedInt(trimmed);
}
else
{
// Direct character
cp = val[0];
}
pFont->setGlyphTexCoords(cp, coords[0], coords[1], coords[2], coords[3],
1.0); // assume image is square
}
else if (attrib == "antialias_colour")
{
bool flag;
if (prop->values.empty() || !getBoolean(prop->values.front(), &flag))
{
compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
return;
}
pFont->setAntialiasColour(flag);
}
else if (attrib == "code_points")
{
if (prop->values.empty())
{
compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
return;
}
for (auto& v : prop->values)
{
bool succ = getString(v, &val);
StringVector itemVec = StringUtil::split(val, "-");
if (succ && itemVec.size() == 2)
{
pFont->addCodePointRange(
Font::CodePointRange(StringConverter::parseUnsignedInt(itemVec[0]),
StringConverter::parseUnsignedInt(itemVec[1])));
}
}
}
else if (prop->values.empty() || !getString(prop->values.front(), &val) ||
!pFont->setParameter(attrib, val))
{
compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
}
}