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

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

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

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

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

示例1: find_face

    //------------------------------------------------------------------------    bool font_engine_freetype_base::load_font(const char* font_name,                                               unsigned face_index,                                              glyph_rendering ren_type,                                              const char* font_mem,                                               const long font_mem_size)    {        bool ret = false;        if(m_library_initialized)        {            m_last_error = 0;            int idx = find_face(font_name);            if(idx >= 0)            {                m_cur_face = m_faces[idx];                m_name     = m_face_names[idx];            }            else            {                if(m_num_faces >= m_max_faces)                {                    delete [] m_face_names[0];                    FT_Done_Face(m_faces[0]);                    memcpy(m_faces,                            m_faces + 1,                            (m_max_faces - 1) * sizeof(FT_Face));                    memcpy(m_face_names,                            m_face_names + 1,                            (m_max_faces - 1) * sizeof(char*));                    m_num_faces = m_max_faces - 1;                }                if (font_mem && font_mem_size)                {                    m_last_error = FT_New_Memory_Face(m_library,                                                       (const FT_Byte*)font_mem,                                                       font_mem_size,                                                       face_index,                                                       &m_faces[m_num_faces]);                }                else                {                    m_last_error = FT_New_Face(m_library,                                               font_name,                                               face_index,                                               &m_faces[m_num_faces]);                }                if(m_last_error == 0)                {                    m_face_names[m_num_faces] = new char [strlen(font_name) + 1];                    strcpy(m_face_names[m_num_faces], font_name);                    m_cur_face = m_faces[m_num_faces];                    m_name     = m_face_names[m_num_faces];                    ++m_num_faces;                }                else                {                    m_face_names[m_num_faces] = 0;                    m_cur_face = 0;                    m_name = 0;                }            }            if(m_last_error == 0)            {                ret = true;                                switch(ren_type)                {                case glyph_ren_native_mono:                    m_glyph_rendering = glyph_ren_native_mono;                    break;                case glyph_ren_native_gray8:                    m_glyph_rendering = glyph_ren_native_gray8;                    break;                case glyph_ren_outline:                    if(FT_IS_SCALABLE(m_cur_face))                    {                        m_glyph_rendering = glyph_ren_outline;                    }                    else                    {                        m_glyph_rendering = glyph_ren_native_gray8;                    }                    break;                case glyph_ren_agg_mono:                    if(FT_IS_SCALABLE(m_cur_face))                    {                        m_glyph_rendering = glyph_ren_agg_mono;                    }                    else                    {                        m_glyph_rendering = glyph_ren_native_mono;//.........这里部分代码省略.........
开发者ID:sweetdark,项目名称:navi,代码行数:101,


示例2: EFontEngine

