您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FT_Done_FreeType函数代码示例

51自学网 2021-06-01 20:44:01
  C++
这篇教程C++ FT_Done_FreeType函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例4: FT_Done_FreeType

// Close fonts and glyphsvoid 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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例15: CloseGraphics

/// @brief Closes the renderer used by the editor/// @return 0 on failure, non-0 for success/// @note Testedint 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,


示例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,


示例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,


示例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,


示例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,


示例20: fz_keep_freetype

static voidfz_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,


示例21: blf_font_exit

void blf_font_exit(void){	FT_Done_FreeType(ft_lib);	BLI_spin_end(&ft_lib_mutex);}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:5,


示例22: FT_Done_FreeType

Library::~Library() noexcept{	FT_Done_FreeType(id_);}
开发者ID:det,项目名称:Twil,代码行数:4,


示例23: texture_font_load_glyphs

// ----------------------------------------------- texture_font_load_glyphs ---size_ttexture_font_load_glyphs( texture_font_t * self,                          const wchar_t * charcodes ){    assert( self );    assert( charcodes );    size_t i, x, y, width, height, depth, w, h;    FT_Library library;    FT_Error error;    FT_Face face;    FT_Glyph ft_glyph;    FT_GlyphSlot slot;    FT_Bitmap ft_bitmap;    FT_UInt glyph_index;    texture_glyph_t *glyph;    ivec4 region;    size_t missed = 0;    width  = self->atlas->width;    height = self->atlas->height;    depth  = self->atlas->depth;    region.x=1;    region.y=1;#ifdef RENDERSTRING    stringwidth=0;    stringheight=0;    stringshift=0;#endif    if( !texture_font_load_face( &library, self->filename, self->size, &face ) )    {        return wcslen(charcodes);    }    /* Load each glyph */    for( i=0; i<wcslen(charcodes); ++i )    {        glyph_index = FT_Get_Char_Index( face, charcodes[i] );        // WARNING: We use texture-atlas depth to guess if user wants        //          LCD subpixel rendering        FT_Int32 flags = 0;        if( self->outline_type > 0 )        {            flags |= FT_LOAD_NO_BITMAP;        }        else        {            flags |= FT_LOAD_RENDER;        }        if( !self->hinting )        {            flags |= FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT;        }        else        {            flags |= FT_LOAD_FORCE_AUTOHINT;        }        if( depth == 3 )        {            FT_Library_SetLcdFilter( library, FT_LCD_FILTER_LIGHT );            flags |= FT_LOAD_TARGET_LCD;            if( self->filtering )            {//                FT_Library_SetLcdFilterWeights( library, self->lcd_weights );            }        }        error = FT_Load_Glyph( face, glyph_index, flags );        if( error )        {            fprintf( stderr, "FT_Error (line %d, code 0x%02x) : %s/n",                     __LINE__, FT_Errors[error].code, FT_Errors[error].message );            FT_Done_FreeType( library );            return wcslen(charcodes)-i;        }        int ft_bitmap_width = 0;        int ft_bitmap_rows = 0;        int ft_bitmap_pitch = 0;        int ft_glyph_top = 0;        int ft_glyph_left = 0;        if( self->outline_type == 0 )        {            slot            = face->glyph;            ft_bitmap       = slot->bitmap;            ft_bitmap_width = slot->bitmap.width;            ft_bitmap_rows  = slot->bitmap.rows;            ft_bitmap_pitch = slot->bitmap.pitch;            ft_glyph_top    = slot->bitmap_top;            ft_glyph_left   = slot->bitmap_left;        }        else//.........这里部分代码省略.........
开发者ID:bubbg,项目名称:lambdanative,代码行数:101,


示例24: texture_font_load_face

