Get rid of all references to the bootstrap script since it was removed
[synfig.git] / synfig-core / trunk / src / modules / lyr_freetype / lyr_freetype.cpp
index 9dde005..23e9580 100644 (file)
@@ -148,12 +148,14 @@ Layer_Freetype::new_font_(const synfig::String &font_fam_, int style, int weight
        //end evil hack
 
        if(font_fam=="arial black")
+       {
 #ifndef __APPLE__
-       if(new_face("ariblk"))
+               if(new_face("ariblk"))
                        return true;
                else
 #endif
                font_fam="sans serif";
+       }
 
        if(font_fam=="sans serif" || font_fam=="arial")
        {
@@ -463,7 +465,9 @@ Layer_Freetype::set_param(const String & param, const ValueBase &value)
        IMPORT_PLUS(size, if(old_version){size/=2.0;} needs_sync_=true );
        IMPORT_PLUS(text,needs_sync_=true);
        IMPORT_PLUS(pos,needs_sync_=true);
-       IMPORT(color);
+       IMPORT_PLUS(color, { if (color.get_a() == 0) { if (converted_blend_) {
+                                       set_blend_method(Color::BLEND_ALPHA_OVER);
+                                       color.set_a(1); } else transparent_color_ = true; } });
        IMPORT(invert);
        IMPORT_PLUS(orient,needs_sync_=true);
        IMPORT_PLUS(compress,needs_sync_=true);
@@ -697,6 +701,9 @@ Layer_Freetype::accelerated_render(Context context,Surface *surface,int quality,
  --    ** -- CREATE GLYPHS -------------------------------------------------------
        */
 
+       mbstate_t ps;
+       memset(&ps, 0, sizeof(ps));
+
        lines.push_front(TextLine());
        string::const_iterator iter;
        for (iter=text.begin(); iter!=text.end(); ++iter)
@@ -716,7 +723,29 @@ Layer_Freetype::accelerated_render(Context context,Surface *surface,int quality,
                        glyph_index = FT_Get_Char_Index( face, ' ' );
                }
                else
-                       glyph_index = FT_Get_Char_Index( face, *iter );
+               {
+                       wchar_t wc;
+                       size_t converted = mbrtowc(&wc, &(*iter), text.end() - iter, &ps);
+
+                       if(converted == (size_t)(-1))
+                       {
+                               synfig::warning("Layer_Freetype: multibyte: %s",
+                                                               _("Invalid multibyte sequence - is the locale set?\n"));
+                               continue;
+                       }
+
+                       if(converted == (size_t)(-2))
+                       {
+                               synfig::warning("Layer_Freetype: multibyte: %s",
+                                                               _("Can't parse multibyte character.\n"));
+                               continue;
+                       }
+
+                       glyph_index = FT_Get_Char_Index( face, wc );
+
+                       if(converted > 1)
+                               iter += converted - 1;
+               }
 
         // retrieve kerning distance and move pen position
                if ( FT_HAS_KERNING(face) && use_kerning && previous && glyph_index )