EFontFT2::EFontFT2(const EEntry *entry, eint32 faceIndex)	: EFontEngine(), fFilename(NULL), fFaceIndex(-1), nFaces(-1), fFace(NULL), fScalable(false), fForceFontAliasing(false){	EPath aPath;	if(entry == NULL || entry->Exists() == false || entry->GetPath(&aPath) != E_OK) return;	EString filename = aPath.Path();#ifdef _WIN32	filename.ReplaceAll("/", "//");#endif	SetRenderMode(E_FONT_RENDER_PIXMAP);	EAutolock <ELocker> autolock(&etk_ft2_font_locker);	if(!_etk_ft2_initialized_) return;	FT_Error error = FT_New_Face(_etk_ft2_library_, filename.String(), faceIndex, &fFace);	if(error || !fFace)	{		ETK_DEBUG("[FONT]: %s --- CAN NOT load face[%s:%d].", __PRETTY_FUNCTION__, aPath.Path(), faceIndex);		return;	}	if(FT_Select_Charmap(fFace, FT_ENCODING_UNICODE))	{//		ETK_DEBUG("[FONT]: %s --- font[%s] don't support ENCODING_UNICODE.", __PRETTY_FUNCTION__, aPath.Path());		if(FT_Select_Charmap(fFace, FT_ENCODING_NONE))		{//			ETK_WARNING("[FONT]: %s --- font[%s] don't support unicode at all.", __PRETTY_FUNCTION__, aPath.Path());			FT_Done_Face(fFace);			fFace = NULL;			return;		}	}	fFilename = EStrdup(filename.String());	fFaceIndex = faceIndex;	nFaces = fFace->num_faces;	EString family = fFace->family_name;	if(family.Length() <= 0)	{		family = aPath.Leaf();		eint32 cFound;		if((cFound = family.FindFirst('.')) >= 0) family.Remove(cFound, -1);		if(family.Length() < 0) family = "Unknown";	}	SetFamily(family.String());	EString style = fFace->style_name;	if(style.Length() <= 0)	{		if((fFace->style_flags & FT_STYLE_FLAG_BOLD) && (fFace->style_flags & FT_STYLE_FLAG_ITALIC))			style = "Bold Italic";		else if(fFace->style_flags & FT_STYLE_FLAG_BOLD)			style = "Bold";		else if(fFace->style_flags & FT_STYLE_FLAG_ITALIC)			style = "Italic";		else			style = "Regular";	}	SetStyle(style.String());	if(FT_IS_SCALABLE(fFace)) fScalable = true;	if(fFace->num_fixed_sizes > 0)	{		float *sizes = new float[(int)fFace->num_fixed_sizes];		for(int i = 0; i < fFace->num_fixed_sizes; i++) sizes[i] = (float)(fFace->available_sizes[i].height);		SetFixedSize(sizes, (eint32)fFace->num_fixed_sizes);		delete[] sizes;	}	FT_Done_Face(fFace);	fFace = NULL;}
开发者ID:D-os,项目名称:EasyToolkitAndExtension,代码行数:76,


示例3: texture_font_load_glyphs

//.........这里部分代码省略.........            if( self->outline_type == 1 )            {                error = FT_Glyph_Stroke( &ft_glyph, stroker, 1 );            }            else if ( self->outline_type == 2 )            {                error = FT_Glyph_StrokeBorder( &ft_glyph, stroker, 0, 1 );            }            else if ( self->outline_type == 3 )            {                error = FT_Glyph_StrokeBorder( &ft_glyph, stroker, 1, 1 );            }            if( error )            {                fprintf(stderr, "FT_Error (0x%02x) : %s/n",                        FT_Errors[error].code, FT_Errors[error].message);                return 0;            }                      if( depth == 1)            {                error = FT_Glyph_To_Bitmap( &ft_glyph, FT_RENDER_MODE_NORMAL, 0, 1);                if( error )                {                    fprintf(stderr, "FT_Error (0x%02x) : %s/n",                            FT_Errors[error].code, FT_Errors[error].message);                    return 0;                }            }            else            {                error = FT_Glyph_To_Bitmap( &ft_glyph, FT_RENDER_MODE_LCD, 0, 1);                if( error )                {                    fprintf(stderr, "FT_Error (0x%02x) : %s/n",                            FT_Errors[error].code, FT_Errors[error].message);                    return 0;                }            }            FT_BitmapGlyph ft_bitmap_glyph = (FT_BitmapGlyph) ft_glyph;            ft_bitmap       = ft_bitmap_glyph->bitmap;            ft_bitmap_width = ft_bitmap.width;            ft_bitmap_rows  = ft_bitmap.rows;            ft_bitmap_pitch = ft_bitmap.pitch;            ft_glyph_top    = ft_bitmap_glyph->top;            ft_glyph_left   = ft_bitmap_glyph->left;            FT_Stroker_Done(stroker);        }        // We want each glyph to be separated by at least one black pixel        // (for example for shader used in demo-subpixel.c)        w = ft_bitmap_width/depth + 1;        h = ft_bitmap_rows + 1;        region = texture_atlas_get_region( self->atlas, w, h );        if ( region.x < 0 )        {            missed++;            fprintf( stderr, "Texture atlas is full (line %d)/n",  __LINE__ );            continue;        }        w = w - 1;        h = h - 1;        x = region.x;        y = region.y;        texture_atlas_set_region( self->atlas, x, y, w, h,                                  ft_bitmap.buffer, ft_bitmap.pitch );        glyph = texture_glyph_new( );        glyph->charcode = charcodes[i];        glyph->width    = w;        glyph->height   = h;        glyph->outline_type = self->outline_type;        glyph->outline_thickness = self->outline_thickness;        glyph->offset_x = ft_glyph_left;        glyph->offset_y = ft_glyph_top;        glyph->s0       = x/(float)width;        glyph->t0       = y/(float)height;        glyph->s1       = (x + glyph->width)/(float)width;        glyph->t1       = (y + glyph->height)/(float)height;        // Discard hinting to get advance        FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING);        slot = face->glyph;        glyph->advance_x = slot->advance.x/64.0;        glyph->advance_y = slot->advance.y/64.0;        vector_push_back( self->glyphs, &glyph );        if( self->outline_type > 0 )        {            FT_Done_Glyph( ft_glyph );        }    }    FT_Done_Face( face );    FT_Done_FreeType( library );    texture_atlas_upload( self->atlas );    texture_font_generate_kerning( self );    return missed;}
开发者ID:kengonakajima,项目名称:moyai,代码行数:101,


示例4: loadFace

void tst_QScriptEngine::malayalam(){    {        FT_Face face = loadFace("AkrutiMal2Normal.ttf");        if (face) {	    const ShapeTable shape_table [] = {		{ { 0x0d15, 0x0d46, 0x0 },		  { 0x005e, 0x0034, 0x0 } },		{ { 0x0d15, 0x0d47, 0x0 },		  { 0x005f, 0x0034, 0x0 } },		{ { 0x0d15, 0x0d4b, 0x0 },		  { 0x005f, 0x0034, 0x0058, 0x0 } },		{ { 0x0d15, 0x0d48, 0x0 },		  { 0x0060, 0x0034, 0x0 } },		{ { 0x0d15, 0x0d4a, 0x0 },		  { 0x005e, 0x0034, 0x0058, 0x0 } },		{ { 0x0d30, 0x0d4d, 0x0d15, 0x0 },		  { 0x009e, 0x0034, 0x0 } },		{ { 0x0d15, 0x0d4d, 0x0d35, 0x0 },		  { 0x0034, 0x007a, 0x0 } },		{ { 0x0d15, 0x0d4d, 0x0d2f, 0x0 },		  { 0x0034, 0x00a2, 0x0 } },		{ { 0x0d1f, 0x0d4d, 0x0d1f, 0x0 },		  { 0x0069, 0x0 } },		{ { 0x0d26, 0x0d4d, 0x0d26, 0x0 },		  { 0x0074, 0x0 } },		{ { 0x0d30, 0x0d4d, 0x0 },		  { 0x009e, 0x0 } },		{ { 0x0d30, 0x0d4d, 0x200c, 0x0 },		  { 0x009e, 0x0 } },		{ { 0x0d30, 0x0d4d, 0x200d, 0x0 },		  { 0x009e, 0x0 } },                { { 0xd15, 0xd46, 0xd3e, 0x0 },                  { 0x5e, 0x34, 0x58, 0x0 } },                { { 0xd15, 0xd47, 0xd3e, 0x0 },                  { 0x5f, 0x34, 0x58, 0x0 } },                { { 0xd15, 0xd46, 0xd57, 0x0 },                  { 0x5e, 0x34, 0x65, 0x0 } },                { { 0xd15, 0xd57, 0x0 },                  { 0x34, 0x65, 0x0 } },                { { 0xd1f, 0xd4d, 0xd1f, 0xd41, 0xd4d, 0x0 },                  { 0x69, 0x5b, 0x64, 0x0 } },		{ {0}, {0} }	    };	    const ShapeTable *s = shape_table;	    while (s->unicode[0]) {		QVERIFY( shaping(face, s, HB_Script_Malayalam) );		++s;	    }            FT_Done_Face(face);	} else {	    QSKIP("couln't find AkrutiMal2Normal.ttf");	}    }    {        FT_Face face = loadFace("Rachana.ttf");        if (face) {            const ShapeTable shape_table [] = {                { { 0xd37, 0xd4d, 0xd1f, 0xd4d, 0xd30, 0xd40, 0x0 },                  { 0x385, 0xa3, 0x0 } },                { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 },                  { 0x2ff, 0x0 } },                { { 0xd33, 0xd4d, 0xd33, 0x0 },                  { 0x3f8, 0x0 } },                { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 },                  { 0x2ff, 0x0 } },                { { 0xd30, 0xd4d, 0x200d, 0xd35, 0xd4d, 0xd35, 0x0 },                  { 0xf3, 0x350, 0x0 } },                { {0}, {0} }            };            const ShapeTable *s = shape_table;            while (s->unicode[0]) {                QVERIFY( shaping(face, s, HB_Script_Malayalam) );                ++s;            }            FT_Done_Face(face);        } else {            QSKIP("couln't find Rachana.ttf");        }    }}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:91,


