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


C++ FTFont::BBox方法代码示例

本文整理汇总了C++中FTFont::BBox方法的典型用法代码示例。如果您正苦于以下问题:C++ FTFont::BBox方法的具体用法?C++ FTFont::BBox怎么用?C++ FTFont::BBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FTFont的用法示例。


在下文中一共展示了FTFont::BBox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

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

示例2: process_lines

 int process_lines()
 {
   if (!ftfont) return 0;
   vsx_string<>deli = "\n";
   vsx_nw_vector< vsx_string<> > t_lines;
   vsx_string_helper::explode(text_in->get(), deli, t_lines);
   lines.clear();
   for (unsigned long i = 0; i < t_lines.size(); ++i)
   {
     float x1, y1, z1, x2, y2, z2;
     lines[i].string = t_lines[i];
     ftfont->BBox(t_lines[i].c_str(), x1, y1, z1, x2, y2, z2);
     lines[i].size_x = x2 - x1;
     lines[i].size_y = y2 - y1;
   }
   return 1;
 }
开发者ID:vovoid,项目名称:vsxu,代码行数:17,代码来源:main_render.text.cpp

示例3: AudicleFTGLFont

    AudicleFTGLFont( char * name ) { 
        
        glEnable ( GL_TEXTURE_2D );
        
        char fontlocation[512];
        strncpy ( fontlocation, fontpath, 512 );
        strncat ( fontlocation, name, 512 - strlen ( fontlocation ) );
        
        m_font = new FTGLTextureFont ( fontlocation );
        
        if ( m_font->Error() ) { 
            fprintf(stderr, "AudicleFTGLFont: font load error %d - exiting\n", m_font->Error() );
            exit(1);
        }
        else { 
            
        if ( !m_font->FaceSize(18) ) { 
            fprintf(stderr, "AudicleFTGLFont: font size error  %d - exiting\n", m_font->Error() );
            exit(1);
        }

        m_name = name;
        m_font->Depth(2);
        m_font->CharMap(ft_encoding_unicode);
    
        glDisable ( GL_TEXTURE_2D );
        
        float x1, y1, z1, x2, y2, z2;
        
        m_font->BBox( samplestring , x1, y1, z1, x2, y2, z2);
        m_height = y2;
        m_line_height = m_font->LineHeight();
        
        m_height_unit_scale = 1.0 / m_height ;
        m_line_unit_scale = 1.0 / m_line_height ;
        m_mono_width = m_height; 

        }
    }
开发者ID:ccrma,项目名称:audicle,代码行数:39,代码来源:audicle_font.cpp

示例4: adjustVolume

void FTGLText::adjustVolume(Volume & volume)
{
    FTGLFontPtr font = getFont();
    
    if(font == NullFC)
    {
        FWARNING(("FTGLText::adjustVolume: no font set!\n"));
        return;
    }

    FTFont *f = font->_fonts[NULL];
    if(f == NULL)
    {
        font->handleGL(NULL, Window::reinitialize);
        f = font->_fonts[NULL];
    }
    
    volume.setValid();
    volume.setEmpty();

    volume.extendBy(getPosition());
    
    float x1, y1, z1, x2, y2, z2, px, py, pz;
    f->BBox(getText().c_str(), x1, y1, z1, x2, y2, z2);

    px = getPosition()[0];
    py = getPosition()[1];
    pz = getPosition()[2];
    
    volume.extendBy(Pnt3f(px + x1, py + y1, pz + z1));
    volume.extendBy(Pnt3f(px + x2, py + y1, pz + z1));
    volume.extendBy(Pnt3f(px + x1, py + y2, pz + z1));
    volume.extendBy(Pnt3f(px + x2, py + y2, pz + z1));
    volume.extendBy(Pnt3f(px + x1, py + y1, pz + z2));
    volume.extendBy(Pnt3f(px + x2, py + y1, pz + z2));
    volume.extendBy(Pnt3f(px + x1, py + y2, pz + z2));
    volume.extendBy(Pnt3f(px + x2, py + y2, pz + z2));
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:38,代码来源:OSGFTGLText.cpp


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