neutrino arabic/hebrew font support
-
- Einsteiger
- Beiträge: 362
- Registriert: Mittwoch 14. Dezember 2005, 03:25
neutrino arabic/hebrew font support
it seems like fribdidi code from VDR/XBMC works in neutrino, with higher libfribidi version arabic text can be right rendered but some times neutrino crashes when fribidi try to mirror charset, my poor knowldge about fribidi are not enought to fix this bug ;( it could be very pretty if someone (cst?) take a look a this issue
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
-
- Developer
- Beiträge: 4189
- Registriert: Sonntag 2. November 2003, 12:36
Re: neutrino arabic/hebrew font support
How large is the code size increase and the fribidi library? You need to consider that the tuxbox-SD boxes all have limited FLASH size (in today's standards
-
- Einsteiger
- Beiträge: 362
- Registriert: Mittwoch 14. Dezember 2005, 03:25
Re: neutrino arabic/hebrew font support
Oh sorry i wrote in wrong section
the peace code is very very small, stripped libfribidi is about 33 kb not stripped 39kb
the peace code is very very small, stripped libfribidi is about 33 kb not stripped 39kb
Code: Alles auswählen
//
#if defined (ENABLE_FRIBIDI)
std::string fribidiShapeChar(const char * text)
{
int len = strlen(text);
char Rtl[len + 1];
//
fribidi_set_mirroring(true);
fribidi_set_reorder_nsm(false);
// init to utf-8
FriBidiCharSet fribidiCharset = FRIBIDI_CHAR_SET_UTF8;
// tell bidi that we need bidirectionnel
FriBidiCharType Base = FRIBIDI_TYPE_LTR;
// our buffer
FriBidiChar *Logical = (FriBidiChar *)malloc(sizeof(FriBidiChar)*(len + 1)) ;
FriBidiChar *Visual = (FriBidiChar *)malloc(sizeof(FriBidiChar)*(len + 1)) ;
if(!Visual)
{
free(Visual);
return text;
}
// convert from the selected charset to Unicode (logical)
int RtlLen = fribidi_charset_to_unicode(fribidiCharset, const_cast<char *>(text), len, Logical);
//char *Rtl = NULL;
// logical to visual
if (fribidi_log2vis(Logical, len, &Base, Visual, NULL, NULL, NULL))
{
// removes bidirectional marks
//fribidi_remove_bidi_marks(Visual, RtlLen, NULL, NULL, NULL);
//Rtl = (char *)malloc(sizeof(char)*(RtlLen * 4 + 1));
// convert back from Unicode to the charset
fribidi_unicode_to_charset(fribidiCharset, Visual, RtlLen, Rtl);
}
free(Logical);
free(Visual);
return Rtl;
}
#endif
Code: Alles auswählen
void Font::RenderString(int x, int y, const int width, const char *text, const unsigned char color, const int boxheight, const bool utf8_encoded)
{
if (!frameBuffer->getActive())
return;
pthread_mutex_lock( &renderer->render_mutex );
// fribidi
#if defined (ENABLE_FRIBIDI)
std::string Text = fribidiShapeChar(text);
text = Text.c_str();
#endif
...
Code: Alles auswählen
int Font::getRenderWidth(const char *text, const bool utf8_encoded)
{
pthread_mutex_lock( &renderer->render_mutex );
// fribidi
#if defined (ENABLE_FRIBIDI)
std::string Text = fribidiShapeChar(text);
text = Text.c_str();
#endif
...
-
- Einsteiger
- Beiträge: 362
- Registriert: Mittwoch 14. Dezember 2005, 03:25
Re: neutrino arabic/hebrew font support
* push up *
BTW:
if someone is interessted and able to translate/write arabic/hebrew local please contact me
BTW:
if someone is interessted and able to translate/write arabic/hebrew local please contact me