当前位置: 首页>>代码示例>>C++>>正文


C++ FTBBox类代码示例

本文整理汇总了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();
}
开发者ID:alangrizek,项目名称:ofxFTGL,代码行数:7,代码来源:ofxFTGLFont.cpp

示例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();
}
开发者ID:fishkingsin,项目名称:ofxFTGLES,代码行数:7,代码来源:ofxFTGLESFont.cpp

示例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();
}
开发者ID:Felipeasg,项目名称:workbench,代码行数:7,代码来源:FTGlyphGlue.cpp

示例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();
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:7,代码来源:FTFontGlue.cpp

示例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();
    }
}
开发者ID:151706061,项目名称:Voreen,代码行数:33,代码来源:font.cpp

示例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;
}
开发者ID:Gi133,项目名称:NetworkingCoursework,代码行数:35,代码来源:FTFont.cpp

示例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();
}
开发者ID:hsmith,项目名称:ftgl,代码行数:7,代码来源:FTLayoutGlue.cpp

示例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;
}
开发者ID:CJFocke,项目名称:vsxu,代码行数:33,代码来源:FTFont.cpp

示例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();
}
开发者ID:prisonerjohn,项目名称:ofxFTGL,代码行数:7,代码来源:ofxFTGLFont.cpp

示例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;
}
开发者ID:AdRiley,项目名称:mapserver,代码行数:28,代码来源:mapoglrenderer.cpp

示例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;
}
开发者ID:automenta,项目名称:crittergod1.5,代码行数:7,代码来源:textprinter.cpp

示例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;
}
开发者ID:ArondeParon,项目名称:Logstalgia,代码行数:7,代码来源:fxfont.cpp

示例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();
}
开发者ID:prisonerjohn,项目名称:ofxFTGL,代码行数:8,代码来源:ofxFTGLSimpleLayout.cpp

示例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()));
 }
开发者ID:joaormatos,项目名称:anaconda,代码行数:10,代码来源:GwenChowdrenRender.cpp

示例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();
}
开发者ID:automenta,项目名称:crittergod1.5,代码行数:12,代码来源:textprinter.cpp


注:本文中的FTBBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。