diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/include/fxge/fx_font.h | 16 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 103 |
2 files changed, 0 insertions, 119 deletions
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index 5cd16207e6..50cbba8e26 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -431,22 +431,6 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int anti_alias, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); -FX_BOOL OutputGlyph(void* dib, - int x, - int y, - CFX_Font* pFont, - double font_size, - CFX_AffineMatrix* pMatrix, - unsigned long glyph_index, - unsigned long argb); -FX_BOOL OutputText(void* dib, - int x, - int y, - CFX_Font* pFont, - double font_size, - CFX_AffineMatrix* pText_matrix, - unsigned short const* text, - unsigned long argb); class IFX_GSUBTable { public: static IFX_GSUBTable* Create(CFX_Font* pFont); diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 7a84330ac0..b96b352e51 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -1643,109 +1643,6 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, } return pGlyphBitmap; } -FX_BOOL _OutputGlyph(void* dib, - int x, - int y, - CFX_Font* pFont, - int glyph_index, - FX_ARGB argb) { - CFX_DIBitmap* pDib = (CFX_DIBitmap*)dib; - FXFT_Face face = pFont->GetFace(); - int error = FXFT_Load_Glyph(face, glyph_index, FXFT_LOAD_NO_BITMAP); - if (error) { - return FALSE; - } - error = FXFT_Render_Glyph(face, FXFT_RENDER_MODE_NORMAL); - if (error) { - return FALSE; - } - int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(face)); - int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(face)); - int left = FXFT_Get_Glyph_BitmapLeft(face); - int top = FXFT_Get_Glyph_BitmapTop(face); - const uint8_t* src_buf = - (const uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(face)); - int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(face)); - CFX_DIBitmap mask; - mask.Create(bmwidth, bmheight, FXDIB_8bppMask); - uint8_t* dest_buf = mask.GetBuffer(); - int dest_pitch = mask.GetPitch(); - for (int row = 0; row < bmheight; row++) { - const uint8_t* src_scan = src_buf + row * src_pitch; - uint8_t* dest_scan = dest_buf + row * dest_pitch; - FXSYS_memcpy(dest_scan, src_scan, dest_pitch); - } - pDib->CompositeMask(x + left, y - top, bmwidth, bmheight, &mask, argb, 0, 0); - return TRUE; -} -FX_BOOL OutputText(void* dib, - int x, - int y, - CFX_Font* pFont, - double font_size, - CFX_AffineMatrix* pText_matrix, - unsigned short const* text, - unsigned long argb) { - if (!pFont) { - return FALSE; - } - FXFT_Face face = pFont->GetFace(); - FXFT_Select_Charmap(pFont->m_Face, FXFT_ENCODING_UNICODE); - if (pText_matrix) { - FXFT_Matrix ft_matrix; - ft_matrix.xx = (signed long)(pText_matrix->a / 64 * 65536); - ft_matrix.xy = (signed long)(pText_matrix->c / 64 * 65536); - ft_matrix.yx = (signed long)(pText_matrix->b / 64 * 65536); - ft_matrix.yy = (signed long)(pText_matrix->d / 64 * 65536); - FXFT_Set_Transform(face, &ft_matrix, 0); - } - FX_FLOAT x_pos = 0; - for (; *text != 0; text++) { - FX_WCHAR unicode = *text; - int glyph_index = FXFT_Get_Char_Index(pFont->m_Face, unicode); - if (glyph_index <= 0) { - continue; - } - int err = FXFT_Load_Glyph( - pFont->m_Face, glyph_index, - FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH); - if (err) { - continue; - } - int w = FXFT_Get_Glyph_HoriAdvance(pFont->m_Face); - int em = FXFT_Get_Face_UnitsPerEM(pFont->m_Face); - FX_FLOAT x1, y1; - pText_matrix->Transform(x_pos, 0, x1, y1); - _OutputGlyph(dib, (int)x1 + x, (int)-y1 + y, pFont, glyph_index, argb); - x_pos += (FX_FLOAT)w / em; - } - if (pText_matrix) - ResetTransform(face); - return TRUE; -} -FX_BOOL OutputGlyph(void* dib, - int x, - int y, - CFX_Font* pFont, - double font_size, - CFX_AffineMatrix* pMatrix, - unsigned long glyph_index, - unsigned long argb) { - FXFT_Matrix ft_matrix; - if (pMatrix) { - ft_matrix.xx = (signed long)(pMatrix->a * font_size / 64 * 65536); - ft_matrix.xy = (signed long)(pMatrix->c * font_size / 64 * 65536); - ft_matrix.yx = (signed long)(pMatrix->b * font_size / 64 * 65536); - ft_matrix.yy = (signed long)(pMatrix->d * font_size / 64 * 65536); - } else { - ft_matrix.xx = (signed long)(font_size / 64 * 65536); - ft_matrix.xy = ft_matrix.yx = 0; - ft_matrix.yy = (signed long)(font_size / 64 * 65536); - } - ScopedFontTransform scoped_transform(pFont->m_Face, &ft_matrix); - FX_BOOL ret = _OutputGlyph(dib, x, y, pFont, glyph_index, argb); - return ret; -} const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_index, int dest_width) { |