示例5: FT_Done_Face

Font::~Font(){	FT_Done_Face(face);	glDeleteTextures(1, &textureID);}
开发者ID:batlol,项目名称:EmulationStation,代码行数:6,


示例6: texture_font_generate_kerning

/* ------------------------------------------------------------------------- */voidtexture_font_generate_kerning( TextureFont *self ){    size_t i, j, k, count;    FT_Library   library;    FT_Face      face;    FT_UInt      glyph_index, prev_index;    TextureGlyph *glyph, *prev_glyph;    FT_Vector    kerning;    /* Load font */    if( !texture_font_load_face( &library, self->filename, self->size, &face ) )    {        return;    }    /* For each glyph couple combination, check if kerning is necessary */    for( i=0; i<self->glyphs->size; ++i )    {        glyph = (TextureGlyph *) vector_get( self->glyphs, i );        /* Remove any old kerning information */        if( glyph->kerning )        {            free( glyph->kerning );            glyph->kerning = 0;            glyph->kerning_count = 0;        }        /* Count how many kerning pairs we need */        count = 0;        glyph_index = FT_Get_Char_Index( face, glyph->charcode );        for( j=0; j<self->glyphs->size; ++j )        {            prev_glyph = (TextureGlyph *) vector_get( self->glyphs, j );            prev_index = FT_Get_Char_Index( face, prev_glyph->charcode );            FT_Get_Kerning( face, prev_index, glyph_index, FT_KERNING_UNFITTED, &kerning );            if( kerning.x != 0.0 )            {                count++;            }        }              /* No kerning at all */        if( !count )        {            continue;        }        /* Store kerning pairs */        glyph->kerning = (KerningPair *) malloc( count * sizeof(KerningPair) );        glyph->kerning_count = count;        k = 0;        for( j=0; j<self->glyphs->size; ++j )        {            prev_glyph = (TextureGlyph *) vector_get( self->glyphs, j );            prev_index = FT_Get_Char_Index( face, prev_glyph->charcode );            FT_Get_Kerning( face, prev_index, glyph_index, FT_KERNING_UNFITTED, &kerning );            if( kerning.x != 0.0 )            {                glyph->kerning[k].charcode = prev_glyph->charcode;                // 64 * 64 because of 26.6 encoding AND the transform matrix used                // in texture_font_load_face (hres = 64)                glyph->kerning[k].kerning = kerning.x/ (float)(64.0f*64.0f);                ++k;            }        }    }    FT_Done_Face( face );    FT_Done_FreeType( library );}
开发者ID:rue-ryuzaki,项目名称:Visual-OpenGL,代码行数:74,


示例7: texture_font_cache_glyphs

//.........这里部分代码省略.........    {        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 = 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->lcd_filter )            {                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;        }        slot = face->glyph;        /* Gamma correction (sort of) */        for( x=0; x<slot->bitmap.width; ++x )        {            for( y=0; y<slot->bitmap.rows; ++y )            {                c = *(unsigned char *)(slot->bitmap.buffer                                       + y*slot->bitmap.pitch + x );                c = (unsigned char) ( pow(c/255.0, self->gamma) * 255);                *(unsigned char *)(slot->bitmap.buffer                                   + y*slot->bitmap.pitch + x ) = c;            }        }        // We want each glyph to be separated by at least one black pixel        // (for example for shader used in demo-subpixel.c)        w = slot->bitmap.width/depth + 1;        h = slot->bitmap.rows + 1;        region = texture_atlas_get_region( self->atlas, w, h );        if ( region.x < 0 )        {            missed++;            continue;        }        w = w - 1;        h = h - 1;        x = region.x;        y = region.y;        texture_atlas_set_region( self->atlas, x, y, w, h,                                  slot->bitmap.buffer, slot->bitmap.pitch );        glyph = texture_glyph_new( );        glyph->font = self;        glyph->charcode = charcodes[i];        glyph->kerning  = 0;        glyph->width    = w;        glyph->height   = h;        glyph->offset_x = slot->bitmap_left;        glyph->offset_y = slot->bitmap_top;        glyph->u0       = x/(float)width;        glyph->v0       = y/(float)height;        glyph->u1       = (x + glyph->width)/(float)width;        glyph->v1       = (y + glyph->height)/(float)height;        /* Discard hinting to get advance */        FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING);        slot = face->glyph;        glyph->advance_x    = slot->advance.x/64.0;        glyph->advance_y    = slot->advance.y/64.0;        vector_push_back( self->glyphs, glyph );        texture_glyph_delete( glyph );    }    FT_Done_Face( face );    FT_Done_FreeType( library );    texture_atlas_upload( self->atlas );    texture_font_generate_kerning( self );    return missed;}
开发者ID:rue-ryuzaki,项目名称:Visual-OpenGL,代码行数:101,


示例8: unloadTextures

//.........这里部分代码省略.........				unsigned char b=0;				unsigned char *bptr =  src;				for(int k=0; k < bitmap.width ; k++){					expanded_data[i][2*(k+j*width)] = 255;					if (k%8==0){						b = (*bptr++);					}					expanded_data[i][2*(k+j*width) + 1] = b&0x80 ? 255 : 0;					b <<= 1;				}				src += bitmap.pitch;			}			//-----------------------------------		}		areaSum += (cps[i].width+border*2)*(cps[i].height+border*2);	}	vector<charProps> sortedCopy = cps;	sort(sortedCopy.begin(),sortedCopy.end(),&compare_cps);	// pack in a texture, algorithm to calculate min w/h from	// http://upcommons.upc.edu/pfc/bitstream/2099.1/7720/1/TesiMasterJonas.pdf	//cout << areaSum << endl;	bool packed = false;	float alpha = logf(areaSum)*1.44269;	int w;	int h;	while(!packed){		w = pow(2,floor((alpha/2.f) + 0.5)); // there doesn't seem to be a round in cmath for windows.		//w = pow(2,round(alpha/2.f));		h = w;//pow(2,round(alpha - round(alpha/2.f)));		int x=0;		int y=0;		int maxRowHeight = sortedCopy[0].tH + border*2;		for(int i=0;i<(int)cps.size();i++){			if(x+sortedCopy[i].tW + border*2>w){				x = 0;				y += maxRowHeight;				maxRowHeight = sortedCopy[i].tH + border*2;				if(y + maxRowHeight > h){					alpha++;					break;				}			}			x+= sortedCopy[i].tW + border*2;			if(i==(int)cps.size()-1) packed = true;		}	}	ofPixels atlasPixels;	atlasPixels.allocate(w,h,2);	atlasPixels.set(0,255);	atlasPixels.set(1,0);	int x=0;	int y=0;	int maxRowHeight = sortedCopy[0].tH + border*2;	for(int i=0;i<(int)cps.size();i++){		ofPixels & charPixels = expanded_data[sortedCopy[i].character];		if(x+sortedCopy[i].tW + border*2>w){			x = 0;			y += maxRowHeight;			maxRowHeight = sortedCopy[i].tH + border*2;		}		cps[sortedCopy[i].character].t2		= float(x + border)/float(w);		cps[sortedCopy[i].character].v2		= float(y + border)/float(h);		cps[sortedCopy[i].character].t1		= float(cps[sortedCopy[i].character].tW + x + border)/float(w);		cps[sortedCopy[i].character].v1		= float(cps[sortedCopy[i].character].tH + y + border)/float(h);		charPixels.pasteInto(atlasPixels,x+border,y+border);		x+= sortedCopy[i].tW + border*2;	}	texAtlas.allocate(atlasPixels.getWidth(),atlasPixels.getHeight(),GL_LUMINANCE_ALPHA,false);	if(bAntiAlised && fontsize>14){		texAtlas.setTextureMinMagFilter(GL_LINEAR,GL_LINEAR);	}else{		texAtlas.setTextureMinMagFilter(GL_NEAREST,GL_NEAREST);	}	texAtlas.loadData(atlasPixels.getPixels(),atlasPixels.getWidth(),atlasPixels.getHeight(),GL_LUMINANCE_ALPHA);	// ------------- close the library and typeface	FT_Done_Face(face);	FT_Done_FreeType(library);  	bLoadedOk = true;}
开发者ID:surflightroy,项目名称:openFrameworks,代码行数:101,


示例9: FT_Get_Postscript_Name

//.........这里部分代码省略.........	char*	pathname;	if (FcPatternGetString(pat, FC_FILE, 0, (FcChar8**)&pathname) != FcResultMatch)		return names;	int index;	if (FcPatternGetInteger(pat, FC_INDEX, 0, &index) != FcResultMatch)		return names;	FT_Face face;	if (FT_New_Face(gFreeTypeLibrary, pathname, index, &face) != 0)		return names;	const char* name = FT_Get_Postscript_Name(face);	if (name == NULL)		return names;	names->psName = name;	// for sfnt containers, we'll read the name table ourselves, not rely on Fontconfig	if (FT_IS_SFNT(face)) {		std::list<std::string>	familyNames;		std::list<std::string>	subFamilyNames;		FT_SfntName	nameRec;		for (index = 0; index < FT_Get_Sfnt_Name_Count(face); ++index) {			char*	utf8name = NULL;			if (FT_Get_Sfnt_Name(face, index, &nameRec) != 0)				continue;			switch (nameRec.name_id) {				case kFontFullName:				case kFontFamilyName:				case kFontStyleName:				case kPreferredFamilyName:				case kPreferredSubfamilyName:					{						bool	preferredName = false;						if (nameRec.platform_id == TT_PLATFORM_MACINTOSH								&& nameRec.encoding_id == TT_MAC_ID_ROMAN && nameRec.language_id == 0) {							utf8name = convertToUtf8(macRomanConv, nameRec.string, nameRec.string_len);							preferredName = true;						}						else if ((nameRec.platform_id == TT_PLATFORM_APPLE_UNICODE)								|| (nameRec.platform_id == TT_PLATFORM_MICROSOFT))							utf8name = convertToUtf8(utf16beConv, nameRec.string, nameRec.string_len);						if (utf8name != NULL) {							std::list<std::string>*	nameList = NULL;							switch (nameRec.name_id) {								case kFontFullName:									nameList = &names->fullNames;									break;								case kFontFamilyName:									nameList = &names->familyNames;									break;								case kFontStyleName:									nameList = &names->styleNames;									break;								case kPreferredFamilyName:									nameList = &familyNames;									break;								case kPreferredSubfamilyName:									nameList = &subFamilyNames;									break;							}							if (preferredName)								prependToList(nameList, utf8name);							else								appendToList(nameList, utf8name);						}					}					break;			}		}		if (familyNames.size() > 0)			names->familyNames = familyNames;		if (subFamilyNames.size() > 0)			names->styleNames = subFamilyNames;	}	else {		index = 0;		while (FcPatternGetString(pat, FC_FULLNAME, index++, (FcChar8**)&name) == FcResultMatch)			appendToList(&names->fullNames, name);		index = 0;		while (FcPatternGetString(pat, FC_FAMILY, index++, (FcChar8**)&name) == FcResultMatch)			appendToList(&names->familyNames, name);		index = 0;		while (FcPatternGetString(pat, FC_STYLE, index++, (FcChar8**)&name) == FcResultMatch)			appendToList(&names->styleNames, name);		if (names->fullNames.size() == 0) {			std::string fullName(names->familyNames.front());			if (names->styleNames.size() > 0) {				fullName += " ";				fullName += names->styleNames.front();			}			names->fullNames.push_back(fullName);		}	}	FT_Done_Face(face);	return names;}
开发者ID:luigiScarso,项目名称:mflua,代码行数:101,


示例10: main

intmain( int     argc,      char**  argv ){  FT_Library    library;  FT_Face       face;  FT_GlyphSlot  slot;  FT_Matrix     matrix;                 /* transformation matrix */  FT_Vector     pen;                    /* untransformed origin  */  FT_Error      error;  char*         filename;//  char*         text;  double        angle;  int           target_height;  int           n, num_chars;  wchar_t *chinese_str = L"ол
C++ FT_Done_FreeType函数代码示例
C++ FT_DivFix函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。