// scan for prefix-filename in addons search path
char **rc = PHYSFS_enumerateFiles(fontdir.c_str());
for (char **i = rc; *i != NULL; i++) {
// scan for prefix-filename in addons search path
char **rc = PHYSFS_enumerateFiles(fontdir.c_str());
for (char **i = rc; *i != NULL; i++) {
- std::string filename(*i);
- if( filename.rfind(fontname) != std::string::npos ) {
- loadFontFile(fontdir + filename);
+ std::string filename_(*i);
+ if( filename_.rfind(fontname) != std::string::npos ) {
+ loadFontFile(fontdir + filename_);
if( !config_l->get("glyph-width",def_char_width) ) {
log_warning << "Font:"<< filename << ": misses default glyph-width" << std::endl;
}
if( !config_l->get("glyph-width",def_char_width) ) {
log_warning << "Font:"<< filename << ": misses default glyph-width" << std::endl;
}
if( !config_l->get("glyph-height",char_height) ) {
std::ostringstream msg;
msg << "Font:" << filename << ": misses glyph-height";
if( !config_l->get("glyph-height",char_height) ) {
std::ostringstream msg;
msg << "Font:" << filename << ": misses glyph-height";
Font::loadFontSurface(
const std::string &glyphimage,
const std::string &shadowimage,
const std::vector<std::string> &chars,
Font::loadFontSurface(
const std::string &glyphimage,
const std::string &shadowimage,
const std::vector<std::string> &chars,
//this does not work:
// surface = ((SDL::Texture *)glyph_surface.get_texture())->get_texture();
surface = IMG_Load_RW(get_physfs_SDLRWops("images/engine/fonts/"+glyphimage), 1);
//this does not work:
// surface = ((SDL::Texture *)glyph_surface.get_texture())->get_texture();
surface = IMG_Load_RW(get_physfs_SDLRWops("images/engine/fonts/"+glyphimage), 1);
int x = col * (char_width + 2*border) + border;
if( ++col == wrap ) { col=0; row++; }
if( *chr == 0x0020 && glyphs[0x20].surface_idx != -1) continue;
int x = col * (char_width + 2*border) + border;
if( ++col == wrap ) { col=0; row++; }
if( *chr == 0x0020 && glyphs[0x20].surface_idx != -1) continue;
{
glyph.rect = Rectf(x, y, x + char_width, y + char_height);
glyph.offset = Vector(0, 0);
glyph.advance = char_width;
}
{
glyph.rect = Rectf(x, y, x + char_width, y + char_height);
glyph.offset = Vector(0, 0);
glyph.advance = char_width;
}
int right = x + char_width - 1;
while (right > left && vline_empty(surface, right, y, y + char_height, 64))
right -= 1;
int right = x + char_width - 1;
while (right > left && vline_empty(surface, right, y, y + char_height, 64))
right -= 1;
{
glyph.offset = Vector(x-left, 0);
glyph.advance = right - left + 1 + 1; // FIXME: might be useful to make spacing configurable
{
glyph.offset = Vector(x-left, 0);
glyph.advance = right - left + 1 + 1; // FIXME: might be useful to make spacing configurable
{ // glyph is completly transparent
glyph.offset = Vector(0, 0);
glyph.advance = char_width + 1; // FIXME: might be useful to make spacing configurable
{ // glyph is completly transparent
glyph.offset = Vector(0, 0);
glyph.advance = char_width + 1; // FIXME: might be useful to make spacing configurable
// FIXME: hard-wrap at width, taking care of multibyte characters
if (overflow) *overflow = "";
return s;
// FIXME: hard-wrap at width, taking care of multibyte characters
if (overflow) *overflow = "";
return s;
- draw_chars(renderer, false, text,
+ draw_chars(renderer, false, rtl ? std::string(text.rbegin(), text.rend()) : text,
pos + Vector(shadowsize, shadowsize), drawing_effect, Color(1,1,1), alpha);
pos + Vector(shadowsize, shadowsize), drawing_effect, Color(1,1,1), alpha);
- draw_chars(renderer, true, text, pos, drawing_effect, color, alpha);
+ draw_chars(renderer, true, rtl ? std::string(text.rbegin(), text.rend()) : text, pos, drawing_effect, color, alpha);
surfacepartrequest.surface = notshadow ? glyph_surfaces[glyph.surface_idx].get() : shadow_surfaces[glyph.surface_idx].get();
request.request_data = &surfacepartrequest;
surfacepartrequest.surface = notshadow ? glyph_surfaces[glyph.surface_idx].get() : shadow_surfaces[glyph.surface_idx].get();
request.request_data = &surfacepartrequest;