[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src font.cpp
From: |
Jon Daniel |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src font.cpp |
Date: |
Sun, 07 Aug 2005 18:15:45 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Jon Daniel <address@hidden> 05/08/07 22:15:44
Modified files:
src : font.cpp
Log message:
* Fixed non-existent font files being tried to open all the time.
* Removed obsolete function set_font
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.147&tr2=1.148&r1=text&r2=text
Patches:
Index: wesnoth/src/font.cpp
diff -u wesnoth/src/font.cpp:1.147 wesnoth/src/font.cpp:1.148
--- wesnoth/src/font.cpp:1.147 Sun Aug 7 21:12:33 2005
+++ wesnoth/src/font.cpp Sun Aug 7 22:15:44 2005
@@ -1,4 +1,4 @@
-/* $Id: font.cpp,v 1.147 2005/08/07 21:12:33 ott Exp $ */
+/* $Id: font.cpp,v 1.148 2005/08/07 22:15:44 j_daniel Exp $ */
/* vim:set encoding=utf-8: */
/*
Copyright (C) 2003 by David White <address@hidden>
@@ -286,12 +286,6 @@
TTF_Quit();
}
-void set_font()
-{
- clear_fonts();
- font_names.push_back(_("DejaVuSans.ttf"));
-}
-
void set_font_list(const std::vector<subset_descriptor>& fontlist)
{
clear_fonts();
@@ -299,8 +293,27 @@
std::vector<subset_descriptor>::const_iterator itor;
for(itor = fontlist.begin(); itor != fontlist.end(); ++itor) {
- subset_id subset = font_names.size();
- font_names.push_back(itor->name);
+ const subset_id subset = font_names.size();
+ // Insert fonts only if the font file exists
+#ifndef USE_ZIPIOS
+ if(game_config::path.empty() == false) {
+ if(file_exists(game_config::path + "/fonts/" +
itor->name)) {
+ font_names.push_back(itor->name);
+ }
+ } else {
+ if(file_exists("fonts/" + itor->name)) {
+ font_names.push_back(itor->name);
+ }
+ }
+#else
+ if (!read_file("fonts/" + itor->name).empty()) {
+ font_names.push_back(itor->name);
+ }
+#endif
+ if(font_names.back() != itor->name) {
+ WRN_FT << "Failed opening font file '" << itor->name <<
"'\n";
+ continue;
+ }
std::vector<std::pair<size_t,size_t> >::const_iterator cp_range;
for(cp_range = itor->present_codepoints.begin();
- [Wesnoth-cvs-commits] wesnoth/src font.cpp,
Jon Daniel <=