Author: loonycyborg
Date: Mon Nov 17 12:39:33 2008
New Revision: 30788
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30788&view=rev
Log:
Use AddFontResource Win32api call on windows to load fonts from fonts/
dir since fontconfig doesn't affect cairo's win32 font backend.
Modified:
trunk/src/font.cpp
trunk/src/text.cpp
Modified: trunk/src/font.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/font.cpp?rev=30788&r1=30787&r2=30788&view=diff
==============================================================================
--- trunk/src/font.cpp (original)
+++ trunk/src/font.cpp Mon Nov 17 12:39:33 2008
@@ -25,12 +25,18 @@
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "marked-up_text.hpp"
+#include "foreach.hpp"
#include <list>
#include <set>
#include <stack>
#include <fontconfig/fontconfig.h>
+#include <cairo-features.h>
+
+#ifdef CAIRO_HAS_WIN32_FONT
+#include <windows.h>
+#endif
#define DBG_FT LOG_STREAM(debug, display)
#define LOG_FT LOG_STREAM(info, display)
@@ -288,6 +294,17 @@
ERR_FT << "Could not load the true type fonts\n";
throw error();
}
+
+#if CAIRO_HAS_WIN32_FONT
+ foreach(const std::string& path, get_binary_paths("fonts")) {
+ std::vector<std::string> files;
+ get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
+ foreach(const std::string& file, files)
+ if(file.substr(file.length() - 4) == ".ttf")
+ AddFontResource(file.c_str());
+ }
+#endif
+
}
manager::~manager()
@@ -296,6 +313,16 @@
clear_fonts();
TTF_Quit();
+
+#if CAIRO_HAS_WIN32_FONT
+ foreach(const std::string& path, get_binary_paths("fonts")) {
+ std::vector<std::string> files;
+ get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
+ foreach(const std::string& file, files)
+ if(file.substr(file.length() - 4) == ".ttf")
+ RemoveFontResource(file.c_str());
+ }
+#endif
}
//structure used to describe a font, and the subset of the Unicode character
Modified: trunk/src/text.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/text.cpp?rev=30788&r1=30787&r2=30788&view=diff
==============================================================================
--- trunk/src/text.cpp (original)
+++ trunk/src/text.cpp Mon Nov 17 12:39:33 2008
@@ -469,6 +469,8 @@
// Draw twice otherwise we have some problems due to
transparency
// we overcome the problem with drawing twice which is a kind
of hack.
pango_cairo_show_layout(cr, layout_);
+ // On Windows drawing twice is not enough.
+ pango_cairo_show_layout(cr, layout_);
surface_.assign(SDL_CreateRGBSurfaceFrom(
surface_buffer_, width, height, 32, stride,
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits