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

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

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

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

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

示例1: main

int main(int argc, char *argv[]) {	int                i, j, err, size, first=' ', last='~',	                   bitmapOffset = 0, x, y, byte;	char              *fontName, c, *ptr;	FT_Library         library;	FT_Face            face;	FT_Glyph           glyph;	FT_Bitmap         *bitmap;	FT_BitmapGlyphRec *g;	GFXglyph          *table;	uint8_t            bit;	// Parse command line.  Valid syntaxes are:	//   fontconvert [filename] [size]	//   fontconvert [filename] [size] [last char]	//   fontconvert [filename] [size] [first char] [last char]	// Unless overridden, default first and last chars are	// ' ' (space) and '~', respectively	if(argc < 3) {		fprintf(stderr, "Usage: %s fontfile size [first] [last]/n",		  argv[0]);		return 1;	}	size = atoi(argv[2]);	if(argc == 4) {		last  = atoi(argv[3]);	} else if(argc == 5) {		first = atoi(argv[3]);		last  = atoi(argv[4]);	}	if(last < first) {		i     = first;		first = last;		last  = i;	}	ptr = strrchr(argv[1], '/'); // Find last slash in filename	if(ptr) ptr++;         // First character of filename (path stripped)	else    ptr = argv[1]; // No path; font in local dir.	// Allocate space for font name and glyph table	if((!(fontName = malloc(strlen(ptr) + 20))) ||	   (!(table = (GFXglyph *)malloc((last - first + 1) *	    sizeof(GFXglyph))))) {		fprintf(stderr, "Malloc error/n");		return 1;	}	// Derive font table names from filename.  Period (filename	// extension) is truncated and replaced with the font size & bits.	strcpy(fontName, ptr);	ptr = strrchr(fontName, '.'); // Find last period (file ext)	if(!ptr) ptr = &fontName[strlen(fontName)]; // If none, append	// Insert font size and 7/8 bit.  fontName was alloc'd w/extra	// space to allow this, we're not sprintfing into Forbidden Zone.	sprintf(ptr, "%dpt%db", size, (last > 127) ? 8 : 7);	// Space and punctuation chars in name replaced w/ underscores.  	for(i=0; (c=fontName[i]); i++) {		if(isspace(c) || ispunct(c)) fontName[i] = '_';	}	// Init FreeType lib, load font	if((err = FT_Init_FreeType(&library))) {		fprintf(stderr, "FreeType init error: %d", err);		return err;	}	if((err = FT_New_Face(library, argv[1], 0, &face))) {		fprintf(stderr, "Font load error: %d", err);		FT_Done_FreeType(library);		return err;	}	// << 6 because '26dot6' fixed-point format	FT_Set_Char_Size(face, size << 6, 0, DPI, 0);	// Currently all symbols from 'first' to 'last' are processed.	// Fonts may contain WAY more glyphs than that, but this code	// will need to handle encoding stuff to deal with extracting	// the right symbols, and that's not done yet.	// fprintf(stderr, "%ld glyphs/n", face->num_glyphs);	printf("package Giza.Bitmap_Fonts.%s is/n/n", fontName);	printf("   %sBitmaps : aliased constant Font_Bitmap := (/n  ",               fontName);	// Process glyphs and output huge bitmap data array	for(i=first, j=0; i<=last; i++, j++) {		// MONO renderer provides clean image with perfect crop		// (no wasted pixels) via bitmap struct.		if((err = FT_Load_Char(face, i, FT_LOAD_TARGET_MONO))) {			fprintf(stderr, "Error %d loading char '%c'/n",			  err, i);			continue;		}//.........这里部分代码省略.........
开发者ID:Fabien-Chouteau,项目名称:Adafruit-GFX-Library,代码行数:101,


示例2: TTF_Init

void TTF_Init(void)	{	if (!TTF_initialized && FT_Init_FreeType(&library))		E_Exit("TTF: Couldn't init FreeType engine");	TTF_initialized = true;	}
开发者ID:catastrophicanomaly,项目名称:vDosXY3,代码行数:6,


示例3: main

/* ------------------------------------------------------------------------- */int main ( int argc, char *argv[] ){    FT_Library  library;    FT_Face     face;    FT_FaceRec  props;    FT_Error    error = 0;    FT_UInt     names;    FT_CharMap  charmap;    FX_Kern_0   *kstable;    TT_OS2      *pOS2;    TT_Postscript *ppost;    ULONG       rc;    BOOL        bDumpUCS = FALSE;    BOOL        bShowKST = FALSE;    BOOL        bShowOS2 = FALSE;    BOOL        bShowPS  = FALSE;    char        szPID[10];    char        szEID[32];    int         i;    char     *buf;    if ( argc < 2 ) {        printf("FONTNAME - Show summary of OpenType font names and other optional information./n");        printf("Syntax: FONTNAME <filename> [ options ]/n/n");        printf("  /D    Dump Unicode and DBCS strings as hex values/n");        printf("  /K    Show kerning summary (KERN format 0 only)/n");        printf("  /O    Show OS/2 table/n");        printf("  /P    Show POST table/n/n");        printf("NAME and CMAP table information is always shown./n/n");        printf("/nNo font file specified./n");        return 0;    }    for ( i = 2; i < argc; i++ ) {        if ( strlen( argv[i] ) > 1 ) {            CHAR cOption = 0;            if ( argv[i][0] == '/' || argv[i][0] == '-') cOption = argv[i][1];            switch ( cOption ) {                case 'd':                case 'D':                    bDumpUCS = TRUE;                    break;                case 'k':                case 'K':                    bShowKST = TRUE;                    break;                case 'o':                case 'O':                    bShowOS2 = TRUE;                    break;                case 'p':                case 'P':                    bShowPS = TRUE;                    break;                default : break;            }        }    }    if (( rc = UniCreateUconvObject( L"@endian=big", &uconv )) != ULS_SUCCESS ) {        printf("Failed to create Unicode conversion object (rc=0x%X)./n");        printf("Unicode text values will not be shown./n");        uconv = NULL;    }    error = FT_Init_FreeType( &library );    if ( error ) {        printf("An error occurred during library initialization./n");        return (int) error;    }    printf("FreeType 2 library initialized successfully./n");    error = FT_New_Face( library, argv[1], 0, &face );    if ( error ) {        if ( error == FT_Err_Unknown_File_Format )            printf("The file format is unsupported./n");        else            printf("The file /"%s/" could not be loaded./n", argv[1]);        goto done;    }    printf("Font %s read successfully./n", face->family_name );    names = FT_Get_Sfnt_Name_Count( face );    if ( names ) {        printf("Names table contains %d entries:/n", names );        for ( i = 0; i < names; i++ ) {            FT_SfntName name;            error = FT_Get_Sfnt_Name( face, i, &name );            if ( error ) continue;            printf("%2d: Plat %d, Enc %d, Lang 0x%X, ID %2d ",                   i, name.platform_id, name.encoding_id, name.language_id, name.name_id );            if ( name.platform_id == 1 && name.encoding_id == 0 && name.string_len < 100 ) {                printf(" /"");                PrintNameString( name.string, name.string_len );                printf("/"/n");            }            else if ( name.platform_id == 3 && name.encoding_id == 1 && uconv && name.string_len < 200 ) {//.........这里部分代码省略.........
开发者ID:OS2World,项目名称:DRV-FreeType-2_IFI-Fork,代码行数:101,


示例4: FontProvider

	FreetypeFontProvider::FreetypeFontProvider(const FontProvider::Options& options): FontProvider(options)	{		if ( options.size.height < 1 )		{			throw std::runtime_error("[FreetypeFontProvider] Invalid size");		}		if ( options.mode == L"" || options.mode == L"normal" )		{			m_render_mode = FT_RENDER_MODE_NORMAL;		}		else if ( options.mode == L"monochrome" )		{			m_render_mode = FT_RENDER_MODE_MONO;		}		else if ( options.mode == L"lcd" )		{			m_render_mode = FT_RENDER_MODE_LCD;		}		else		{			throw std::runtime_error("[FreetypeFontProvider] Invalid font.mode");		}		if ( FT_Init_FreeType(&m_font_library) )		{			throw std::runtime_error("[FreetypeFontProvider] Can't initialize Freetype");		}		std::string filename_u8 = Encoding::UTF8.FromUCS2(options.name);		if ( FT_New_Face(m_font_library, filename_u8.c_str(), 0, &m_font_face) )		{			Dispose();			throw std::runtime_error("[FreetypeFontProvider] Can't load font from file");		}		int hres = 64;		FT_Matrix matrix =		{			(int)((1.0/hres) * 0x10000L),			(int)((0.0)      * 0x10000L),			(int)((0.0)      * 0x10000L),			(int)((1.0)      * 0x10000L)		};		if ( FT_Set_Char_Size(m_font_face, (uint32_t)(options.size.height*64), 0, 96*hres, 96) )		{			Dispose();			throw std::runtime_error("[FreetypeFontProvider] Can't setup font");		}		FT_Set_Transform(m_font_face, &matrix, NULL);		float yscale = m_font_face->size->metrics.y_scale / (float)(1 << 16);		int height = std::ceil((m_font_face->bbox.yMax-m_font_face->bbox.yMin) * yscale / 64.0f);		//int descender = std::floor(m_font_face->descender * yscale / 64.0f);		//int ascender = std::ceil(m_font_face->ascender * yscale / 64.0f);		auto get_metrics = [&](wchar_t code) -> FT_Glyph_Metrics		{			if ( FT_Load_Glyph(m_font_face, FT_Get_Char_Index(m_font_face, code), 0) )			{				throw std::runtime_error("[FreetypeFontProvider] Metrics error");			}			return m_font_face->glyph->metrics;		};		int width = 0;		FT_Glyph_Metrics mDot = get_metrics(L'.'), mAt = get_metrics(L'@');		if ( mDot.horiAdvance == mAt.horiAdvance )		{			// Monospace font			width = std::ceil(mDot.horiAdvance / 64.0f);		}		else		{			// This is not a monospace font			//throw std::runtime_error("[FreetypeFontProvider::ctor] This is not a monospace font");			width = std::ceil(mAt.horiAdvance / 64.0f);		}		width = std::ceil(width/64.0);		height = m_font_face->size->metrics.height >> 6;		//descender = m_font_face->size->metrics.descender >> 6;		m_cell_size = Size(width, height);		m_glyph_size = Size(width, height);		FT_Library_SetLcdFilter(m_font_library, FT_LCD_FILTER_DEFAULT);				return;	}
开发者ID:basmith,项目名称:BearLibTerminal,代码行数:95,


示例5: Exception

Font::Font(){    if(FT_Init_FreeType(&library))        throw love::Exception("TrueTypeFont Loading error: FT_Init_FreeType failed/n");}
开发者ID:edselmalasig,项目名称:love-native-android,代码行数:5,


示例6: FT_Init_FreeType

tgon::FTFontManager::FTFontManager( ){	FT_Init_FreeType( &library );}
开发者ID:ggomdyu,项目名称:TGON_ModelJoy,代码行数:4,


示例7: get_font

//******************** M A I N ************************void get_font(string FontName_base, char letter, int ptsize, vect2d *times){    _mkdir("font_rasters");    std::string FontName = "fonts/" + FontName_base + ".ttf";    char buf[256];    string letter_name;    letter_name += letter;    if (letter >= 'A' && letter <= 'Z')        letter_name += letter;    //-----------------------------------------    // Load contour of glyph    //-----------------------------------------    lines.clear();    bez2s.clear();    FT_Face face;    FT_Library    library;    FT_Error error;    error = FT_Init_FreeType( &library );    Check(error, "", "error initializing FT lib");    error = FT_New_Face( library, FontName.c_str(), 0, &face );    Check(error, "",  "error loading font");    FT_F26Dot6 font_size = ptsize*64;    error = FT_Set_Char_Size( face, font_size, font_size, 72, 72 );    Check(error, "", "error setting char size");    FT_UInt   glyph_index = FT_Get_Char_Index( face, letter );    FT_Int32  load_flags = FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;    error = FT_Load_Glyph( face,  glyph_index, load_flags );    Check(error, "", "error loading glyph");    FT_Glyph glyph;    error = FT_Get_Glyph( face->glyph, &glyph );    Check(error, "", "error getting glyph");    FT_OutlineGlyph Outg;    error = GetOutLine(glyph, &Outg);    Check(error,"", "error getting outline");    // use my own callcacks to walk over the contour    FT_Outline_Funcs func_interface;    func_interface.shift = 0;    func_interface.delta = 0;    func_interface.move_to = move_to;    func_interface.line_to = line_to;    func_interface.conic_to = conic_to;    func_interface.cubic_to = cubic_to;    FT_Outline_Decompose(&Outg->outline, &func_interface, 0);    //-----------------------------------------    // Rasterize using FreeType    //-----------------------------------------    // rasterize using FreeType so that a comparison to my code can be made    double t_ft_start = get_time();    FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);    double t_ft_stop = get_time();    // save timing    FILE *fa = fopen("timings.txt", "a");    fprintf(fa, "time FreeType = %f/n", t_ft_stop - t_ft_start);    fclose(fa);    // create grid / calculate resolution    g.max_depth = 0;    g.grid_res = 2;    int maxsize = max(face->glyph->bitmap.width, face->glyph->bitmap.rows);    while (g.grid_res < maxsize)    {        g.grid_res *= 2;        g.max_depth++;    }    vect2i offset;    offset.set((g.grid_res - face->glyph->bitmap.width) / 2, (g.grid_res - face->glyph->bitmap.rows) / 2);    // copy bitmap into a buffer    Array2D<vect3ub> ftgrid;    ftgrid.resize(g.grid_res, g.grid_res);    for (int k = 0; k < g.grid_res*g.grid_res; k++)        ftgrid.data[k].set(0);    for (int j = 0; j < face->glyph->bitmap.rows; j++)    {        unsigned char *row = face->glyph->bitmap.buffer + (face->glyph->bitmap.rows-j-1)*face->glyph->bitmap.pitch;        for (int i = 0; i < face->glyph->bitmap.width; i++)        {            ftgrid(i + offset[0], j + offset[1]) = row[i];        }    }//.........这里部分代码省略.........
开发者ID:uygned,项目名称:will-apps,代码行数:101,


示例8: main

int main (int argc, char** argv){    if (argc != 2)    {        std::cerr << "Usage: " << argv[0] << " <num-iter>" << std::endl;        return EXIT_FAILURE;    }    const unsigned NUM_ITER = atoi(argv[1]);    // open first face in the font    FT_Library ft_library = 0;    FT_Error error = FT_Init_FreeType(&ft_library);    if (error) throw std::runtime_error("Failed to initialize FreeType2 library");    FT_Face ft_face[NUM_EXAMPLES];    FT_New_Face(ft_library, "fonts/DejaVuSerif.ttf", 0, &ft_face[ENGLISH]);    FT_New_Face(ft_library, "fonts/amiri-0.104/amiri-regular.ttf", 0, &ft_face[ARABIC]);    FT_New_Face(ft_library, "fonts/fireflysung-1.3.0/fireflysung.ttf", 0, &ft_face[CHINESE]);    // Get our harfbuzz font structs    hb_font_t *hb_ft_font[NUM_EXAMPLES];    hb_ft_font[ENGLISH] = hb_ft_font_create(ft_face[ENGLISH], NULL);    hb_ft_font[ARABIC]  = hb_ft_font_create(ft_face[ARABIC] , NULL);    hb_ft_font[CHINESE] = hb_ft_font_create(ft_face[CHINESE], NULL);    {        std::cerr << "Starting ICU shaping:" << std::endl;        progress_timer timer1(std::clog,"ICU shaping done");        UErrorCode err = U_ZERO_ERROR;        for (unsigned i = 0; i < NUM_ITER; ++i)        {            for (unsigned j = 0; j < NUM_EXAMPLES; ++j)            {                UnicodeString text = UnicodeString::fromUTF8(texts[j]);                int32_t length = text.length();                UnicodeString reordered;                UnicodeString shaped;                UBiDi *bidi = ubidi_openSized(length, 0, &err);                ubidi_setPara(bidi, text.getBuffer(), length, UBIDI_DEFAULT_LTR, 0, &err);                ubidi_writeReordered(bidi, reordered.getBuffer(length),                                     length, UBIDI_DO_MIRRORING, &err);                ubidi_close(bidi);                reordered.releaseBuffer(length);                u_shapeArabic(reordered.getBuffer(), length,                              shaped.getBuffer(length), length,                              U_SHAPE_LETTERS_SHAPE | U_SHAPE_LENGTH_FIXED_SPACES_NEAR |                              U_SHAPE_TEXT_DIRECTION_VISUAL_LTR, &err);                shaped.releaseBuffer(length);                if (U_SUCCESS(err))                {                    U_NAMESPACE_QUALIFIER StringCharacterIterator iter(shaped);                    for (iter.setToStart(); iter.hasNext();)                    {                        UChar ch = iter.nextPostInc();                        int32_t glyph_index = FT_Get_Char_Index(ft_face[j], ch);                        if (i == 0)                        {                            std::cerr << glyph_index <<  ":";                        }                    }                    if (i == 0) std::cerr << std::endl;                }            }        }    }    {        const char **shaper_list = hb_shape_list_shapers();        for ( ;*shaper_list; shaper_list++)        {            std::cerr << *shaper_list << std::endl;        }        std::cerr << "Starting Harfbuzz shaping" << std::endl;        progress_timer timer2(std::clog,"Harfbuzz shaping done");        const char* const shapers[]  = { /*"ot",*/"fallback" };        hb_buffer_t *buffer(hb_buffer_create());        for (unsigned i = 0; i < NUM_ITER; ++i)        {            for (unsigned j = 0; j < NUM_EXAMPLES; ++j)            {                UnicodeString text = UnicodeString::fromUTF8(texts[j]);                int32_t length = text.length();                hb_buffer_clear_contents(buffer);                //hb_buffer_set_unicode_funcs(buffer.get(), hb_icu_get_unicode_funcs());                hb_buffer_pre_allocate(buffer, length);                hb_buffer_add_utf16(buffer, text.getBuffer(), text.length(), 0, length);                hb_buffer_set_direction(buffer, text_directions[j]);                hb_buffer_set_script(buffer, scripts[j]);                hb_buffer_set_language(buffer,hb_language_from_string(languages[j], std::strlen(languages[j])));                //hb_shape(hb_ft_font[j], buffer.get(), 0, 0);                hb_shape_full(hb_ft_font[j], buffer, 0, 0, shapers);                unsigned num_glyphs = hb_buffer_get_length(buffer);                hb_glyph_info_t *glyphs = hb_buffer_get_glyph_infos(buffer, NULL);                //hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer.get(), NULL);                for (unsigned k=0; k<num_glyphs; ++k)                {                    int32_t glyph_index = glyphs[k].codepoint;//.........这里部分代码省略.........
开发者ID:artemp,项目名称:harfbuzz-icu-shaping,代码行数:101,


示例9: main

int main (int argc, char **argv){	int i,j,found=0,m,mask=1,kmode=1,pmode=0, lc=-1, changed=0, todo=1, help=1, help_changed=0, move=0;	unsigned char actchan[20]=""/*,channel[128]=""*/;	FILE *fh,*fh2;	char *cpt1,*cpt2;	gpixel mp, mc[MAX_MASK], tp;	int tsx=430, tsy=120, tdy=24, tsz=28, txw=500, tcol=TURQUOISE;	int xp[MAX_MASK][8],yp[MAX_MASK][8],xw[MAX_MASK][8],yw[MAX_MASK][8],valid[MAX_MASK],cmc[MAX_MASK],xxp,xxw,yyp,yyw,nmsk=0,amsk=0;	double xs=1.0, ys=1.0;	time_t t1,t2;		for(j=0; j<MAX_MASK; j++)		{			valid[j]=0;			cmc[j]=BLACK;			make_color(BLACK, &mc[j]);			for(i=0; i<8; i++)			{				xp[j][i]=(1280-40)/2;				xw[j][i]=40;				yp[j][i]=(720-20)/2;				yw[j][i]=20;			}			}		system("pzapit -var > /tmp/logomaskset.stat");		if((fh=fopen("/tmp/logomaskset.stat","r"))!=NULL)		{			if(fgets(tstr,500,fh))			{				TrimString(tstr);				if(strlen(tstr))				{					if(sscanf(tstr+strlen(tstr)-1,"%d",&pmode)!=1)					{						pmode=0;					}				}			}			fclose(fh);		}			system("touch /tmp/.logomask_kill");		fb = open(FB_DEVICE, O_RDWR);		if(ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1)		{			printf("logomask <FBIOGET_FSCREENINFO failed>/n");			return -1;		}		if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1)		{			printf("logomask <FBIOGET_VSCREENINFO failed>/n");			return -1;		}				if(!(lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0)))		{			printf("logomask <mapping of Framebuffer failed>/n");			return -1;		}	//init fontlibrary		if((error = FT_Init_FreeType(&library)))		{			printf("logomask <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("logomask <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("logomask <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_LookupFace(manager, FONT, &face)))		{			printf("logomask <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);//.........这里部分代码省略.........
开发者ID:coolstreamtech,项目名称:cst-public-plugins-logomask,代码行数:101,


示例10: Create

/***************************************************************************** * Create: allocates osd-text video thread output method ***************************************************************************** * This function allocates and initializes a Clone vout method. *****************************************************************************/static int Create( vlc_object_t *p_this ){    filter_t *p_filter = (filter_t *)p_this;    filter_sys_t *p_sys;    char *psz_fontfile = NULL;    int i, i_error;    int i_fontsize = 0;    vlc_value_t val;    /* Allocate structure */    p_sys = malloc( sizeof( filter_sys_t ) );    if( !p_sys )    {        msg_Err( p_filter, "out of memory" );        return VLC_ENOMEM;    }    p_sys->p_face = 0;    p_sys->p_library = 0;    for( i = 0; i < 256; i++ )    {        p_sys->pi_gamma[i] = (uint8_t)( pow( (double)i * 255.0f, 0.5f ) );    }    var_Create( p_filter, "freetype-font",                VLC_VAR_STRING | VLC_VAR_DOINHERIT );    var_Create( p_filter, "freetype-fontsize",                VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );    var_Create( p_filter, "freetype-rel-fontsize",                VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );    /* Look what method was requested */    var_Get( p_filter, "freetype-font", &val );    psz_fontfile = val.psz_string;    if( !psz_fontfile || !*psz_fontfile )    {        if( psz_fontfile ) free( psz_fontfile );        psz_fontfile = (char *)malloc( PATH_MAX + 1 );#ifdef WIN32        GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 );        strcat( psz_fontfile, "//fonts//arial.ttf" );#elif SYS_DARWIN        strcpy( psz_fontfile, DEFAULT_FONT );#else        msg_Err( p_filter, "user didn't specify a font" );        goto error;#endif    }    i_error = FT_Init_FreeType( &p_sys->p_library );    if( i_error )    {        msg_Err( p_filter, "couldn't initialize freetype" );        goto error;    }    i_error = FT_New_Face( p_sys->p_library, psz_fontfile ? psz_fontfile : "",                           0, &p_sys->p_face );    if( i_error == FT_Err_Unknown_File_Format )    {        msg_Err( p_filter, "file %s have unknown format", psz_fontfile );        goto error;    }    else if( i_error )    {        msg_Err( p_filter, "failed to load font file %s", psz_fontfile );        goto error;    }    i_error = FT_Select_Charmap( p_sys->p_face, ft_encoding_unicode );    if( i_error )    {        msg_Err( p_filter, "Font has no unicode translation table" );        goto error;    }    p_sys->i_use_kerning = FT_HAS_KERNING( p_sys->p_face );    var_Get( p_filter, "freetype-fontsize", &val );    if( val.i_int )    {        i_fontsize = val.i_int;    }    else    {        var_Get( p_filter, "freetype-rel-fontsize", &val );        i_fontsize = (int)p_filter->fmt_out.video.i_height / val.i_int;    }    if( i_fontsize <= 0 )    {        msg_Warn( p_filter, "Invalid fontsize, using 12" );        i_fontsize = 12;    }    msg_Dbg( p_filter, "Using fontsize: %i", i_fontsize);//.........这里部分代码省略.........
开发者ID:forthyen,项目名称:SDesk,代码行数:101,


示例11: dump_dependencies

static voiddump_dependencies(void){#ifdef __GNUC__  g_print ("Compiler: GCC " __VERSION__ "/n");#elif defined _MSC_VER  g_print ("Compiler: MSC %d/n", _MSC_VER);#else  g_print ("Compiler: unknown/n");#endif  /* some flags/defines which may be interesting */  g_print ("  with : "#ifdef G_THREADS_ENABLED  "threads "#endif#ifdef HAVE_CAIRO  "cairo "#endif#ifdef HAVE_GNOME  "gnome "#endif#ifdef HAVE_LIBART  "libart "#endif#ifdef HAVE_PANGOCAIRO  "pangocairo "#endif  "/n");  /* print out all those dependies, both compile and runtime if possible    * Note: this is not meant to be complete but does only include libaries    * which may or have cause(d) us trouble in some versions    */  g_print ("Library versions (at compile time)/n");#ifdef HAVE_LIBPNG  g_print ("libpng  : %s (%s)/n", png_get_header_ver(NULL), PNG_LIBPNG_VER_STRING);#endif#ifdef HAVE_FREETYPE  {    FT_Library ft_library;    FT_Int     ft_major_version;    FT_Int     ft_minor_version;    FT_Int     ft_micro_version;    if (FT_Init_FreeType (&ft_library) == 0) {      FT_Library_Version (ft_library,                          &ft_major_version,                          &ft_minor_version,                          &ft_micro_version);      g_print ("freetype: %d.%d.%d/n", ft_major_version, ft_minor_version, ft_micro_version);      FT_Done_FreeType (ft_library);    }    else      g_print ("freetype: ?.?.?/n");  }#endif  {    const gchar* libxml_rt_version = "?";#if 0    /* this is stupid, does not compile on Linux:     * app_procs.c:504: error: expected identifier before '(' token     *     * In fact libxml2 has different ABI for LIBXML_THREAD_ENABLED, this code only compiles without     * threads enabled, but apparently it does only work when theay are.     */    xmlInitParser();    if (xmlGetGlobalState())      libxml_rt_version = xmlGetGlobalState()->xmlParserVersion;#endif    libxml_rt_version = xmlParserVersion;    if (atoi(libxml_rt_version))      g_print ("libxml  : %d.%d.%d (%s)/n",                atoi(libxml_rt_version) / 10000, atoi(libxml_rt_version) / 100 % 100, atoi(libxml_rt_version) % 100,	       LIBXML_DOTTED_VERSION);    else /* may include "extra" */      g_print ("libxml  : %s (%s)/n", libxml_rt_version ? libxml_rt_version : "??", LIBXML_DOTTED_VERSION);  }  g_print ("glib    : %d.%d.%d (%d.%d.%d)/n",            glib_major_version, glib_minor_version, glib_micro_version,           GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);#ifdef PANGO_VERSION_ENCODE  g_print ("pango   : %s (%d.%d.%d)/n", pango_version_string(), PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR, PANGO_VERSION_MICRO);#else  g_print ("pango   : version not available (>= 1.14.x)/n"); /* Pango did not provide such */#endif#if HAVE_CAIRO#  ifdef CAIRO_VERSION_STRING  g_print ("cairo   : %s (%s)/n", cairo_version_string(), CAIRO_VERSION_STRING);#  else  g_print ("cairo   : %s (%d.%d.%d)/n", cairo_version_string(), CAIRO_VERSION_MAJOR, CAIRO_VERSION_MINOR, CAIRO_VERSION_MICRO);#  endif#endif#if 0  {    gchar  linkedname[1024];    gint   len = 0;    /* relying on PREFIX is wrong */    if ((len = readlink (PREFIX "/lib/libpango-1.0.so", linkedname, 1023)) > 0) {//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:dia,代码行数:101,


示例12: FT_Init_FreeType

//-----------------------------------------------------------------------------// Get the list of available font filenames, and load the name for each of// them. Only that, though, not the glyphs too.//-----------------------------------------------------------------------------TtfFontList::TtfFontList() {    FT_Init_FreeType(&fontLibrary);}
开发者ID:Kenzu,项目名称:solvespace,代码行数:7,


示例13: FT_Init_FreeType

Font::LibraryParameter::LibraryParameter() {    FT_Error error = FT_Init_FreeType(&library);    // Throw an exception if the library failed    //if (error)}
开发者ID:jonathanbuchanan,项目名称:Sunglasses,代码行数:6,


示例14: main

intmain(int argc, char **argv){    FT_Error error;    FT_Library library;    FT_Face face;    GFile *file;    gchar *font_file, *title;    gint row;    GtkWidget *window, *hbox, *table, *swin, *drawing_area;    GdkColor white = { 0, 0xffff, 0xffff, 0xffff };    GtkWidget *button, *align;    bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");    textdomain(GETTEXT_PACKAGE);    gtk_init(&argc, &argv);    if (argc != 2) {	g_printerr(_("usage: %s fontfile/n"), argv[0]);	return 1;    }    if (!XftInitFtLibrary()) {	g_printerr("could not initialise freetype library/n");	return 1;    }    error = FT_Init_FreeType(&library);    if (error) {	g_printerr("could not initialise freetype/n");	return 1;    }    file = g_file_new_for_commandline_arg (argv[1]);    font_file = g_file_get_uri (file);    g_object_unref (file);    if (!font_file) {	g_printerr("could not parse argument into a URI/n");	return 1;    }    error = FT_New_Face_From_URI(library, font_file, 0, &face);    if (error) {	g_printerr("could not load face '%s'/n", font_file);	return 1;    }    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);    title = g_strconcat(face->family_name,			face->style_name ? ", " : "",			face->style_name, NULL);    gtk_window_set_title(GTK_WINDOW(window), title);    set_icon(GTK_WINDOW(window), font_file);    g_free(title);    gtk_window_set_resizable(GTK_WINDOW(window), TRUE);    hbox = gtk_hbox_new(FALSE, 0);    gtk_container_add(GTK_CONTAINER(window), hbox);    swin = gtk_scrolled_window_new(NULL, NULL);    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),				   GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);    gtk_box_pack_start(GTK_BOX(hbox), swin, TRUE, TRUE, 0);    drawing_area = gtk_drawing_area_new();    gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &white);    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin),					  drawing_area);#if !GTK_CHECK_VERSION (3, 0, 0)    g_signal_connect (drawing_area, "realize", G_CALLBACK(create_text_pixmap), face);#endif    /* set the minimum size on the scrolled window to prevent     * unnecessary scrolling */    gtk_widget_set_size_request(swin, 500, -1);    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);    table = gtk_table_new(1, 2, FALSE);    gtk_container_set_border_width(GTK_CONTAINER(table), 5);    gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, TRUE, 0);    row = 0;    add_face_info(table, &row, font_file, face);    /* add install button */    align = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);    gtk_table_attach (GTK_TABLE (table), align, 0, 2, row, row + 1,                      GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);    button = gtk_button_new_with_mnemonic (_("I_nstall Font"));    g_signal_connect (button, "clicked",                      G_CALLBACK (install_button_clicked_cb), font_file);    gtk_container_add (GTK_CONTAINER (align), button);    gtk_table_set_col_spacings(GTK_TABLE(table), 8);//.........这里部分代码省略.........
开发者ID:City-busz,项目名称:mate-control-center,代码行数:101,


示例15: FT_Init_FreeType

Error DynamicFontAtSize::_load() {	int error = FT_Init_FreeType( &library );	ERR_EXPLAIN(TTR("Error initializing FreeType."));	ERR_FAIL_COND_V( error !=0, ERR_CANT_CREATE );	if (font->font_path!=String()) {		FileAccess *f=FileAccess::open(font->font_path,FileAccess::READ);		ERR_FAIL_COND_V(!f,ERR_CANT_OPEN);		memset(&stream,0,sizeof(FT_StreamRec));		stream.base=NULL;		stream.size=f->get_len();		stream.pos=0;		stream.descriptor.pointer=f;		stream.read=_ft_stream_io;		stream.close=_ft_stream_close;		FT_Open_Args fargs;		memset(&fargs,0,sizeof(FT_Open_Args));		fargs.flags=FT_OPEN_STREAM;		fargs.stream=&stream;		error = FT_Open_Face( library,&fargs,0,&face);	} else if (font->font_mem) {		memset(&stream,0,sizeof(FT_StreamRec));		stream.base=(unsigned char*)font->font_mem;		stream.size=font->font_mem_size;		stream.pos=0;		FT_Open_Args fargs;		memset(&fargs,0,sizeof(FT_Open_Args));		fargs.memory_base=(unsigned char*)font->font_mem;		fargs.memory_size=font->font_mem_size;		fargs.flags= FT_OPEN_MEMORY;		fargs.stream=&stream;		error = FT_Open_Face( library,&fargs,0,&face);	} else {		ERR_EXPLAIN("DynamicFont uninitialized");		ERR_FAIL_V(ERR_UNCONFIGURED);	}	//error = FT_New_Face( library, src_path.utf8().get_data(),0,&face );	if ( error == FT_Err_Unknown_File_Format ) {		ERR_EXPLAIN(TTR("Unknown font format."));		FT_Done_FreeType( library );	} else if ( error ) {		ERR_EXPLAIN(TTR("Error loading font."));		FT_Done_FreeType( library );	}	ERR_FAIL_COND_V(error,ERR_FILE_CANT_OPEN);	/*error = FT_Set_Char_Size(face,0,64*size,512,512);	if ( error ) {		FT_Done_FreeType( library );		ERR_EXPLAIN(TTR("Invalid font size."));		ERR_FAIL_COND_V( error, ERR_INVALID_PARAMETER );	}*/	error = FT_Set_Pixel_Sizes(face,0,size);	ascent=face->size->metrics.ascender>>6;	descent=-face->size->metrics.descender>>6;	linegap=0;	//print_line("ASCENT: "+itos(ascent)+" descent "+itos(descent)+" hinted: "+itos(face->face_flags&FT_FACE_FLAG_HINTER));	valid=true;	return OK;}
开发者ID:noidexe,项目名称:godot,代码行数:81,


示例16: fb_font_init

/* initialise font handling */bool fb_font_init(void){        FT_Error error;        FT_ULong max_cache_size;        FT_UInt max_faces = 6;	fb_faceid_t *fb_face;LOG(("Freetype init..."));	nsoptions.fb_font_monochrome = false;				nsoptions.fb_font_cachesize = 2048;				nsoptions.fb_face_sans_serif = NULL;				nsoptions.fb_face_sans_serif_bold = NULL;			nsoptions.fb_face_sans_serif_italic = NULL;			nsoptions.fb_face_sans_serif_italic_bold = NULL;			nsoptions.fb_face_serif = NULL;					nsoptions.fb_face_serif_bold = NULL;				nsoptions.fb_face_monospace = NULL;				nsoptions.fb_face_monospace_bold = NULL;				nsoptions.fb_face_cursive = NULL;				nsoptions.fb_face_fantasy = NULL;		        /* freetype library initialise */        error = FT_Init_FreeType( &library );         if (error) {                LOG(("Freetype could not initialised (code %d)/n", error));                return false;        }        /* set the Glyph cache size up */        max_cache_size = nsoption_int(fb_font_cachesize) * 1024; 	if (max_cache_size < CACHE_MIN_SIZE) {		max_cache_size = CACHE_MIN_SIZE;	}LOG(("Freetype cache..."));DBG("Ft cache/n");        /* cache manager initialise */        error = FTC_Manager_New(library,                                 max_faces,                                 0,                                 max_cache_size,                                 ft_face_requester,                                 NULL,                                 &ft_cmanager);        if (error) {                LOG(("Freetype could not initialise cache manager (code %d)/n", error));                FT_Done_FreeType(library);                return false;        }LOG(("Freetype map cache..."));DBG("Ft map cache/n");        error = FTC_CMapCache_New(ft_cmanager, &ft_cmap_cache);        error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);	/* need to obtain the generic font faces */LOG(("Freetype load fonts..."));DBG("Ft load fonts/n");	/* Start with the sans serif font */	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif),			      "sans_serif.ttf",			      NETSURF_FB_FONT_SANS_SERIF);	if (fb_face == NULL) {		LOG(("Freetype load fonts failed due SANS unavailable :(..."));DBG("Ft Z:(((/n");		/* The sans serif font is the default and must be found. */                LOG(("Could not find the default font/n"));                FTC_Manager_Done(ft_cmanager);                FT_Done_FreeType(library);                return false;        } else {		fb_faces[FB_FACE_SANS_SERIF] = fb_face;	}LOG(("Freetype loaded sans.."));DBG("Ft sans loaded:)/n");	/* Bold sans serif face */	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif_bold),                            "sans_serif_bold.ttf",                            NETSURF_FB_FONT_SANS_SERIF_BOLD);	if (fb_face == NULL) {		/* seperate bold face unavailabe use the normal weight version */		fb_faces[FB_FACE_SANS_SERIF_BOLD] = fb_faces[FB_FACE_SANS_SERIF];	} else {		fb_faces[FB_FACE_SANS_SERIF_BOLD] = fb_face;	}	/* Italic sans serif face */	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif_italic),//.........这里部分代码省略.........
开发者ID:ChokshiUtsav,项目名称:kolibriosSVN,代码行数:101,


示例17: load_glyph

// ------------------------------------------------------------- load_glyph ---texture_glyph_t *load_glyph( const char *  filename,     const wchar_t charcode,            const float   highres_size, const float   lowres_size,            const float   padding ){    size_t i, j;    FT_Library library;    FT_Face face;    FT_Init_FreeType( &library );    FT_New_Face( library, filename, 0, &face );    FT_Select_Charmap( face, FT_ENCODING_UNICODE );    FT_UInt glyph_index = FT_Get_Char_Index( face, charcode );    // Render glyph at high resolution (highres_size points)    FT_Set_Char_Size( face, highres_size*64, 0, 72, 72 );    FT_Load_Glyph( face, glyph_index,                   FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT);    FT_GlyphSlot slot = face->glyph;    FT_Bitmap bitmap = slot->bitmap;    // Allocate high resolution buffer    size_t highres_width  = bitmap.width + 2*padding*highres_size;    size_t highres_height = bitmap.rows + 2*padding*highres_size;    double * highres_data = (double *) malloc( highres_width*highres_height*sizeof(double) );    memset( highres_data, 0, highres_width*highres_height*sizeof(double) );    // Copy high resolution bitmap with padding and normalize values    for( j=0; j < bitmap.rows; ++j )    {        for( i=0; i < bitmap.width; ++i )        {            int x = i + padding;            int y = j + padding;            highres_data[y*highres_width+x] = bitmap.buffer[j*bitmap.width+i]/255.0;        }    }    // Compute distance map    distance_map( highres_data, highres_width, highres_height );    // Allocate low resolution buffer    size_t lowres_width  = round(highres_width * lowres_size/highres_size);    size_t lowres_height = round(highres_height * lowres_width/(float) highres_width);    double * lowres_data = (double *) malloc( lowres_width*lowres_height*sizeof(double) );    memset( lowres_data, 0, lowres_width*lowres_height*sizeof(double) );    // Scale down highres buffer into lowres buffer    resize( highres_data, highres_width, highres_height,            lowres_data,  lowres_width,  lowres_height );    // Convert the (double *) lowres buffer into a (unsigned char *) buffer and    // rescale values between 0 and 255.    unsigned char * data =        (unsigned char *) malloc( lowres_width*lowres_height*sizeof(unsigned char) );    for( j=0; j < lowres_height; ++j )    {        for( i=0; i < lowres_width; ++i )        {            double v = lowres_data[j*lowres_width+i];            data[j*lowres_width+i] = (int) (255*(1-v));        }    }    // Compute new glyph information from highres value    float ratio = lowres_size / highres_size;    size_t pitch  = lowres_width * sizeof( unsigned char );    // Create glyph    texture_glyph_t * glyph = texture_glyph_new( );    glyph->offset_x = (slot->bitmap_left + padding*highres_width) * ratio;    glyph->offset_y = (slot->bitmap_top + padding*highres_height) * ratio;    glyph->width    = lowres_width;    glyph->height   = lowres_height;    glyph->charcode = charcode;    /*    printf( "Glyph width:  %ld/n", glyph->width );    printf( "Glyph height: %ld/n", glyph->height );    printf( "Glyph offset x: %d/n", glyph->offset_x );    printf( "Glyph offset y: %d/n", glyph->offset_y );    */    ivec4 region = texture_atlas_get_region( atlas, glyph->width, glyph->height );    /*    printf( "Region x : %d/n", region.x );    printf( "Region y : %d/n", region.y );    printf( "Region width : %d/n", region.width );    printf( "Region height : %d/n", region.height );    */    texture_atlas_set_region( atlas, region.x, region.y, glyph->width, glyph->height, data, pitch );    glyph->s0       = region.x/(float)atlas->width;    glyph->t0       = region.y/(float)atlas->height;    glyph->s1       = (region.x + glyph->width)/(float)atlas->width;    glyph->t1       = (region.y + glyph->height)/(float)atlas->height;    FT_Load_Glyph( face, glyph_index,                   FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT);    glyph->advance_x = ratio * face->glyph->advance.x/64.0;    glyph->advance_y = ratio * face->glyph->advance.y/64.0;    /*//.........这里部分代码省略.........
开发者ID:BlockoS,项目名称:freetype-gl,代码行数:101,


示例18: OpenGLFont_Implementation

/*** Init and load font**/OpenGLFont::OpenGLFont(RenderOpenGL* render, string name, Mod* mod, float size){	int error;	// Basics	this->pmpl = new OpenGLFont_Implementation();	this->render = render;	this->size = size;	// Init freetype	// TODO: Should we share the tf ptr between OpenGLFont instances	error = FT_Init_FreeType(&this->pmpl->ft);	if (error) {		reportFatalError("Freetype: Unable to init library.");	}	// On Linux, the system font is found using fontconfig	#if defined(__linux__)		FcConfig* config = FcInitLoadConfigAndFonts();		FcPattern* pat = FcPatternBuild(			NULL,			FC_FAMILY, FcTypeString, reinterpret_cast<const char*>(name.c_str()),			NULL		);		FcConfigSubstitute(config, pat, FcMatchPattern);		FcDefaultSubstitute(pat);		FcResult result;		FcPattern* font = FcFontMatch(config, pat, &result);		if (font == NULL) {			reportFatalError("Fontconfig: Unable to find font " + name);		}		FcChar8* filename = NULL;		if (FcPatternGetString(font, FC_FILE, 0, &filename) != FcResultMatch) {			reportFatalError("Fontconfig: No filename in fontconfig match");		}		error = FT_New_Face(this->pmpl->ft, reinterpret_cast<const char*>(filename), 0, &this->pmpl->face);		FcPatternDestroy(font);		FcPatternDestroy(pat);	#else		// All other systems use a file in the cr/ mod		Sint64 len;		name.append(".ttf");		this->pmpl->buf = mod->loadBinary(name, &len);		if (this->pmpl->buf == NULL) {			reportFatalError("Freetype: Unable to load data");		}		error = FT_New_Memory_Face(this->pmpl->ft, (const FT_Byte *) this->pmpl->buf, (FT_Long)len, 0, &this->pmpl->face);	#endif	// Handle errors	if (error == FT_Err_Unknown_File_Format) {		reportFatalError("Freetype: Unsupported font format");	} else if (error) {		reportFatalError("Freetype: Unable to load font");	}	// Set character size	error = FT_Set_Char_Size(this->pmpl->face, 0, size * 64, 72, 72);	if (error) {		reportFatalError("Freetype: Unable to load font size");	}}
开发者ID:TheJosh,项目名称:chaotic-rage,代码行数:72,


示例19: if

bool FT2Font::init(){    unsigned err;    if( ( err = FT_Init_FreeType( &m_lib ) ) )    {        msg_Err( getIntf(), "failed to initialize freetype (%s)",                 ft2_strerror( err ) );        return false;    }    FILE *file = fopen( m_name.c_str(), "rb" );    if( !file )    {        msg_Dbg( getIntf(), "failed to open font %s (%s)",                 m_name.c_str(), strerror(errno) );        return false;    }    msg_Dbg( getIntf(), "loading font %s", m_name.c_str() );    fseek( file, 0, SEEK_END );    long size = ftell( file );    rewind( file );    if( -1==size )    {        msg_Dbg( getIntf(), "fseek loading font %s (%s)",                 m_name.c_str(), strerror(errno) );        fclose( file );        return false;    }    m_buffer = new (std::nothrow) char[size];    if( !m_buffer )    {        fclose( file );        return false;    }    if( fread( m_buffer, size, 1, file ) != 1 )    {        msg_Err( getIntf(), "unexpected result for read" );        fclose( file );        return false;    }    fclose( file );    err = FT_New_Memory_Face( m_lib, (const FT_Byte*)m_buffer, size, 0,                              &m_face );    if ( err == FT_Err_Unknown_File_Format )    {        msg_Err( getIntf(), "unsupported font format (%s)", m_name.c_str() );        return false;    }    else if ( err )    {        msg_Err( getIntf(), "error opening font %s (%s)",                 m_name.c_str(), ft2_strerror(err) );        return false;    }    // Select the charset    if( ( err = FT_Select_Charmap( m_face, ft_encoding_unicode ) ) )    {        msg_Err( getIntf(), "font %s has no UNICODE table (%s)",                 m_name.c_str(), ft2_strerror(err) );        return false;    }    // Set the pixel size    if( ( err = FT_Set_Pixel_Sizes( m_face, 0, m_size ) ) )    {        msg_Warn( getIntf(), "cannot set a pixel size of %d for %s (%s)",                  m_size, m_name.c_str(), ft2_strerror(err) );    }    // Get the font metrucs    m_height = m_face->size->metrics.height >> 6;    m_ascender = m_face->size->metrics.ascender >> 6;    m_descender = m_face->size->metrics.descender >> 6;    return true;}
开发者ID:371816210,项目名称:vlc_vlc,代码行数:83,


示例20: FT_Init_FreeType

FreeTypeLib::FreeTypeLib() {    FT_Init_FreeType(&lib);}
开发者ID:tangrams,项目名称:harfbuzz-example,代码行数:3,


示例21: new_Console

/** * Initialize a new console */Console* new_Console(cairo_t* context, double font_size){  //printf("Console::Console([email
C++ FT_Load_Char函数代码示例
C++ FT_HAS_KERNING函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。