// ------------------------------------------------- texture_font_load_face ---inttexture_font_load_face( FT_Library * library,                        const char * filename,                        const float size,                        FT_Face * face ){    assert( library );    assert( filename );    assert( size );    size_t hres = 64;    FT_Error error;    FT_Matrix matrix = { (int)((1.0/hres) * 0x10000L),                         (int)((0.0)      * 0x10000L),                         (int)((0.0)      * 0x10000L),                         (int)((1.0)      * 0x10000L) };    /* Initialize library */    error = FT_Init_FreeType( library );    if( error )    {        fprintf(stderr, "FT_Error (0x%02x) : %s/n",                FT_Errors[error].code, FT_Errors[error].message);        return 0;    }    /* Load face */    error = FT_New_Face( *library, filename, 0, face );    if( error )    {        fprintf( stderr, "FT_Error (line %d, code 0x%02x) : %s/n",                 __LINE__, FT_Errors[error].code, FT_Errors[error].message);        FT_Done_FreeType( *library );        return 0;    }    /* Select charmap */    error = FT_Select_Charmap( *face, FT_ENCODING_UNICODE );    if( error )    {        fprintf( stderr, "FT_Error (line %d, code 0x%02x) : %s/n",                 __LINE__, FT_Errors[error].code, FT_Errors[error].message );        FT_Done_Face( *face );        FT_Done_FreeType( *library );        return 0;    }    /* Set char size */    error = FT_Set_Char_Size( *face, (int)(size*64), 0, 72*hres, 72 );    if( error )    {        fprintf( stderr, "FT_Error (line %d, code 0x%02x) : %s/n",                 __LINE__, FT_Errors[error].code, FT_Errors[error].message );        FT_Done_Face( *face );        FT_Done_FreeType( *library );        return 0;    }    /* Set transform matrix */    FT_Set_Transform( *face, &matrix, NULL );    return 1;}
开发者ID:bubbg,项目名称:lambdanative,代码行数:64,


示例25: texture_font_new

// ------------------------------------------------------- texture_font_new ---texture_font_t *texture_font_new( texture_atlas_t * atlas,                  const char * filename,                  const float size){    assert( filename );    assert( size );    texture_font_t *self = (texture_font_t *) malloc( sizeof(texture_font_t) );    if( self == NULL)    {        fprintf( stderr,                 "line %d: No more memory for allocating data/n", __LINE__ );        exit( EXIT_FAILURE );    }    self->glyphs = vector_new( sizeof(texture_glyph_t *) );    self->atlas = atlas;    self->height = 0;    self->ascender = 0;    self->descender = 0;    self->filename = strdup( filename );    self->size = size;    self->outline_type = 0;    self->outline_thickness = 0.0;    self->hinting = 1;    self->filtering = 1;    // FT_LCD_FILTER_LIGHT   is (0x00, 0x55, 0x56, 0x55, 0x00)    // FT_LCD_FILTER_DEFAULT is (0x10, 0x40, 0x70, 0x40, 0x10)    self->lcd_weights[0] = 0x10;    self->lcd_weights[1] = 0x40;    self->lcd_weights[2] = 0x70;    self->lcd_weights[3] = 0x40;    self->lcd_weights[4] = 0x10;    /* Get font metrics at high resolution */    FT_Library library;    FT_Face face;    if( !texture_font_load_face( &library, self->filename, self->size*100, &face ) )    {        return self;    }    // 64 * 64 because of 26.6 encoding AND the transform matrix used    // in texture_font_load_face (hres = 64)    self->underline_position = face->underline_position / (float)(64.0f*64.0f) * self->size;    self->underline_position = round( self->underline_position );    if( self->underline_position > -2 )    {        self->underline_position = -2.0;    }    self->underline_thickness = face->underline_thickness / (float)(64.0f*64.0f) * self->size;    self->underline_thickness = round( self->underline_thickness );    if( self->underline_thickness < 1 )    {        self->underline_thickness = 1.0;    }    FT_Size_Metrics metrics = face->size->metrics;     self->ascender = (metrics.ascender >> 6) / 100.0;    self->descender = (metrics.descender >> 6) / 100.0;    self->height = (metrics.height >> 6) / 100.0;    self->linegap = self->height - self->ascender + self->descender;    FT_Done_Face( face );    FT_Done_FreeType( library );    /* -1 is a special glyph */    texture_font_get_glyph( self, -1 );    return self;}
开发者ID:bubbg,项目名称:lambdanative,代码行数:72,


示例26: main

