diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/include/fxge/fx_freetype.h | 15 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 14 |
2 files changed, 7 insertions, 22 deletions
diff --git a/core/include/fxge/fx_freetype.h b/core/include/fxge/fx_freetype.h index 6419c6b6c2..4b49d5f6ea 100644 --- a/core/include/fxge/fx_freetype.h +++ b/core/include/fxge/fx_freetype.h @@ -4,12 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "../../../third_party/freetype/include/ft2build.h" -#include "../../../third_party/freetype/include/freetype.h" -#include "../../../third_party/freetype/include/ftoutln.h" -#include "../../../third_party/freetype/include/ftmm.h" -#include "../../../third_party/freetype/include/internal/ftobjs.h" -#include "../../../third_party/freetype/include/tttables.h" +#include <ft2build.h> +#include <freetype.h> +#include <ftglyph.h> +#include <ftlcdfil.h> +#include <ftmm.h> +#include <ftoutln.h> +#include <tttables.h> #ifdef __cplusplus extern "C" { #endif @@ -111,8 +112,6 @@ typedef FT_CharMap FXFT_CharMap; #define FXFT_Get_MM_Axis_Min(axis) ((FT_Var_Axis*)axis)->minimum #define FXFT_Get_MM_Axis_Max(axis) ((FT_Var_Axis*)axis)->maximum #define FXFT_Get_MM_Axis_Def(axis) ((FT_Var_Axis*)axis)->def -#define FXFT_Get_Face_Internal_Flag(face) ((FT_Face)face)->internal->transform_flags -#define FXFT_Set_Face_Internal_Flag(face, flag) (((FT_Face)face)->internal->transform_flags = flag) #define FXFT_Alloc(library, size) ((FT_Library)library)->memory->alloc(((FT_Library)library)->memory, size) #define FXFT_Free(face, p) ((FT_Face)face)->memory->free(((FT_Face)face)->memory, p) #define FXFT_Get_Glyph_Outline(face) &((FT_Face)face)->glyph->outline diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index eb9b7d0a13..aca739afae 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -1332,12 +1332,10 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde pFont->AdjustMMParams(glyph_index, dest_width, pFont->GetSubstFont()->m_Weight); } } - int transflag = FXFT_Get_Face_Internal_Flag(m_Face); FXFT_Set_Transform(m_Face, &ft_matrix, 0); int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) ? FXFT_LOAD_NO_BITMAP : (FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING); int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); if (error) { - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return NULL; } int weight = 0; @@ -1349,7 +1347,6 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde if (pSubstFont && !(pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && weight > 400) { int index = (weight - 400) / 10; if (index >= WEIGHTPOW_ARRAY_SIZE) { - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return NULL; } int level = 0; @@ -1363,13 +1360,11 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde FXFT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary, FT_LCD_FILTER_DEFAULT); error = FXFT_Render_Glyph(m_Face, anti_alias); if (error) { - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return NULL; } int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face)); int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face)); if (bmwidth > 2048 || bmheight > 2048) { - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return NULL; } int dib_width = bmwidth; @@ -1406,7 +1401,6 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde _GammaAdjust(pDestBuf, bmwidth, bmheight, dest_pitch, CFX_GEModule::Get()->GetTextGammaTable()); } } - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return pGlyphBitmap; } FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, @@ -1448,7 +1442,6 @@ FX_BOOL OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, } FXFT_Face face = pFont->GetFace(); FXFT_Select_Charmap(pFont->m_Face, FXFT_ENCODING_UNICODE); - int transflag = FXFT_Get_Face_Internal_Flag(pFont->m_Face); if (pText_matrix) { FXFT_Matrix ft_matrix; ft_matrix.xx = (signed long)(pText_matrix->a / 64 * 65536); @@ -1476,7 +1469,6 @@ FX_BOOL OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, glyph_index, argb); x_pos += (FX_FLOAT)w / em; } - FXFT_Set_Face_Internal_Flag(pFont->m_Face, transflag); return TRUE; } FX_BOOL OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, @@ -1493,11 +1485,9 @@ FX_BOOL OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, ft_matrix.xy = ft_matrix.yx = 0; ft_matrix.yy = (signed long)(font_size / 64 * 65536); } - int transflag = FXFT_Get_Face_Internal_Flag(pFont->m_Face); FXFT_Set_Transform(pFont->m_Face, &ft_matrix, 0); FX_BOOL ret = _OutputGlyph(dib, x, y, pFont, glyph_index, argb); - FXFT_Set_Face_Internal_Flag(pFont->m_Face, transflag); return ret; } const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_index, int dest_width) @@ -1644,12 +1634,10 @@ CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight); } } - int transflag = FXFT_Get_Face_Internal_Flag(m_Face); FXFT_Set_Transform(m_Face, &ft_matrix, 0); int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) ? FXFT_LOAD_NO_BITMAP : FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING; int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); if (error) { - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return NULL; } if (m_pSubstFont && !(m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && m_pSubstFont->m_Weight > 400) { @@ -1676,7 +1664,6 @@ CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) params.m_PointCount = 0; FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); if (params.m_PointCount == 0) { - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return NULL; } CFX_PathData* pPath = FX_NEW CFX_PathData; @@ -1695,7 +1682,6 @@ CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) if (params.m_PointCount) { pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE; } - FXFT_Set_Face_Internal_Flag(m_Face, transflag); return pPath; } void _CFX_UniqueKeyGen::Generate(int count, ...) |