本文整理汇总了C++中FTFont::Advance方法的典型用法代码示例。如果您正苦于以下问题:C++ FTFont::Advance方法的具体用法?C++ FTFont::Advance怎么用?C++ FTFont::Advance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FTFont
的用法示例。
在下文中一共展示了FTFont::Advance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kerning
double kerning ( char a, char b ) {
//silly hack.
//kerning = advance ( ab ) - ( advance ( a ) + advance ( b ) )
static char st[7];
double r;
// st = 'ab0a0b0'
st[2] = st[4] = st[6] = 0;
st[0] = st[3] = a;
st[1] = st[5] = b;
r = m_font->Advance ( st );
r -= m_font->Advance ( st+3 );
r -= m_font->Advance ( st+5 );
return r;
}
示例2: getStringBBox
bool OglRenderer::getStringBBox(char *font, double size, char *string, rectObj *rect, double** advances)
{
FTFont* face = getFTFont(font, size);
if (!face) {
msSetError(MS_OGLERR, "Failed to load font (%s).", "OglRenderer::getStringBBox()", font);
return false;
}
float llx =0.0f, lly=0.0f, llz=0.0f, urx=0.0f, ury=0.0f, urz=0.0f;
glPushAttrib( GL_ALL_ATTRIB_BITS );
FTBBox boundingBox = face->BBox(string);
glPopAttrib();
rect->minx = boundingBox.Lower().X();
rect->maxx = boundingBox.Upper().X();
rect->miny = -boundingBox.Upper().Y();
rect->maxy = -boundingBox.Lower().Y();
if (advances) {
int length = strlen(string);
*advances = new double[length];
for (int i = 0; i < length; ++i) {
(*advances)[i] = face->Advance(&string[i], 1);
}
}
return true;
}
示例3: GetStringSize
void Font::GetStringSize(const String &text, Vector2D *result) {
if (mID < 0) {
*result = kFastVector2DZero;
return;
}
FTFont *tf =
(FTFont*)GetCollection()->GetResource(mID)->GetFTFont();
result->mX = tf->Advance(text.GetWString().mData);
result->mY = tf->LineHeight();
}
示例4: length
double length ( const std::string & str ) {
return m_font->Advance ( str.c_str() );
}