~widelands-dev/widelands/localizeable_shipnames

« back to all changes in this revision

Viewing changes to src/graphic/font_handler1.cc

  • Committer: GunChleoc
  • Date: 2017-04-22 08:40:21 UTC
  • mfrom: (8298.1.40 trunk)
  • Revision ID: fios@foramnagaidhlig.net-20170422084021-4u3vp59d9jkdfx63
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <boost/lexical_cast.hpp>
26
26
#include <boost/utility.hpp>
27
27
 
28
 
#include "base/i18n.h"
29
28
#include "base/log.h"
30
29
#include "base/wexception.h"
31
30
#include "graphic/graphic.h"
110
109
// be a problem.
111
110
class FontHandler1 : public IFontHandler1 {
112
111
public:
113
 
        FontHandler1(ImageCache* image_cache)
 
112
        FontHandler1(ImageCache* image_cache, const std::string& locale)
114
113
           : texture_cache_(new TextureCache(RICHTEXT_TEXTURE_CACHE)),
115
114
             fontsets_(),
116
 
             fontset_(fontsets_.get_fontset(i18n::get_locale())),
 
115
             fontset_(fontsets_.get_fontset(locale)),
117
116
             rt_renderer_(new RT::Renderer(image_cache, texture_cache_.get(), fontsets_)),
118
117
             image_cache_(image_cache) {
119
118
        }
137
136
                return fontset_;
138
137
        }
139
138
 
140
 
        void reinitialize_fontset() override {
141
 
                fontset_ = fontsets_.get_fontset(i18n::get_locale());
 
139
        void reinitialize_fontset(const std::string& locale) override {
 
140
                fontset_ = fontsets_.get_fontset(locale);
142
141
                texture_cache_.get()->flush();
143
142
                rt_renderer_.reset(new RT::Renderer(image_cache_, texture_cache_.get(), fontsets_));
144
143
        }
151
150
        ImageCache* const image_cache_;  // not owned
152
151
};
153
152
 
154
 
IFontHandler1* create_fonthandler(ImageCache* image_cache) {
155
 
        return new FontHandler1(image_cache);
 
153
IFontHandler1* create_fonthandler(ImageCache* image_cache, const std::string& locale) {
 
154
        return new FontHandler1(image_cache, locale);
156
155
}
157
156
 
158
157
IFontHandler1* g_fh1 = nullptr;