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


C++ FT_Done_FreeType函数代码示例

本文整理汇总了C++中FT_Done_FreeType函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_Done_FreeType函数的具体用法?C++ FT_Done_FreeType怎么用?C++ FT_Done_FreeType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: fprintf

int zaFont::initFont(char * path)
{
    FT_Library library;
    FT_Face face;

    if(FT_Init_FreeType(&library)) {
        fprintf(stderr, "Error loading Freetype library\n");
        return NULL;
    }

    if (FT_New_Face(library,path,0,&face)) {
        fprintf(stderr, "Error loading font %s\n", path);
        return NULL;
    }

	int iCharMapCnt = face->num_charmaps;
	FT_CharMap* pCharMaps = face->charmaps;
	// FT_ULong lang= FT_Get_CMap_Language_ID(*pCharMaps);
	 int ic;
	 for ( ic = 0; ic < iCharMapCnt; ic ++)
	 {
		 if (ic == 0 )
		 {
			 FT_CharMapRec aCharMap = *(pCharMaps[ic]);
			 FT_Encoding enconding = aCharMap.encoding;
			 int platform_id = aCharMap.platform_id;
			 int encoding_id = aCharMap.encoding_id;
//			 this->m_max_x = face->max_advance_width;
//			 this->m_max_y = face->max_advance_height;
			 fprintf(stderr,
					 "initFont "
					 "platform_id %d, "
					 "encoding_id %d "
					 "width %d height %d\n",
					 platform_id,encoding_id,m_max_x,m_max_y);
		 }
	 }
    FT_Done_Face(face);
    FT_Done_FreeType(library);
}
开发者ID:cubezone,项目名称:zaOS,代码行数:40,代码来源:zaFont.cpp

示例2: ExecuteTest

  static void
  ExecuteTest( char*  testfont )
  {
    FT_Library  context;
    FT_Face     face;


    if ( FT_Init_FreeType( &context ) )
    {
      fprintf( stderr, "Can't initialize FreeType.\n" );
      exit( 1 );
    }

    if ( FT_New_Face( context, testfont, 0, &face ) )
    {
      /* The font is erroneous, so if this fails that's ok. */
      exit( 0 );
    }

    if ( face->num_faces == 1 )
      TestFace( face );
    else
    {
      long  i, num;


      num = face->num_faces;
      FT_Done_Face( face );

      for ( i = 0; i < num; i++ )
      {
        if ( !FT_New_Face( context, testfont, i, &face ) )
          TestFace( face );
      }
    }

    FT_Done_FreeType( context );

    exit( 0 );
  }
开发者ID:Ahbee,项目名称:Cinder,代码行数:40,代码来源:ftrandom.c

示例3: main

int main(int argc, const char* argv[])
{
    // Create And Initilize A FreeType Font Library.
    FT_Library library;
    if (FT_Init_FreeType(&library))
    {
        fprintf(stderr, "FT_Init_FreeType failed");
        return EXIT_FAILURE;
    }
 
    // The Object In Which FreeType Holds Information On A Given
    // Font Is Called A "face".
    FT_Face face;
 
    // This Is Where We Load In The Font Information From The File.
    // Of All The Places Where The Code Might Die, This Is The Most Likely,
    // As FT_New_Face Will Fail If The Font File Does Not Exist Or Is Somehow Broken.
    if (FT_New_Face(library, "arial.TTF", 0, &face))
    {
        fprintf(stderr, "FT_New_Face failed (there is probably a problem with your font file)");
        return EXIT_FAILURE;
    }
 
    // For Some Twisted Reason, FreeType Measures Font Size
    // In Terms Of 1/64ths Of Pixels.  Thus, To Make A Font
    // h Pixels High, We Need To Request A Size Of h*64.
    // (h << 6 Is Just A Prettier Way Of Writing h*64)
    FT_Set_Char_Size(face, fontHeight << 6, fontHeight << 6, 96, 96);
 
    createFontFile(face, "font.cpp");
 
    // We Don't Need The Face Information Now That The Display
    // Lists Have Been Created, So We Free The Assosiated Resources.
    FT_Done_Face(face);
 
    // Ditto For The Font Library.
    FT_Done_FreeType(library);
    
    return 0;
}
开发者ID:lihw,项目名称:glf,代码行数:40,代码来源:main.cpp

示例4: FT_Done_FreeType

// Close fonts and glyphs
void tAt5MapText::Close()
{
    if ( m_pGlyphcache != NULL )
    {
        delete m_pGlyphcache;
        m_pGlyphcache = NULL;
    }

    if ( m_pFtLib != NULL )
    {
        FT_Done_FreeType( m_pFtLib );
        m_pFtLib = NULL;
    }

    if ( m_pFtFace != NULL )
    {
        FT_Done_Face( m_pFtFace );
        m_pFtFace = NULL;
    }

    m_Directory = "";
}
开发者ID:dulton,项目名称:53_hero,代码行数:23,代码来源:At5MapText.cpp

示例5: uninit

