mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
BIDI support now checks at runtime whether the system runs with UTF-8
This commit is contained in:
parent
ea6c6d370e
commit
0730f502c5
@ -2812,3 +2812,5 @@ Dominic Evans <oldmanuk@gmail.com>
|
|||||||
Torsten Lang <info@torstenlang.de>
|
Torsten Lang <info@torstenlang.de>
|
||||||
for reporting a problem with newline characters in stream component descriptions
|
for reporting a problem with newline characters in stream component descriptions
|
||||||
of EPG data from BSkyB's "MTV MUSIC"
|
of EPG data from BSkyB's "MTV MUSIC"
|
||||||
|
for suggesting to make BIDI support check at runtime whether the system runs with
|
||||||
|
UTF-8
|
||||||
|
4
HISTORY
4
HISTORY
@ -6781,7 +6781,7 @@ Video Disk Recorder Revision History
|
|||||||
- Replaced all calls to sleep() with cCondWait::SleepMs() (thanks to Rolf Ahrenberg).
|
- Replaced all calls to sleep() with cCondWait::SleepMs() (thanks to Rolf Ahrenberg).
|
||||||
- Fixed a crash with malformed SI data (patch from vdr-portal).
|
- Fixed a crash with malformed SI data (patch from vdr-portal).
|
||||||
|
|
||||||
2012-01-11: Version 1.7.23
|
2012-01-12: Version 1.7.23
|
||||||
|
|
||||||
- Removed the '.pl' suffix from svdrpsend.pl (sorry, I missed that one).
|
- Removed the '.pl' suffix from svdrpsend.pl (sorry, I missed that one).
|
||||||
- Fixed bonding more than two devices.
|
- Fixed bonding more than two devices.
|
||||||
@ -6818,3 +6818,5 @@ Video Disk Recorder Revision History
|
|||||||
TS packets, e.g. when switching channels.
|
TS packets, e.g. when switching channels.
|
||||||
- Fixed the SVDRP command CLRE for a single channel in case there are events
|
- Fixed the SVDRP command CLRE for a single channel in case there are events
|
||||||
that have a timer (thanks to Timo Eskola).
|
that have a timer (thanks to Timo Eskola).
|
||||||
|
- BIDI support now checks at runtime whether the system runs with UTF-8 (suggested
|
||||||
|
by Torsten Lang).
|
||||||
|
40
font.c
40
font.c
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya.
|
* BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya.
|
||||||
*
|
*
|
||||||
* $Id: font.c 2.8 2011/03/28 16:29:51 kls Exp $
|
* $Id: font.c 2.9 2012/01/13 09:43:22 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
@ -508,25 +508,27 @@ cString cFont::GetFontFileName(const char *FontName)
|
|||||||
#ifdef BIDI
|
#ifdef BIDI
|
||||||
cString cFont::Bidi(const char *Ltr)
|
cString cFont::Bidi(const char *Ltr)
|
||||||
{
|
{
|
||||||
fribidi_set_mirroring(true);
|
if (cCharSetConv::SystemCharacterTable()) { // bidi requires UTF-8
|
||||||
fribidi_set_reorder_nsm(false);
|
fribidi_set_mirroring(true);
|
||||||
FriBidiCharSet fribidiCharset = FRIBIDI_CHAR_SET_UTF8;
|
fribidi_set_reorder_nsm(false);
|
||||||
int LtrLen = strlen(Ltr);
|
FriBidiCharSet fribidiCharset = FRIBIDI_CHAR_SET_UTF8;
|
||||||
FriBidiCharType Base = FRIBIDI_TYPE_L;
|
int LtrLen = strlen(Ltr);
|
||||||
FriBidiChar *Logical = MALLOC(FriBidiChar, LtrLen + 1) ;
|
FriBidiCharType Base = FRIBIDI_TYPE_L;
|
||||||
int RtlLen = fribidi_charset_to_unicode(fribidiCharset, const_cast<char *>(Ltr), LtrLen, Logical);
|
FriBidiChar *Logical = MALLOC(FriBidiChar, LtrLen + 1) ;
|
||||||
FriBidiChar *Visual = MALLOC(FriBidiChar, LtrLen + 1) ;
|
int RtlLen = fribidi_charset_to_unicode(fribidiCharset, const_cast<char *>(Ltr), LtrLen, Logical);
|
||||||
char *Rtl = NULL;
|
FriBidiChar *Visual = MALLOC(FriBidiChar, LtrLen + 1) ;
|
||||||
bool ok = fribidi_log2vis(Logical, RtlLen, &Base, Visual, NULL, NULL, NULL);
|
char *Rtl = NULL;
|
||||||
if (ok) {
|
bool ok = fribidi_log2vis(Logical, RtlLen, &Base, Visual, NULL, NULL, NULL);
|
||||||
fribidi_remove_bidi_marks(Visual, RtlLen, NULL, NULL, NULL);
|
if (ok) {
|
||||||
Rtl = MALLOC(char, RtlLen * 4 + 1);
|
fribidi_remove_bidi_marks(Visual, RtlLen, NULL, NULL, NULL);
|
||||||
fribidi_unicode_to_charset(fribidiCharset, Visual, RtlLen, Rtl);
|
Rtl = MALLOC(char, RtlLen * 4 + 1);
|
||||||
|
fribidi_unicode_to_charset(fribidiCharset, Visual, RtlLen, Rtl);
|
||||||
|
}
|
||||||
|
free(Logical);
|
||||||
|
free(Visual);
|
||||||
|
if (ok)
|
||||||
|
return cString(Rtl, true);
|
||||||
}
|
}
|
||||||
free(Logical);
|
|
||||||
free(Visual);
|
|
||||||
if (ok)
|
|
||||||
return cString(Rtl, true);
|
|
||||||
return cString(Ltr);
|
return cString(Ltr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user