//.........这里部分代码省略.........			printf("Clock <FBIOGET_FSCREENINFO failed>/n");			return -1;		}		if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1)		{			printf("Clock <FBIOGET_VSCREENINFO failed>/n");			return -1;		}				if(ioctl(fb, FBIOGETCMAP, &colormap) == -1)		{			printf("Clock <FBIOGETCMAP failed>/n");			return -1;		}		if(!(lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0)))		{			printf("Clock <mapping of Framebuffer failed>/n");			return -1;		}	//init fontlibrary		if((error = FT_Init_FreeType(&library)))		{			printf("Clock <FT_Init_FreeType failed with Errorcode 0x%.2X>", error);			munmap(lfb, fix_screeninfo.smem_len);			return -1;		}		if((error = FTC_Manager_New(library, 1, 2, 0, &MyFaceRequester, NULL, &manager)))		{			printf("Clock <FTC_Manager_New failed with Errorcode 0x%.2X>/n", error);			FT_Done_FreeType(library);			munmap(lfb, fix_screeninfo.smem_len);			return -1;		}		if((error = FTC_SBitCache_New(manager, &cache)))		{			printf("Clock <FTC_SBitCache_New failed with Errorcode 0x%.2X>/n", error);			FTC_Manager_Done(manager);			FT_Done_FreeType(library);			munmap(lfb, fix_screeninfo.smem_len);			return -1;		}		if((error = FTC_Manager_Lookup_Face(manager, FONT, &face)))		{			printf("Clock <FTC_Manager_Lookup_Face failed with Errorcode 0x%.2X>/n", error);			FTC_Manager_Done(manager);			FT_Done_FreeType(library);			munmap(lfb, fix_screeninfo.smem_len);			return -1;		}		use_kerning = FT_HAS_KERNING(face);#ifdef FT_NEW_CACHE_API		desc.face_id = FONT;		desc.flags = FT_LOAD_MONOCHROME;#else		desc.font.face_id = FONT;		desc.image_type = ftc_image_mono;#endif		if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres)))
开发者ID:OpenDMM,项目名称:tuxbox-apps,代码行数:67,


示例27: FT_Done_Face

n2dFontImpl::~n2dFontImpl(){	FT_Done_Face(m_pFTFace);	FT_Done_FreeType(m_pFTLib);}
开发者ID:akemimadoka,项目名称:Natsu2D,代码行数:5,


示例28: tearDownFreetype

 void tearDownFreetype() {     FT_Done_Face( face);     FT_Done_FreeType( library); }
开发者ID:CmPons,项目名称:angel2d,代码行数:5,


示例29: FT_Set_Pixel_Sizes

void TextRenderer::initRenderData(){	// FreeType	FT_Library ft;	// All functions return a value different than 0 whenever an error occurred	if (FT_Init_FreeType(&ft))		std::cout << "ERROR::FREETYPE: Could not init FreeType Library" << std::endl;	// Load font as face	FT_Face face;	if (FT_New_Face(ft, Constants::fontFilePath.c_str(), 0, &face))		std::cout << "ERROR::FREETYPE: Failed to load font" << std::endl;	// Set size to load glyphs as	FT_Set_Pixel_Sizes(face, 0, 48);	// Disable byte-alignment restriction	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);	// Load first 128 characters of ASCII set	for (GLubyte c = 0; c < 128; c++)	{		// Load character glyph 		if (FT_Load_Char(face, c, FT_LOAD_RENDER))		{			std::cout << "ERROR::FREETYTPE: Failed to load Glyph" << std::endl;			continue;		}		// Generate texture		GLuint texture;		glGenTextures(1, &texture);		glBindTexture(GL_TEXTURE_2D, texture);		glTexImage2D(			GL_TEXTURE_2D,			0,			GL_RED,			face->glyph->bitmap.width,			face->glyph->bitmap.rows,			0,			GL_RED,			GL_UNSIGNED_BYTE,			face->glyph->bitmap.buffer			);		// Set texture options		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);		// Now store character for later use		Character character = {			texture,			glm::ivec2(face->glyph->bitmap.width, face->glyph->bitmap.rows),			glm::ivec2(face->glyph->bitmap_left, face->glyph->bitmap_top),			face->glyph->advance.x		};		Characters.insert(std::pair<GLchar, Character>(c, character));	}	glBindTexture(GL_TEXTURE_2D, 0);	// Destroy FreeType once we're finished	FT_Done_Face(face);	FT_Done_FreeType(ft);	// Configure VAO/VBO for texture quads	glGenVertexArrays(1, &VAO);	glGenBuffers(1, &VBO);	glBindVertexArray(VAO);	glBindBuffer(GL_ARRAY_BUFFER, VBO);	glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, NULL, GL_DYNAMIC_DRAW);	glEnableVertexAttribArray(0);	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), 0);	glBindBuffer(GL_ARRAY_BUFFER, 0);	glBindVertexArray(0);}
开发者ID:stephan-botha,项目名称:FinalProjectRepository,代码行数:75,



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


C++ FT_Done_Size函数代码示例
C++ FT_Done_Face函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。