コード例 #1
0
ファイル: tafont.c プロジェクト: goldcome/ttfautohint
FT_Error
TA_font_init(FONT* font)
{
    FT_Error error;
    FT_Face f;
    FT_Int major, minor, patch;


    error = FT_Init_FreeType(&font->lib);
    if (error)
        return error;

    /* assure correct FreeType version to avoid using the wrong DLL */
    FT_Library_Version(font->lib, &major, &minor, &patch);
    if (((major*1000 + minor)*1000 + patch) < 2004005)
        return TA_Err_Invalid_FreeType_Version;

    /* get number of faces (i.e. subfonts) */
    error = FT_New_Memory_Face(font->lib,
                               font->in_buf,
                               (FT_Long)font->in_len,
                               -1,
                               &f);
    if (error)
        return error;
    font->num_sfnts = f->num_faces;
    FT_Done_Face(f);

    /* it is a TTC if we have more than a single subfont */
    font->sfnts = (SFNT*)calloc(1, (size_t)font->num_sfnts * sizeof (SFNT));
    if (!font->sfnts)
        return FT_Err_Out_Of_Memory;

    return TA_Err_Ok;
}
コード例 #2
0
gfxFT2LockedFace::CharVariantFunction
gfxFT2LockedFace::FindCharVariantFunction()
{
    // This function is available from FreeType 2.3.6 (June 2008).
    PRLibrary *lib = nsnull;
    CharVariantFunction function =
        reinterpret_cast<CharVariantFunction>
        (PR_FindFunctionSymbolAndLibrary("FT_Face_GetCharVariantIndex", &lib));
    if (!lib) {
        return nsnull;
    }

    FT_Int major;
    FT_Int minor;
    FT_Int patch;
    FT_Library_Version(mFace->glyph->library, &major, &minor, &patch);

    // Versions 2.4.0 to 2.4.3 crash if configured with
    // FT_CONFIG_OPTION_OLD_INTERNALS.  Presence of the symbol FT_Alloc
    // indicates FT_CONFIG_OPTION_OLD_INTERNALS.
    if (major == 2 && minor == 4 && patch < 4 &&
        PR_FindFunctionSymbol(lib, "FT_Alloc")) {
        function = nsnull;
    }

    // Decrement the reference count incremented in
    // PR_FindFunctionSymbolAndLibrary.
    PR_UnloadLibrary(lib);

    return function;
}
コード例 #3
0
ファイル: res_font.c プロジェクト: Inubashiri/PDFLibNet
static fz_error
fz_initfreetype(void)
{
	int fterr;
	int maj, min, pat;

	if (fz_ftlib)
	{
		fz_ftlib_refs++;
		return fz_okay;
	}

	fterr = FT_Init_FreeType(&fz_ftlib);
	if (fterr)
		return fz_throw("cannot init freetype: %s", ft_errorstring(fterr));

	FT_Library_Version(fz_ftlib, &maj, &min, &pat);
	if (maj == 2 && min == 1 && pat < 7)
	{
		fterr = FT_Done_FreeType(fz_ftlib);
		if (fterr)
			fz_warn("freetype finalizing: %s", ft_errorstring(fterr));
		return fz_throw("freetype version too old: %d.%d.%d", maj, min, pat);
	}

	fz_ftlib_refs++;
	return fz_okay;
}
コード例 #4
0
ファイル: sim_text.c プロジェクト: LuaDist/cd
static char* get_version_attrib(cdCtxCanvas* ctxcanvas)
{
  static char version[50];
  FT_Int major, minor, patch;
  cdCanvas* canvas = ((cdCtxCanvasBase*)ctxcanvas)->canvas;
  FT_Library_Version(canvas->simulation->tt_text->library, &major, &minor, &patch);
  sprintf(version, "FreeType %d.%d.%d", major, minor, patch);
  return version;
}
コード例 #5
0
ファイル: freetype.c プロジェクト: Hasimir/fontforge
char *FreeTypeStringVersion(void) {
    int ma, mi, pa;
    static char buffer[60];

    if ( !hasFreeType())
        return( "" );
    FT_Library_Version(ff_ft_context,&ma,&mi,&pa);
    sprintf( buffer, "FreeType %d.%d.%d", ma, mi, pa );
    return( buffer );
}
コード例 #6
0
ファイル: freetype.c プロジェクト: Hasimir/fontforge
int FreeTypeAtLeast(int major, int minor, int patch) {
    int ma, mi, pa;

    if ( !hasFreeType())
        return( false );
    FT_Library_Version(ff_ft_context,&ma,&mi,&pa);
    if ( ma>major || (ma==major && (mi>=minor || (mi==minor && pa>=patch))))
        return( true );

    return( false );
}
コード例 #7
0
ファイル: FontCache.cpp プロジェクト: temojin/ArxLibertatis
FontCache::FontCache() {
	
	FT_Init_FreeType(&g_FTLibrary);

	FT_Int ftMajor, ftMinor, ftPatch;
	FT_Library_Version(g_FTLibrary, &ftMajor, &ftMinor, &ftPatch);
	
	std::ostringstream version;
	version << ftMajor << '.' << ftMinor << '.' << ftPatch;
	
	CrashHandler::setVariable("FreeType version", version.str());
}
コード例 #8
0
ファイル: sanity.c プロジェクト: Amerekanets/gimp
static gchar *
sanity_check_freetype (void)
{
  FT_Library ft_library;
  FT_Int     ft_major_version;
  FT_Int     ft_minor_version;
  FT_Int     ft_micro_version;
  FT_Int     ft_version;

#define FT_REQUIRED_MAJOR 2
#define FT_REQUIRED_MINOR 1
#define FT_REQUIRED_MICRO 7

  if (FT_Init_FreeType (&ft_library) != 0)
    g_error ("FT_Init_FreeType() failed");

  FT_Library_Version (ft_library,
                      &ft_major_version,
                      &ft_minor_version,
                      &ft_micro_version);

  if (FT_Done_FreeType (ft_library) != 0)
    g_error ("FT_Done_FreeType() failed");

  ft_version = (ft_major_version * 10000 +
                ft_minor_version *   100 +
                ft_micro_version *     1);

  if (ft_version < ((FT_REQUIRED_MAJOR * 10000) +
                    (FT_REQUIRED_MINOR *   100) +
                    (FT_REQUIRED_MICRO *     1)))
    {
      return g_strdup_printf
        ("FreeType version too old!\n\n"
         "GIMP requires FreeType version %d.%d.%d or later.\n"
         "Installed FreeType version is %d.%d.%d.\n\n"
         "Somehow you or your software packager managed\n"
         "to install GIMP with an older FreeType version.\n\n"
         "Please upgrade to FreeType version %d.%d.%d or later.",
         FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO,
         ft_major_version, ft_minor_version, ft_micro_version,
         FT_REQUIRED_MAJOR, FT_REQUIRED_MINOR, FT_REQUIRED_MICRO);
    }

#undef FT_REQUIRED_MAJOR
#undef FT_REQUIRED_MINOR
#undef FT_REQUIRED_MICRO

  return NULL;
}
コード例 #9
0
void cmdAbout(const std::string& args) {
	// TODO: replace this with a GUI window
	narf::console->println("");
	narf::console->println("About NarfBlock");
	narf::console->println("Version: " VERSION_STR);
	narf::console->println("");
	narf::console->println("Authors:");
	auto authors = narf::util::tokenize(VERSION_AUTHORS, '\n');
	for (auto& a : authors) {
		narf::console->println(a);
	}
	narf::console->println("");

	auto credits = narf::util::tokenize(EMBED_STRING(extra_credits_txt), '\n');
	for (auto& c : credits) {
		narf::console->println(c);
	}

	narf::console->println("");
	narf::console->println("Library versions:");

	narf::console->println("ENet " + std::to_string(ENET_VERSION_MAJOR) + "." + std::to_string(ENET_VERSION_MINOR) + "." + std::to_string(ENET_VERSION_PATCH));

	SDL_version sdl;
	SDL_GetVersion(&sdl);
	narf::console->println("SDL " + std::to_string(sdl.major) + "." + std::to_string(sdl.minor) + "." + std::to_string(sdl.patch));

	narf::console->println("zlib " + std::string(zlibVersion()));

	auto png = png_access_version_number();
	auto pngMajor = png / 10000;
	auto pngMinor = (png / 100) % 100;
	auto pngRelease = png % 100;
	narf::console->println("libpng " + std::to_string(pngMajor) + "." + std::to_string(pngMinor) + "." + std::to_string(pngRelease));

	FT_Library ftlib;
	FT_Init_FreeType(&ftlib);
	FT_Int ftMajor, ftMinor, ftPatch;
	FT_Library_Version(ftlib, &ftMajor, &ftMinor, &ftPatch);
	FT_Done_FreeType(ftlib);
	narf::console->println("FreeType " + std::to_string(ftMajor) + "." + std::to_string(ftMinor) + "." + std::to_string(ftPatch));

	narf::console->println(opus_get_version_string());

	narf::console->println("");
	narf::console->println("OpenGL information:");
	narf::console->println("OpenGL version " + std::string(display->glVersion));
	narf::console->println("GLSL version " + std::string(display->glslVersion));
	narf::console->println("GL context version " + std::to_string(display->glContextVersionMajor) + "." + std::to_string(display->glContextVersionMinor));
}
コード例 #10
0
ファイル: FontManager.cpp プロジェクト: Imari/Dagon
void FontManager::init(){
  log.trace(kModFont, "%s", kString15001);
  
  if (FT_Init_FreeType(&_library)) {
    log.error(kModFont, "%s", kString15003);
    return;
  }
  
  int major, minor, patch;
  
  FT_Library_Version(_library, &major, &minor, &patch);
  log.info(kModFont, "%s: %d.%d.%d", kString15002, major, minor, patch);
  
  _isInitialized = true;
}
コード例 #11
0
ファイル: version.c プロジェクト: anthrotype/freetypy
int setup_version(PyObject *m)
{
    FT_Int major, minor, patch;
    char version_string[64];

    FT_Library_Version(get_ft_library(), &major, &minor, &patch);
    snprintf(version_string, 64, "%d.%d.%d", major, minor, patch);

    return (
        PyModule_AddStringConstant(
            freetypy_module, "__freetype_version__", version_string) ||
        PyModule_AddStringConstant(
            m, "__freetype_build_type__", STRINGIFY(FREETYPE_BUILD_TYPE))
    );
}
コード例 #12
0
ファイル: pdf_fontfile.c プロジェクト: lgchmomo/mupdf
static fz_error *initfontlibs(void)
{
	int fterr;
	int maj, min, pat;

	if (ftlib)
		return fz_okay;

	fterr = FT_Init_FreeType(&ftlib);
	if (fterr)
		return fz_throw("freetype failed initialisation: %s", ft_errstr(fterr));

	FT_Library_Version(ftlib, &maj, &min, &pat);
	if (maj == 2 && min == 1 && pat < 7)
		return fz_throw("freetype version too old: %d.%d.%d", maj, min, pat);

	return fz_okay;
}
コード例 #13
0
    void testFreetypeVersion()
    {
        setUpFreetype(NULL_CHARACTER_INDEX);

        FT_Int major;
        FT_Int minor;
        FT_Int patch;

        FT_Library_Version(library, &major, &minor, &patch);

        // If you hit these asserts then you have the wrong library version to run the tests.
        // You can still run the tests but some will fail because the hinter changed in 2.1.4
        CPPUNIT_ASSERT_EQUAL(2, major);
        CPPUNIT_ASSERT_EQUAL(1, minor);
        CPPUNIT_ASSERT(4 <= patch);

        tearDownFreetype();
    }
コード例 #14
0
static fz_error *initfontlibs(void)
{
	int fterr;
	int maj, min, pat;

	if (ftlib)
		return nil;

	fterr = FT_Init_FreeType(&ftlib);
	if (fterr)
		return fz_throw("freetype cannot initialize: %s", pdf_fterrorstring(fterr));

	FT_Library_Version(ftlib, &maj, &min, &pat);
	if (maj == 2 && min == 1 && pat < 7)
		return fz_throw("freetype version too old: %d.%d.%d", maj, min, pat);

	fclib = FcInitLoadConfigAndFonts();
	if (!fclib)
		return fz_throw("fontconfig cannot initialize");

	return nil;
}
コード例 #15
0
ファイル: kguifont.cpp プロジェクト: CarlHuff/kgui
/* true = ok, false = error */
bool kGUI::InitFontEngine(void)
{
	int a,b,c;
	kGUIFont::m_numfonts=0;
#if defined(WIN32) || defined(MINGW)
	kGUIFont::m_numreg=0;
#elif defined(LINUX) || defined(MACINTOSH)
#else
#error
#endif
	kGUIFont::m_error = FT_Init_FreeType( &kGUIFont::m_library );

	FT_Library_Version( kGUIFont::m_library,&a,&b,&c);
	m_ftversion.Sprintf("%d.%d.%d",a,b,c);

	kGUIFont::m_ffilist.Init(32,16);
	kGUIFont::m_ffinumentries=0;

	if(kGUIFont::m_error)
		return(false);
	return(true);
}
コード例 #16
0
static fz_error *initfontlibs(void)
{
	int fterr;
	int maj, min, pat;
	fz_error  *err;

	if (ftlib)
		return nil;

	fterr = FT_Init_FreeType(&ftlib);
	if (fterr)
		return fz_throw("freetype failed initialisation: 0x%x", fterr);

	FT_Library_Version(ftlib, &maj, &min, &pat);
	if (maj == 2 && min == 1 && pat < 7)
		return fz_throw("freetype version too old: %d.%d.%d", maj, min, pat);

	err = pdf_createfontlistMS();
	if(err)
		return err;

	return nil;
}
コード例 #17
0
ファイル: font.cpp プロジェクト: newerthcom/savagerebirth
bool	Font_Init()
{
#ifdef _S2_EXCLUDE_FREETYPE
	return true;
#else
	int error;
	int major, minor, patch;

    error = FT_Init_FreeType( &library );
	FT_Library_Version(library, &major, &minor, &patch);
	if (patch != FREETYPE_PATCH)
	{
		Console_Printf("freetype headers don't match binary! - compiled against %i.%i.%i!\n", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
	}
	Console_DPrintf("Initialized freetype library version %i.%i.%i\n", major, minor, patch);
    if ( error ) 
	{
		System_Error("FreeType initialization error %i\n", error);
		return false;
	}
	return true;
#endif
}
コード例 #18
0
ファイル: font.c プロジェクト: chrox/libk2pdfopt
static void
fz_keep_freetype(fz_context *ctx)
{
	int fterr;
	int maj, min, pat;
	fz_font_context *fct = ctx->font;

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

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

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

	fct->ftlib_refs++;
	fz_unlock(ctx, FZ_LOCK_FREETYPE);
}
コード例 #19
0
ファイル: font_library.cpp プロジェクト: mapycz/mapnik
unsigned font_library::version() const
{
    FT_Int major, minor, patch;
    FT_Library_Version(library_, &major, &minor, &patch);
    return compact_version(major, minor, patch);
}
コード例 #20
0
ファイル: ftstring.c プロジェクト: tamaskenez/freetype2-demos
  static void
  event_help( void )
  {
    char  buf[256];
    char  version[64];

    const char*  format;
    FT_Int       major, minor, patch;

    grEvent  dummy_event;


    FT_Library_Version( handle->library, &major, &minor, &patch );

    format = patch ? "%d.%d.%d" : "%d.%d";
    sprintf( version, format, major, minor, patch );

    FTDemo_Display_Clear( display );
    grSetLineHeight( 10 );
    grGotoxy( 0, 0 );
    grSetMargin( 2, 1 );
    grGotobitmap( display->bitmap );

    sprintf( buf,
             "FreeType String Viewer - part of the FreeType %s test suite",
             version );

    grWriteln( buf );
    grLn();
    grWriteln( "This program is used to display a string of text using" );
    grWriteln( "the new convenience API of the FreeType 2 library." );
    grLn();
    grWriteln( "Use the following keys :" );
    grLn();
    grWriteln( "  F1 or ?   : display this help screen" );
    grLn();
    grWriteln( "  a         : toggle anti-aliasing" );
    grWriteln( "  b         : toggle embedded bitmaps (and disable rotation)" );
    grWriteln( "  f         : toggle forced auto-hinting" );
    grWriteln( "  h         : toggle outline hinting" );
    grLn();
    grWriteln( "  1-2       : select rendering mode" );
    grWriteln( "  k         : cycle through kerning modes" );
    grWriteln( "  t         : cycle through kerning degrees" );
    grWriteln( "  V         : toggle vertical rendering" );
    grLn();
    grWriteln( "  G         : toggle gamma correction" );
    grWriteln( "  g         : increase gamma by 0.1" );
    grWriteln( "  v         : decrease gamma by 0.1" );
    grLn();
    grWriteln( "  n         : next font" );
    grWriteln( "  p         : previous font" );
    grLn();
    grWriteln( "  Up        : increase pointsize by 1 unit" );
    grWriteln( "  Down      : decrease pointsize by 1 unit" );
    grWriteln( "  Page Up   : increase pointsize by 10 units" );
    grWriteln( "  Page Down : decrease pointsize by 10 units" );
    grLn();
    grWriteln( "  Right     : rotate counter-clockwise" );
    grWriteln( "  Left      : rotate clockwise" );
    grWriteln( "  F7        : big rotate counter-clockwise" );
    grWriteln( "  F8        : big rotate clockwise" );
    grLn();
    grWriteln( "press any key to exit this help screen" );

    grRefreshSurface( display->surface );
    grListenSurface( display->surface, gr_event_key, &dummy_event );
  }
コード例 #21
0
ファイル: ftstring.c プロジェクト: tamaskenez/freetype2-demos
  static void
  parse_cmdline( int*     argc,
                 char***  argv )
  {
    char*  execname;
    int    option;


    execname = ft_basename( (*argv)[0] );

    while ( 1 )
    {
      option = getopt( *argc, *argv, "e:h:m:r:vw:" );

      if ( option == -1 )
        break;

      switch ( option )
      {
      case 'e':
        status.encoding = FTDemo_Make_Encoding_Tag( optarg );
        break;

      case 'h':
        status.height = atoi( optarg );
        if ( status.height < 1 )
          usage( execname );
        break;

      case 'm':
        if ( *argc < 3 )
          usage( execname );
        Text = optarg;
        break;

      case 'r':
        status.res = atoi( optarg );
        if ( status.res < 1 )
          usage( execname );
        break;

      case 'v':
        {
          FT_Int  major, minor, patch;


          FT_Library_Version( handle->library, &major, &minor, &patch );

          printf( "ftstring (FreeType) %d.%d", major, minor );
          if ( patch )
            printf( ".%d", patch );
          printf( "\n" );
          exit( 0 );
        }
        /* break; */

      case 'w':
        status.width = atoi( optarg );
        if ( status.width < 1 )
          usage( execname );
        break;

      default:
        usage( execname );
        break;
      }
    }

    *argc -= optind;
    *argv += optind;

    if ( *argc <= 1 )
      usage( execname );

    status.ptsize = (int)( atof( *argv[0] ) * 64.0 );
    if ( status.ptsize == 0 )
      status.ptsize = 64;

    (*argc)--;
    (*argv)++;
  }
コード例 #22
0
ファイル: main.c プロジェクト: dtnewman/finch
int main(int argc, char** argv) {
	FT_Error error;
	FT_Library library;
	FT_Face face;
	FT_Glyph_Metrics* m;
	FT_Outline* o;
	FT_Int major, minor, patch;
	int i, j, font_size, no_hinting;

	if (argc != 4) {
		usage(argv);
		return 1;
	}
	font_size = atoi(argv[1]);
	if (font_size <= 0) {
		fprintf(stderr, "invalid font_size\n");
		usage(argv);
		return 1;
	}
	if (!strcmp(argv[3], "with_hinting")) {
		no_hinting = 0;
	} else if (!strcmp(argv[3], "sans_hinting")) {
		no_hinting = 1;
	} else {
		fprintf(stderr, "neither \"with_hinting\" nor \"sans_hinting\"\n");
		usage(argv);
		return 1;
	};
	error = FT_Init_FreeType(&library);
	if (error) {
		fprintf(stderr, "FT_Init_FreeType: error #%d\n", error);
		return 1;
	}
	FT_Library_Version(library, &major, &minor, &patch);
	printf("freetype version %d.%d.%d\n", major, minor, patch);
	error = FT_New_Face(library, argv[2], 0, &face);
	if (error) {
		fprintf(stderr, "FT_New_Face: error #%d\n", error);
		return 1;
	}
	error = FT_Set_Char_Size(face, 0, font_size*64, 0, 0);
	if (error) {
		fprintf(stderr, "FT_Set_Char_Size: error #%d\n", error);
		return 1;
	}
	for (i = 0; i < face->num_glyphs; i++) {
		error = FT_Load_Glyph(face, i, no_hinting ? FT_LOAD_NO_HINTING : FT_LOAD_DEFAULT);
		if (error) {
			fprintf(stderr, "FT_Load_Glyph: glyph %d: error #%d\n", i, error);
			return 1;
		}
		if (face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) {
			fprintf(stderr, "glyph format for glyph %d is not FT_GLYPH_FORMAT_OUTLINE\n", i);
			return 1;
		}
		m = &face->glyph->metrics;
		/* Print what Go calls the AdvanceWidth, and then: XMin, YMin, XMax, YMax. */
		printf("%ld %ld %ld %ld %ld;",
				m->horiAdvance,
				m->horiBearingX,
				m->horiBearingY - m->height,
				m->horiBearingX + m->width,
				m->horiBearingY);
		/* Print the glyph points. */
		o = &face->glyph->outline;
		for (j = 0; j < o->n_points; j++) {
			if (j != 0) {
				printf(", ");
			}
			printf("%ld %ld %d", o->points[j].x, o->points[j].y, o->tags[j] & 0x01);
		}
		printf("\n");
	}
	return 0;
}
コード例 #23
0
bool IND_TTF_FontManager::init(IND_Render *pRender, IND_ImageManager *pImageManager, IND_SurfaceManager *pSurfaceManager) {
    
    g_debug->header("Initializing TTF FontManager", DebugApi::LogHeaderBegin);
    
	// Checking IND_Render
	if (pRender->isOK()) {
		g_debug->header("Checking IND_Render", DebugApi::LogHeaderOk);
		_pIndieRender = pRender;
	}
    else {
		g_debug->header("IND_Render is not correctly initialized", DebugApi::LogHeaderError);
		_bInit = false;
		return _bInit;
	}
    
    
	// Checking IND_ImageManager
	if (pImageManager->isOK()) {
		g_debug->header("Checking IND_ImageManager", DebugApi::LogHeaderOk);
		_pIndieImageManager = pImageManager;
    }
    else {
		g_debug->header("IND_ImageManager is not correctly initialized", DebugApi::LogHeaderError);
		_bInit = false;
		return _bInit;
	}

    // Checking IND_SurfaceManager
	if (pSurfaceManager->isOK()) {
		g_debug->header("Checking IND_SurfaceManager", DebugApi::LogHeaderOk);
		_pIndieSurfaceManager = pSurfaceManager;
    }
    else {
		g_debug->header("IND_SurfaceManager is not correctly initialized", DebugApi::LogHeaderError);
		_bInit = false;
		return _bInit;
	}
    
    
	if(_bInit)
		return true;
    
    _freetype = new free_type_ptr_wrapped_impl();

	if(FT_Init_FreeType(&_freetype->_FTLib) != 0) {
        g_debug->header("FreeType library is not correctly initialized", DebugApi::LogHeaderError);
		_bInit = false;
        return _bInit;
    }
    else {
		_bInit = true;
    }

    
    FT_Int major;
    FT_Int minor;
    FT_Int pitch;
    
    FT_Library_Version(_freetype->_FTLib, &major, &minor, &pitch);
    
    char freeTypeVer[15];
    char tempMajor[4];
    char tempMinor[4];
    char tempPitch[4];
	
    
    _math = new IND_Math();                        
	_math->init();
    _math->itoa(major,tempMajor);
    _math->itoa(minor,tempMinor);
    _math->itoa(pitch,tempPitch);
    
    strcat (freeTypeVer, tempMajor);
    strcat (freeTypeVer, ".");
    strcat (freeTypeVer, tempMinor);
    strcat (freeTypeVer, ".");
    strcat (freeTypeVer, tempPitch);
    
    
    const char* freeTypeCopyright = "This program uses FreeType, a freely available software library to render fonts. See http://www.freetype.org for details.";
    
    g_debug->header("Using FreeType version: ",DebugApi::LogHeaderInfo);
	g_debug->dataChar(freeTypeVer, true);
    g_debug->header("Copyright: ", DebugApi::LogHeaderInfo);
    g_debug->dataChar(freeTypeCopyright, true);
	g_debug->header("IND_TTF_FontManager Initialised", DebugApi::LogHeaderEnd);
    

	return _bInit;
}
コード例 #24
0
ファイル: app_procs.c プロジェクト: UIKit0/dia
static void
dump_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) {
      /* man 2 readlink : does not append a  NUL  character */
      linkedname[len] = '\0';
      g_print ("%s/%s\n", PREFIX, linkedname);
    }
  }
#endif
  g_print ("gtk+    : %d.%d.%d (%d.%d.%d)\n",
           gtk_major_version, gtk_minor_version, gtk_micro_version,
           GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);

#if 0
  /* we could read $PREFIX/share/gnome-about/gnome-version.xml 
   * but is it worth the effort ? */
  g_print ("gnome   : %d.%d.%d (%d.%d.%d)\n"
           gnome_major_version, gnome_minor_version, gnome_micro_version,
           GNOME_MAJOR_VERSION, GNOME_MINOR_VERSION, GNOME_MICRO_VERSION);
#endif
}