applied bold style for bidi
authorSungyeon Woo <s.woo@samsung.com>
Sat, 30 Mar 2013 06:55:12 +0000 (15:55 +0900)
committerSungyeon Woo <s.woo@samsung.com>
Sat, 30 Mar 2013 06:55:12 +0000 (15:55 +0900)
Change-Id: I23ef0aa4eb4726a403a7696ca892d42e7491b528
Signed-off-by: Sungyeon Woo <s.woo@samsung.com>
src/graphics/FGrp_Font.cpp
src/graphics/FGrp_FontFt2.cpp
src/graphics/FGrp_FontRsrcManager.cpp

index c352ddd..34e0531 100644 (file)
@@ -2436,6 +2436,13 @@ _Font::__GetFont(wchar_t character)
                                // keep it
 #ifdef USE_HASHMAP_FOR_FONT
                                r = fallbackFontMap->Add(fontNameTemp, out);
+
+                               if (r == E_OBJ_ALREADY_EXIST)
+                               {
+                                       pFallbackFont = out.get();
+                                       break;
+                               }
+
                                SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 #else
                                fallbackFontMap->insert(_FontRsrcManager::FontMapT::value_type(fontNameTemp, out));
index 2edbf7b..c66a1d5 100644 (file)
@@ -591,8 +591,8 @@ _FontFt2::LoadGlyph(unsigned long character, Glyph** ppFontGlyphData)
        CHECK_NULL_PARAM(__pFontFace);
        CHECK_NULL_PARAM(ppFontGlyphData);
 
-       bool rtn = false;
-       rtn = FindCache(character, __fontAttrib.size, __fontAttrib.style, ppFontGlyphData);
+       bool rtn = FindCache(character, __fontAttrib.size, __fontAttrib.style, ppFontGlyphData);
+
        if (rtn)
        {
                return true;
@@ -605,7 +605,6 @@ _FontFt2::LoadGlyph(unsigned long character, Glyph** ppFontGlyphData)
 
        pFace = FT_Face(__pFontFace);
 
-       // is it fixed size?
        if (!FT_IS_SCALABLE(pFace))
        {
                SysLog(NID_GRP, "[] FT_IS_SCALABLE has been failed");
@@ -880,7 +879,7 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti
                FT_Matrix matrix;
                FT_Vector pen = {0, 0};
 
-               this->__SetTransMatrix(&matrix);
+               __SetTransMatrix(&matrix);
 
                FT_Set_Transform(pFace, &matrix, &pen);
        }
@@ -889,6 +888,10 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti
 
        out.RemoveAll();
 
+       FT_Error error = 1;
+
+       bool isSynthetic = (__fontAttrib.style & _IFont::STYLE_BOLD) && (__fontProperty.weightClass < 500);
+
        for (unsigned int i = 0; i < glyphList.GetCount(); i++)
        {
                const _FontGlyphList::GlyphAuxInfo& auxInfo = glyphList.GetGlyphAuxInfo(i);
@@ -900,15 +903,25 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti
 
                FT_UInt glyph_index = auxInfo.glyphIndex;
 
-               _IFont::GlyphBitmap image;
-
-               FT_Error error = FT_Load_Glyph(pFace, glyph_index, /*FT_LOAD_RENDER*/FT_LOAD_DEFAULT/* | FT_LOAD_NO_BITMAP*/);
+               if (isSynthetic)
+               {
+                       error = FT_Load_Glyph(pFace, glyph_index, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
+               }
+               else
+               {
+                       error = FT_Load_Glyph(pFace, glyph_index, /*FT_LOAD_RENDER*/FT_LOAD_DEFAULT/* | FT_LOAD_NO_BITMAP*/);
+               }
 
                if (error)
                {
                        continue;
                }
 
+               if (isSynthetic)
+               {
+                       FT_Outline_Embolden(&pFace->glyph->outline, __fontAttrib.boldWeight.__fixedPoint);
+               }
+
                error = FT_Render_Glyph(pFace->glyph, FT_RENDER_MODE_NORMAL);
 
                if (error)
@@ -916,6 +929,8 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti
                        continue;
                }
 
+               _IFont::GlyphBitmap image;
+
                FT_GlyphSlot pSlot = FT_GlyphSlot(pFace->glyph);
 
                switch (pSlot->bitmap.pixel_mode)
index 1fdc728..faa0849 100644 (file)
@@ -884,7 +884,8 @@ _FontRsrcManager::__AddFont(const _Util::WString& key, const SharedFontResource&
 
 #ifdef USE_HASHMAP_FOR_FONT
        result r = __fontRsrcMap.Add(key, font);
-       SysTryReturn(NID_GRP, r == E_SUCCESS, false, false, "[%s] Failed to add font into resource pool", GetErrorMessage(r));
+
+       SysTryReturn(NID_GRP, r == E_SUCCESS || r == E_OBJ_ALREADY_EXIST, false, false, "[%s] Failed to add font into resource pool", GetErrorMessage(r));
 #else
        __fontRsrcMap[key] = font;
 #endif