Commit b6e9913f authored by Cyril Deguet's avatar Cyril Deguet

- all: use fribidi in skins2 text rendering if available

parent cb6024d1
...@@ -2950,7 +2950,9 @@ from http://www.freetype.org/, or configure with --disable-freetype. Have a nice ...@@ -2950,7 +2950,9 @@ from http://www.freetype.org/, or configure with --disable-freetype. Have a nice
if test "${FRIBIDI_CONFIG}" != "no" if test "${FRIBIDI_CONFIG}" != "no"
then then
VLC_ADD_CFLAGS([freetype], [`${FRIBIDI_CONFIG} --cflags` -DHAVE_FRIBIDI]) VLC_ADD_CFLAGS([freetype], [`${FRIBIDI_CONFIG} --cflags` -DHAVE_FRIBIDI])
VLC_ADD_CPPFLAGS([skins2], [`${FRIBIDI_CONFIG} --cflags` -DHAVE_FRIBIDI])
VLC_ADD_LDFLAGS([freetype], [`${FRIBIDI_CONFIG} --libs`]) VLC_ADD_LDFLAGS([freetype], [`${FRIBIDI_CONFIG} --libs`])
VLC_ADD_LDFLAGS([skins2], [`${FRIBIDI_CONFIG} --libs`])
fi fi
fi fi
fi fi
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include "ft2_bitmap.hpp" #include "ft2_bitmap.hpp"
#include "../utils/ustring.hpp" #include "../utils/ustring.hpp"
#ifdef HAVE_FRIBIDI
#include <fribidi/fribidi.h>
#endif
FT2Font::FT2Font( intf_thread_t *pIntf, const string &rName, int size ): FT2Font::FT2Font( intf_thread_t *pIntf, const string &rName, int size ):
GenericFont( pIntf ), m_name( rName ), m_buffer( NULL ), m_size( size ), GenericFont( pIntf ), m_name( rName ), m_buffer( NULL ), m_size( size ),
...@@ -160,6 +164,19 @@ GenericBitmap *FT2Font::drawString( const UString &rString, uint32_t color, ...@@ -160,6 +164,19 @@ GenericBitmap *FT2Font::drawString( const UString &rString, uint32_t color,
// Get the length of the string // Get the length of the string
int len = rString.length(); int len = rString.length();
// Use fribidi if available
#ifdef HAVE_FRIBIDI
uint32_t *pFribidiString = NULL;
if( len > 0 )
{
pFribidiString = new uint32_t[len+1];
FriBidiCharType baseDir = FRIBIDI_TYPE_ON;
fribidi_log2vis( (FriBidiChar*)pString, len, &baseDir,
(FriBidiChar*)pFribidiString, 0, 0, 0 );
pString = pFribidiString;
}
#endif
// Array of glyph bitmaps and position // Array of glyph bitmaps and position
FT_Glyph *glyphs = new FT_Glyph[len]; FT_Glyph *glyphs = new FT_Glyph[len];
int *pos = new int[len]; int *pos = new int[len];
...@@ -241,6 +258,13 @@ GenericBitmap *FT2Font::drawString( const UString &rString, uint32_t color, ...@@ -241,6 +258,13 @@ GenericBitmap *FT2Font::drawString( const UString &rString, uint32_t color,
} }
} }
#ifdef HAVE_FRIBIDI
if( len > 0 )
{
delete[] pFribidiString;
}
#endif
// Adjust the size for vertical padding // Adjust the size for vertical padding
yMax = __MAX( yMax, m_ascender ); yMax = __MAX( yMax, m_ascender );
yMin = __MIN( yMin, m_descender ); yMin = __MIN( yMin, m_descender );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment