• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FT_Done_FreeType函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: while

Gui::~Gui() {
    while (render_jobs.length()) {
        RenderJob *rj = render_jobs.pop();
        destroy_render_job(rj);
    }


    os_mutex_unlock(gui_mutex);

    glfwDestroyCursor(cursor_default);
    glfwDestroyCursor(cursor_ibeam);

    auto it = _font_size_cache.entry_iterator();
    for (;;) {
        auto *entry = it.next();
        if (!entry)
            break;
        FontSize *font_size_object = entry->value;
        destroy(font_size_object, 1);
    }

    FT_Done_Face(_default_font_face);
    FT_Done_FreeType(_ft_library);
}
开发者ID:EQ4,项目名称:genesis,代码行数:24,代码来源:gui.cpp


示例17: FT_Done_Face

void Font::cleanup()
{
    // Check if we must destroy the FreeType pointers
    if (m_refCount)
    {
        // Decrease the reference counter
        (*m_refCount)--;

        // Free the resources only if we are the last owner
        if (*m_refCount == 0)
        {
            // Delete the reference counter
            delete m_refCount;

            // Destroy the font face
            if (m_face)
                FT_Done_Face(static_cast<FT_Face>(m_face));

            // Destroy the stream rec instance, if any (must be done after FT_Done_Face!)
            if (m_streamRec)
                delete static_cast<FT_StreamRec*>(m_streamRec);

            // Close the library
            if (m_library)
                FT_Done_FreeType(static_cast<FT_Library>(m_library));
        }
    }

    // Reset members
    m_library   = NULL;
    m_face      = NULL;
    m_streamRec = NULL;
    m_refCount  = NULL;
    m_pages.clear();
    m_pixelBuffer.clear();
}
开发者ID:akadjoker,项目名称:waxe,代码行数:36,代码来源:Font.cpp


示例18: ft_Font_Destroy

void ft_Font_Destroy(void)
{
    if (ft_MEM.pmem)
    {
        free(ft_MEM.pmem);
    }

    if (ft_MEM_SLV.pmem)
    {
        free(ft_MEM_SLV.pmem);
    }

    if(ft_Font_FtFace)
    {
        FT_Done_Face(ft_Font_FtFace);
    }

    if(ft_Font_FTLibrary)
    {
        FT_Done_FreeType(ft_Font_FTLibrary);
    }

    return;
}
开发者ID:github188,项目名称:ptest_v2,代码行数:24,代码来源:ft_Font.c


示例19: cleanupCairo

int cleanupCairo(void *cache) {
    cairoCacheData *ccache = (cairoCacheData*)cache;
    
    if(ccache->dummycr) {
        cairo_destroy(ccache->dummycr);
    }
    if(ccache->dummysurface) {
        cairo_surface_destroy(ccache->dummysurface);
    }
    if(ccache->facecache) {
        faceCacheObj *next,*cur;
        cur = ccache->facecache;
        do {
            next = cur->next;
            freeFaceCache(cur);
            free(cur);
            cur=next;
        } while(cur);
    }
    if(ccache->library)
        FT_Done_FreeType(ccache->library);
    free(ccache);
    return MS_SUCCESS;
}
开发者ID:msilex,项目名称:mapserver,代码行数:24,代码来源:mapcairo.c


示例20: fz_keep_freetype

static void
fz_keep_freetype(fz_context *ctx)
{
	int fterr;
	int maj, min, pat;
	fz_font_context *fct = ctx->font;

	fz_lock(ctx, FZ_LOCK_FREETYPE);
	if (fct->ftlib)
	{
		fct->ftlib_refs++;
		fz_unlock(ctx, FZ_LOCK_FREETYPE);
		return;
	}

	fterr = FT_Init_FreeType(&fct->ftlib);
	if (fterr)
	{
		char *mess = ft_error_string(fterr);
		fz_unlock(ctx, FZ_LOCK_FREETYPE);
		fz_throw(ctx, FZ_ERROR_GENERIC, "cannot init freetype: %s", mess);
	}

	FT_Library_Version(fct->ftlib, &maj, &min, &pat);
	if (maj == 2 && min == 1 && pat < 7)
	{
		fterr = FT_Done_FreeType(fct->ftlib);
		if (fterr)
			fz_warn(ctx, "freetype finalizing: %s", ft_error_string(fterr));
		fz_unlock(ctx, FZ_LOCK_FREETYPE);
		fz_throw(ctx, FZ_ERROR_GENERIC, "freetype version too old: %d.%d.%d", maj, min, pat);
	}

	fct->ftlib_refs++;
	fz_unlock(ctx, FZ_LOCK_FREETYPE);
}
开发者ID:chrox,项目名称:libk2pdfopt,代码行数:36,代码来源:font.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FT_Done_Size函数代码示例发布时间:2022-05-30
下一篇:
C++ FT_Done_Face函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap