GRAPHICS/GUI: Implement charset mapping for TTF fonts.

The charsets used by the translations now need to have a "$(name).cp" file,
which contains an charset index => unicode mapping. Otherwise
create_translations will fail.
This commit is contained in:
Johannes Schickel 2012-01-09 03:33:59 +01:00 committed by Willem Jan Palenstijn
parent 9f3fbe1bd7
commit f63df3bf7b
30 changed files with 1832 additions and 875 deletions

View file

@ -1399,12 +1399,6 @@ DrawData ThemeEngine::parseDrawDataId(const Common::String &name) const {
const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filename, const Common::String &charset, const int pointsize, Common::String &name) {
#ifdef USE_FREETYPE2
// We only support ISO-8859-1 for TTF right now.
if (!charset.empty()
&& !charset.equalsIgnoreCase("iso-8859-1")
&& !charset.equalsIgnoreCase("ascii"))
return 0;
name = Common::String::format("%s-%s@%d", filename.c_str(), charset.c_str(), pointsize);
// Try already loaded fonts.
@ -1418,7 +1412,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena
for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) {
Common::SeekableReadStream *stream = (*i)->createReadStream();
if (stream) {
font = Graphics::loadTTFFont(*stream, pointsize, false);
font = Graphics::loadTTFFont(*stream, pointsize, false, TransMan.getCharsetMapping());
delete stream;
if (font)