예제 #1
0
파일: font.c 프로젝트: adurdin/fs-uae
static void initialize() {
    g_texture_width = 2048;
    g_texture_height = 2048;
    int max_texture_size = fs_ml_get_max_texture_size();
    if (max_texture_size > 0) {
        if (max_texture_size < g_texture_width) {
            g_texture_width = max_texture_size;
        }
        if (max_texture_size < g_texture_height) {
            g_texture_height = max_texture_size;
        }
    }
    fs_log("using text cache texture size %dx%d\n", g_texture_width,
            g_texture_height);

    initialize_cache();
    create_text_texture();
    fs_gl_add_context_notification(context_notification_handler, NULL);
    g_buffer = malloc(g_texture_width * 32 * 4);

#ifdef USE_FREETYPE
    init_freetype();
#endif
    g_initialized = 1;
}
예제 #2
0
bool freetype_engine::register_fonts(std::string const& dir, bool recurse)
{
#ifdef MAPNIK_THREADSAFE
    mapnik::scoped_lock lock(mutex_);
#endif
    std::unique_ptr<FT_MemoryRec_> memory(new FT_MemoryRec_);
    FT_Library library = 0;
    init_freetype(&*memory, library);
    bool result = register_fonts_impl(dir, library, recurse);
    FT_Done_Library(library);
    return result;
}
예제 #3
0
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
{
    switch (reason)
    {
    case DLL_PROCESS_ATTACH:
        DisableThreadLibraryCalls( hinstDLL );
        init_freetype();
        break;
    case DLL_PROCESS_DETACH:
        if (reserved) break;
        release_shared_factory(shared_factory);
        release_freetype();
    }
    return TRUE;
}
예제 #4
0
int main(int argc, char *argv[])
{
    init_freetype(
        argc >= 2
            ? argv[1]
            : default_font_path
    );

    freetype_render_glyph(0x41);

    init_gl(800, 600, "Text Test");

    while(!glfwWindowShouldClose(window))
    {
        update_viewport_and_projection();

        gl_render_glyph();

        update_window();
    }

    return 0;
}
예제 #5
0
파일: mpcommon.c 프로젝트: azuwis/mplayer
/**
 * Initialization code to be run after command-line parsing.
 */
int common_init(void)
{
#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
    set_path_env();
#endif
    sanitize_os();

#ifdef CONFIG_PRIORITY
    set_priority();
#endif

    if (codec_path)
        set_codec_path(codec_path);

    /* Check codecs.conf. */
    if (!codecs_file || !parse_codec_cfg(codecs_file)) {
        char *conf_path = get_path("codecs.conf");
        if (!parse_codec_cfg(conf_path)) {
            if (!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")) {
                if (!parse_codec_cfg(NULL)) {
                    free(conf_path);
                    return 0;
                }
                mp_msg(MSGT_CPLAYER,MSGL_V,MSGTR_BuiltinCodecsConf);
            }
        }
        free(conf_path);
    }

    // check font
#ifdef CONFIG_FREETYPE
    init_freetype();
#endif
#ifdef CONFIG_FONTCONFIG
    if (font_fontconfig <= 0)
#endif
    {
#ifdef CONFIG_BITMAP_FONT
        if (font_name) {
            vo_font = read_font_desc(font_name, font_factor, verbose>1);
            if (!vo_font)
                mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,
                       filename_recode(font_name));
        } else {
            // try default:
            char *desc_path = get_path("font/font.desc");
            vo_font = read_font_desc(desc_path, font_factor, verbose>1);
            free(desc_path);
            if (!vo_font)
                vo_font = read_font_desc(MPLAYER_DATADIR "/font/font.desc", font_factor, verbose>1);
        }
        if (sub_font_name)
            sub_font = read_font_desc(sub_font_name, font_factor, verbose>1);
        else
            sub_font = vo_font;
#endif
    }

    vo_init_osd();

#ifdef CONFIG_ASS
    ass_library = ass_init();
#endif
    return 1;
}
예제 #6
0
파일: init.c 프로젝트: asriniva/Septicity
int init() {
	if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_AUDIO|SDL_INIT_VIDEO)) {
		fprintf(stderr,"Error initiating SDL. %s\n",SDL_GetError());
		return 1;
	}
	atexit(SDL_Quit);
	if (SDLNet_Init()) {
		fprintf(stderr,"Error initiating SDL network library. %s\n",SDL_GetError());
		return 1;
	}
	atexit(SDLNet_Quit);
	SDL_Rect **sizes = SDL_ListModes(0,SDL_FULLSCREEN|SDL_OPENGL);//Only get fullscreen sizes. It makes more sense.
	int a;
	for (a = 0;sizes[a];a++) {
		printf("Size[%i]: %i x %i\n",a,sizes[a]->w,sizes[a]->h);
	}
	char *index = malloc(4);
	int i = 0;
	while (1) {
		printf("Please enter the index of the size you want to use.\n");
		fgets(index,4,stdin);
		i = atoi(index);
		if (index[0] != '\n' && index[1] != '\n' && index[2] != '\n' && index[3] != '\n') {
			while (fgetc(stdin) != '\n');
		}
		if (i >= a) {
			printf("Invalid size\n");
			continue;
		}
		break;
	}
	while (1) {
		printf("Use fullscreen: [yn]");
		fflush(stdout);
		fgets(index,2,stdin);//Index can be reused
		if (*index != '\n') {
			while (fgetc(stdin) != '\n');
		}
		if (*index == 'y' || *index == 'Y') {
			fullscreen = 1;
		} else if (*index == 'n' || *index == 'N') {
			fullscreen = 0;
		} else {
			printf("Please enter y or n\n");
			continue;
		}
		break;
	}
	printf("%i %i\n",((fullscreen)?SDL_FULLSCREEN:0),SDL_FULLSCREEN);
	video_info = SDL_GetVideoInfo();
	window = SDL_SetVideoMode(sizes[i]->w,sizes[i]->h,0,SDL_OPENGL/*|((fullscreen)?SDL_FULLSCREEN:0)*/);
	if (!window) {
		fprintf(stderr,"Error in creating window. %s\n",SDL_GetError());
		return 1;
	}
	width = sizes[i]->w;
	height = sizes[i]->h;
	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);

	// DevIL init

	ilInit();
	
	if (init_freetype())
		return 1;

	//input reader init
	read_config("config/input.conf");
	
	// init camera position
	ex = malloc(sizeof(int));
	ey = malloc(sizeof(int));
	ez = malloc(sizeof(int));
	angle = malloc(sizeof(float));
	*ex = 2; *ey = 2; *ez = 0;
	*angle = 45.0f;



	return 0;
}
예제 #7
0
freetype_engine::freetype_engine()
    : library_(nullptr),
      memory_(new FT_MemoryRec_)
{
    init_freetype(&*memory_, library_);
}