static av_cold void uninit(AVFilterContext *ctx)
{
    DrawTextContext *s = ctx->priv;

    av_expr_free(s->x_pexpr);
    av_expr_free(s->y_pexpr);
    s->x_pexpr = s->y_pexpr = NULL;
    av_freep(&s->positions);
    s->nb_positions = 0;


    av_tree_enumerate(s->glyphs, NULL, NULL, glyph_enu_free);
    av_tree_destroy(s->glyphs);
    s->glyphs = NULL;

    FT_Done_Face(s->face);
    FT_Stroker_Done(s->stroker);
    FT_Done_FreeType(s->library);

    av_bprint_finalize(&s->expanded_text, NULL);
    av_bprint_finalize(&s->expanded_fontcolor, NULL);
}
开发者ID:mark4o,项目名称:FFmpeg,代码行数:22,代码来源:vf_drawtext.c

示例6: FT_Done_Face

//-------------------------------------------------------------------------------------------------------
StringManager::~StringManager()
{
    if( m_isLoad )
    {
        FT_Done_Face(m_FT_Face);
        FT_Done_FreeType(m_FT2Lib);
        for ( BStringList::iterator it = m_StringList.begin(); //释放全部的字体
                it != m_StringList.end();
                it++)
        {
            this->DestroyString( *it );
        }
        for ( RendBufferList::iterator it = m_FreeBufferList.begin();
                it != m_FreeBufferList.end();
                it++ )
        {
            delete (*it)->GetVertexBuffer();
            delete (*it)->GetIndicesBuffer();
            SAFE_DELETE( *it );
        }
    }
}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:23,代码来源:Bfont.cpp

示例7: InitFreetype

void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
    if (!gLCDSupportValid) {
      InitFreetype();
      FT_Done_FreeType(gFTLibrary);
    }

    if (!gLCDSupport && rec->isLCD()) {
      // If the runtime Freetype library doesn't support LCD mode, we disable
      // it here.
      rec->fMaskFormat = SkMask::kA8_Format;
    }

    SkPaint::Hinting h = rec->getHinting();
    if (SkPaint::kFull_Hinting == h && !rec->isLCD()) {
        // collapse full->normal hinting if we're not doing LCD
        h = SkPaint::kNormal_Hinting;
    } else if (rec->fSubpixelPositioning && SkPaint::kNo_Hinting != h) {
        // to do subpixel, we must have at most slight hinting
        h = SkPaint::kSlight_Hinting;
    }
    rec->setHinting(h);
}
开发者ID:avary,项目名称:skia,代码行数:22,代码来源:SkFontHost_FreeType.cpp

示例8: gkCleanupFonts

void gkCleanupFonts()
{
	gkFontRcRef* ref = gkFontResources, *p;
	gkFontFaceEx* face;
	int i;
	while (ref) {
		p = ref;
		for (i = 0; i < p->resource->numFaces; i++) {
			face = (gkFontFaceEx*)p->resource->faces[i];
			FT_Done_Face(face->ftface);
			free(face);
		}
		free(p->resource->faces);
		free(p->resource);
		ref = ref->next;
		free(p);
	}
	gkFontResources = gkFontResourcesTop = 0;
	FT_Done_FreeType(ftlib);
	ftlib = 0;
	cleanupBatch();
}
开发者ID:amineas,项目名称:libGK,代码行数:22,代码来源:fonts.c

示例9: BLI_vfontchar_from_freetypefont

int BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
{
	int success = FALSE;

	if (!vfont) return FALSE;

	/* Init Freetype */
	err = FT_Init_FreeType(&library);
	if (err) {
		/* XXX error("Failed to load the Freetype font library"); */
		return 0;
	}

	/* Load the character */
	success = objchr_to_ftvfontdata(vfont, character);
	if (success == FALSE) return FALSE;

	/* Free Freetype */
	FT_Done_FreeType(library);

	/* Ahh everything ok */
	return TRUE;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:23,代码来源:freetypefont.c

示例10: uninit

static av_cold void uninit(AVFilterContext *ctx)
{
    DrawTextContext *s = ctx->priv;
    int i;

    av_expr_free(s->x_pexpr);
    av_expr_free(s->y_pexpr);
    av_expr_free(s->d_pexpr);
    s->x_pexpr = s->y_pexpr = s->d_pexpr = NULL;
    av_freep(&s->expanded_text);
    av_freep(&s->positions);
    av_tree_enumerate(s->glyphs, NULL, NULL, glyph_enu_free);
    av_tree_destroy(s->glyphs);
    s->glyphs = 0;
    FT_Done_Face(s->face);
    FT_Done_FreeType(s->library);

    for (i = 0; i < 4; i++) {
        av_freep(&s->box_line[i]);
        s->pixel_step[i] = 0;
    }

}
开发者ID:OS2World,项目名称:LIB-libav,代码行数:23,代码来源:vf_drawtext.c

示例11: FT_Init_FreeType

/**
 * Construct a new VFontData structure from
 * Freetype font data in a PackedFile.
 *
 * \param pf The font data.
 * \retval A new VFontData structure, or NULL
 * if unable to load.
 */
VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
{
	VFontData *vfd = NULL;
	int success = 0;

	/* init Freetype */
	err = FT_Init_FreeType(&library);
	if (err) {
		/* XXX error("Failed to load the Freetype font library"); */
		return NULL;
	}

	success = check_freetypefont(pf);
	
	if (success) {
		vfd = objfnt_to_ftvfontdata(pf);
	}

	/* free Freetype */
	FT_Done_FreeType(library);
	
	return vfd;
}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:31,代码来源:freetypefont.c

示例12: SFFontRelease

void SFFontRelease(SFFontRef sfFont) {
    if (!sfFont)
        return;
    
    sfFont->_retainCount--;
    
    if (sfFont->_retainCount == 0) {
        if (sfFont->_parent)
    		SFFontRelease(sfFont->_parent);
    	else {
            
#ifdef SF_IOS_CG
    		CGFontRelease(sfFont->_cgFont);
#else
    		if (sfFont->_ftFace)
    			FT_Done_Face(sfFont->_ftFace);
            
    		if (sfFont->_ftLib)
    			FT_Done_FreeType(sfFont->_ftLib);
#endif
            
    		if (sfFont->_availableFontTables & itCMAP)
    			SFFreeCMAP(&sfFont->_cmap);
            
    		if (sfFont->_availableFontTables & itGDEF)
    			SFFreeGDEF(&sfFont->_gdef);
            
    		if (sfFont->_availableFontTables & itGSUB)
    			SFFreeGSUB(&sfFont->_gsub);
            
    		if (sfFont->_availableFontTables & itGPOS)
    			SFFreeGPOS(&sfFont->_gpos);
    	}
        
        free(sfFont);
    }
}
开发者ID:mcatanmay,项目名称:SheenFigure,代码行数:37,代码来源:SFFont.c

示例13: FT_Done_Face

bool FreeType::destroy()
{
	if (_activeTex)
	{
		_activeTex = 0;
	}
	if (_fx)
	{
		_fx->destroy();
//			delete _fx;
		_fx = 0;
	}
	for (size_t i = 0; i != _textures.size(); ++i)
	{
		Texture* t = _textures[i];
		if (t)
		{
			t->destroy();
			delete t;
		}
	}
	_textures.clear();
	CodeTexMap::iterator it = _codeTex.begin();
	for (; it != _codeTex.end(); ++it)
	{
		FTex* t = it->second;
		if (t)
		{
			delete t;
			t = NULL;
		}
	}
	_codeTex.clear();
	FT_Done_Face(_face);
	FT_Done_FreeType(_library);
	return true;
}	
开发者ID:cpzhang,项目名称:zen,代码行数:37,代码来源:FreeType.cpp

示例14: FTDemo_Done

  void
  FTDemo_Done( FTDemo_Handle*  handle )
  {
    int  i;


    if ( !handle )
      return;

    for ( i = 0; i < handle->max_fonts; i++ )
    {
      if ( handle->fonts[i] )
      {
        if ( handle->fonts[i]->filepathname )
          free( (void*)handle->fonts[i]->filepathname );
        free( handle->fonts[i] );
      }
    }
    free( handle->fonts );

    /* string_done */
    for ( i = 0; i < MAX_GLYPHS; i++ )
    {
      PGlyph  glyph = handle->string + i;


      if ( glyph->image )
        FT_Done_Glyph( glyph->image );
    }

    FT_Stroker_Done( handle->stroker );
    FT_Bitmap_Done( handle->library, &handle->bitmap );
    FTC_Manager_Done( handle->cache_manager );
    FT_Done_FreeType( handle->library );

    free( handle );
  }
开发者ID:Frankie-666,项目名称:color-emoji.freetype2-demos,代码行数:37,代码来源:ftcommon.c

示例15: CloseGraphics

/// @brief Closes the renderer used by the editor
/// @return 0 on failure, non-0 for success
/// @note Tested
int CloseGraphics (void)
{
	Graphics::Main & g = Graphics::Main::Get();

	// Unload all pictures; doing so unloads images, as well.
	while (!g.mPictures.empty())
	{
		UnloadPicture(*g.mPictures.begin());
	}

	// Unload all text images and fonts.
	while (!g.mTextImages.empty())
	{
		UnloadTextImage(*g.mTextImages.begin());
	}

	while (!g.mFaces.empty())
	{
		Graphics::Face * pFace = g.mFaces.begin()->second;

		while (!pFace->mSizes.empty())
		{
			UnloadFont(pFace->mSizes.begin()->second);
		}
	}

	// Close TrueType font support.
	FT_Done_FreeType(g.mFreeType);

	// Close the video subsystem.
	if (SDL_WasInit(SDL_INIT_VIDEO)) SDL_QuitSubSystem(SDL_INIT_VIDEO);

	// Flag the termination
	g.mInit = false;

	return 1;
}
开发者ID:ggcrunchy,项目名称:ui-edit-v2,代码行数:40,代码来源:Graphics.cpp


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