Merge commit 'origin/bug_478_Listbox_ScrollbarMode'
[enigma2.git] / lib / gdi / font.cpp
index 09154de088ea0be759126655a514f085e8bc883b..b7d3c1db75a3286d7ab812384b9a04f67e6da2f5 100644 (file)
@@ -212,7 +212,6 @@ float fontRenderClass::getLineHeight(const gFont& font)
        if (FTC_Manager_Lookup_Size(cacheManager, &fnt->font.font, &current_face, &fnt->size)<0)
 #endif
        {
-               delete fnt;
                eDebug("FTC_Manager_Lookup_Size failed!");
                return 0;
        }
@@ -364,7 +363,7 @@ int eTextPara::appendGlyph(Font *current_font, FT_Face current_face, FT_UInt gly
        }
 
        pGlyph ng;
-       ng.bbox.setLeft( (flags&GS_ISFIRST|cursor.x()-1)+glyph->left );
+       ng.bbox.setLeft( ((flags&GS_ISFIRST)|(cursor.x()-1))+glyph->left );
        ng.bbox.setTop( cursor.y() - glyph->top );
        ng.bbox.setWidth( glyph->width );
        ng.bbox.setHeight( glyph->height );
@@ -511,13 +510,7 @@ int eTextPara::renderString(const char *string, int rflags)
        
        if (!current_font)
                return -1;
-               
-       if (cursor.y()==-1)
-       {
-               cursor=ePoint(area.x(), area.y()+(current_face->size->metrics.ascender>>6));
-               left=cursor.x();
-       }
-               
+
 #ifdef HAVE_FREETYPE2
        if ((FTC_Manager_LookupFace(fontRenderClass::instance->cacheManager,
                                    current_font->scaler.face_id,
@@ -540,7 +533,18 @@ int eTextPara::renderString(const char *string, int rflags)
                cache_current_font=&current_font->font.font;
        }
 #endif
-       
+
+       if (!current_face)
+               eFatal("eTextPara::renderString: no current_face");
+       if (!current_face->size)
+               eFatal("eTextPara::renderString: no current_face->size");
+
+       if (cursor.y()==-1)
+       {
+               cursor=ePoint(area.x(), area.y()+(current_face->size->metrics.ascender>>6));
+               left=cursor.x();
+       }
+
        std::vector<unsigned long> uc_string, uc_visual;
        if (string)
                uc_string.reserve(strlen(string));