コード例 #1
0
ファイル: CFont.cpp プロジェクト: cugone/Abrams2010
void Font::AdjustFont(std::string file) {
    if(exists(file.c_str()) == false) {
        throw FileNotFoundException(file);
    }

	_file = file;
    if(_font != font) destroy_font(_font);
    _font = nullptr;
	_font = load_bitmap_font(file.c_str(), nullptr, nullptr);
    _height = 0;
    if(_font) {
        _height = text_height(_font);
    }
}
コード例 #2
0
ファイル: readfont.c プロジェクト: dodamn/pkg-allegro4.2
/* load_font:
 *  Loads a font from disk. Will try to load a font from a bitmap if all else
 *  fails.
 */
FONT *load_font(AL_CONST char *filename, RGB *pal, void *param)
{
   char tmp[32], *aext;
   FONT_TYPE_INFO *iter;
   ASSERT(filename);

   aext = uconvert_toascii(get_extension(filename), tmp);
   
   for (iter = font_type_list; iter; iter = iter->next) {
      if (stricmp(iter->ext, aext) == 0) {
	 if (iter->load)
	    return iter->load(filename, pal, param);
	 return NULL;
      }
   }
   
   /* Try to load the file as a bitmap image and grab the font from there */
   return load_bitmap_font(filename, pal, param);
}
コード例 #3
0
ファイル: CFont.cpp プロジェクト: cugone/Abrams2010
A2DE_BEGIN

Font::Font(std::string file) : _file(file), _font(load_bitmap_font(_file.c_str(), nullptr, nullptr)), _height(0) {
	if(_font) _height = text_height(_font);
}