wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src font.cpp


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src font.cpp
Date: Sat, 08 Jan 2005 09:51:10 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/01/08 13:59:05

Modified files:
        src            : font.cpp 

Log message:
        (commented out) support for reading fonts from zip files

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.94&tr2=1.95&r1=text&r2=text

Patches:
Index: wesnoth/src/font.cpp
diff -u wesnoth/src/font.cpp:1.94 wesnoth/src/font.cpp:1.95
--- wesnoth/src/font.cpp:1.94   Thu Dec 30 19:32:35 2004
+++ wesnoth/src/font.cpp        Sat Jan  8 13:59:05 2005
@@ -1,4 +1,4 @@
-/* $Id: font.cpp,v 1.94 2004/12/30 19:32:35 ydirson Exp $ */
+/* $Id: font.cpp,v 1.95 2005/01/08 13:59:05 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -48,6 +48,7 @@
        std::string name;
 
        LOG_FT << "Opening font '" << fname << "' ...\n";
+#if 1 || !defined(USE_ZIPIOS)
        if(game_config::path.empty() == false) {
                name = game_config::path + "/fonts/" + fname;
                LOG_FT << "Trying file '" << name << "' ...\n";
@@ -73,6 +74,15 @@
        LOG_FT << "Opening font file '" << name << "', font size is " << size 
<< "\n";
 
        TTF_Font* font = TTF_OpenFont(name.c_str(),size);
+#else
+       std::string s = read_file("fonts/" + fname);
+       if (s.empty()) {
+               ERR_FT << "Failed opening font file '" << fname << "'\n";
+               return NULL;
+       }
+       SDL_RWops* ops = SDL_RWFromMem((void*)s.c_str(), s.size());
+       TTF_Font* font = TTF_OpenFontRW(ops, 0, size);
+#endif
        if(font == NULL) {
                ERR_FT << "Failed opening font file '" << name << "'\n";
                return NULL;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]