本文整理汇总了C++中FTBBox类的典型用法代码示例。如果您正苦于以下问题:C++ FTBBox类的具体用法?C++ FTBBox怎么用?C++ FTBBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FTBBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FTPoint
ofRectangle ofxFTGLFont::getStringBoundingBox(wstring s, float x, float y){
if(loaded){
FTBBox bbox = font->BBox((wchar_t*)s.c_str(), -1, FTPoint(), trackingPoint);
return ofRectangle(x, y-getAscender(), abs(bbox.Lower().Xf()-bbox.Upper().Xf()), abs(bbox.Upper().Yf()-bbox.Lower().Yf()));
}
return ofRectangle();
}
示例2: getStringBoundingBox
ofRectangle ofxFTGLESFont::getStringBoundingBox(wstring s, float x, float y){
if(loaded){
FTBBox bbox = font->BBox((wchar_t*)s.c_str());
return ofRectangle(x + bbox.Lower().Xf(), y + bbox.Lower().Yf(), bbox.Upper().Xf(), bbox.Upper().Yf());
}
return ofRectangle();
}
示例3: ftglGetGlyphBBox
void ftglGetGlyphBBox(FTGLglyph *g, float bounds[6])
{
FTBBox ret = _ftglGetGlyphBBox(g);
FTPoint lower = ret.Lower(), upper = ret.Upper();
bounds[0] = lower.Xf(); bounds[1] = lower.Yf(); bounds[2] = lower.Zf();
bounds[3] = upper.Xf(); bounds[4] = upper.Yf(); bounds[5] = upper.Zf();
}
示例4: ftglGetFontBBox
void ftglGetFontBBox(FTGLfont *f, const char* s, int len, float c[6])
{
FTBBox ret = _ftglGetFontBBox(f, s, len);
FTPoint lower = ret.Lower(), upper = ret.Upper();
c[0] = lower.Xf(); c[1] = lower.Yf(); c[2] = lower.Zf();
c[3] = upper.Xf(); c[4] = upper.Yf(); c[5] = upper.Zf();
}
示例5: ss
void Font::render(const vec3& pos, const std::string& text) const {
if (simpleLayout_) {
float delta = 0;
std::string line;
std::stringstream ss(text);
std::getline(ss, line);
FTPoint point(static_cast<double>(pos.x),
static_cast<double>(pos.y),
static_cast<double>(pos.z));
FTBBox box = font_->BBox(line.c_str(), -1, point);
delta -= box.Upper().Yf() - box.Lower().Yf(); // height of first line
Bounds bounds = getBounds(pos, text);
float height = bounds.getURB().y - bounds.getLLF().y;
switch(vAlign_) {
case Font::Top:
delta += height;
break;
case Font::Middle:
delta += height * 0.5f;
break;
case Font::Bottom:
break;
}
vec3 dpos = vec3(pos.x, pos.y + delta, pos.z);
glPushMatrix();
glRasterPos3f(dpos.x, dpos.y, dpos.z);
glTranslatef(dpos.x, dpos.y, dpos.z);
simpleLayout_->Render(text.c_str(), -1, FTPoint(dpos.x, dpos.y, dpos.z));
glPopMatrix();
}
}
示例6: while
void FTFont::BBox( const wchar_t* string,
float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
{
FTBBox totalBBox;
if((NULL != string) && ('\0' != *string))
{
const wchar_t* c = string;
float advance = 0;
if(CheckGlyph( *c))
{
totalBBox = glyphList->BBox( *c);
advance = glyphList->Advance( *c, *(c + 1));
}
while( *++c)
{
if(CheckGlyph( *c))
{
FTBBox tempBBox = glyphList->BBox( *c);
tempBBox.Move( FTPoint( advance, 0.0f, 0.0f));
totalBBox += tempBBox;
advance += glyphList->Advance( *c, *(c + 1));
}
}
}
llx = totalBBox.lowerX;
lly = totalBBox.lowerY;
llz = totalBBox.lowerZ;
urx = totalBBox.upperX;
ury = totalBBox.upperY;
urz = totalBBox.upperZ;
}
示例7: ftgGetlLayoutBBox
void ftgGetlLayoutBBox(FTGLlayout *l, const char * s, float c[6])
{
FTBBox ret = _ftgGetlLayoutBBox(l, s);
FTPoint lower = ret.Lower(), upper = ret.Upper();
c[0] = lower.Xf(); c[1] = lower.Yf(); c[2] = lower.Zf();
c[3] = upper.Xf(); c[4] = upper.Yf(); c[5] = upper.Zf();
}
示例8: CheckGlyph
void FTFont::BBox( const char* string,
float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
{
FTBBox totalBBox;
if((NULL != string) && ('\0' != *string))
{
const unsigned char* c = (unsigned char*)string;
CheckGlyph( *c);
totalBBox = glyphList->BBox( *c);
float advance = glyphList->Advance( *c, *(c + 1));
++c;
while( *c)
{
CheckGlyph( *c);
FTBBox tempBBox = glyphList->BBox( *c);
tempBBox.Move( FTPoint( advance, 0.0f, 0.0f));
totalBBox += tempBBox;
advance += glyphList->Advance( *c, *(c + 1));
++c;
}
}
llx = totalBBox.lowerX;
lly = totalBBox.lowerY;
llz = totalBBox.lowerZ;
urx = totalBBox.upperX;
ury = totalBBox.upperY;
urz = totalBBox.upperZ;
}
示例9: FTPoint
ofRectangle ofxFTGLFont::getStringBoundingBox(const wstring& s, float x, float y){
if(loaded){
FTBBox bbox = font->BBox((wchar_t*)s.c_str(), -1, FTPoint(), trackingPoint);
return ofRectangle(x + bbox.Lower().Xf(), y + bbox.Lower().Yf(), bbox.Upper().Xf(), bbox.Upper().Yf());
}
return ofRectangle();
}
示例10: getFTFont
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;
}
示例11: getDimensions
Vector2f Textprinter::getDimensions(const string& str) {
const char *text = str.c_str();
FTBBox test = fonts[0]->BBox(text);
Vector2f v(test.Upper().X(), test.Upper().Y());
return v;
}
示例12: getWidth
float FXFont::getWidth(const std::string & text) const{
FTBBox bb = ft->BBox(text.c_str());
float width = (bb.Upper().X() - bb.Lower().X());
return width;
}
示例13: getStringBoundingBox
ofRectangle ofxFTGLSimpleLayout::getStringBoundingBox(string s, float x, float y)
{
if (loaded) {
FTBBox bbox = layout->BBox(s.c_str());
return ofRectangle(x + bbox.Lower().Xf(), y + bbox.Lower().Yf(), bbox.Upper().Xf(), bbox.Upper().Yf());
}
return ofRectangle();
}
示例14: MeasureText
Gwen::Point Chowdren::MeasureText( Gwen::Font* pFont,
const Gwen::UnicodeString & text )
{
FTSimpleLayout layout;
layout.SetLineLength(10000);
layout.SetFont(get_font(pFont->size));
FTBBox bbox = layout.BBox(text.c_str());
FTPoint size = bbox.Upper() - bbox.Lower();
return Gwen::Point((int)ceil(size.X()), (int)ceil(size.Y()));
}
示例15: va_start
unsigned int Textprinter::getWidth(const char *fmt, ...) {
va_list ap; /* our argument pointer */
char text[256];
va_start(ap, fmt); /* make ap point to first unnamed arg */
/* FIXME: we *should* do boundschecking or something to prevent buffer
* overflows/segmentations faults
*/
vsprintf(text, fmt, ap);
FTBBox test = fonts[0]->BBox(text);
return test.Upper().X();
}