Version 1.7.16

- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Added missing Dtypes for ATSC (thanks to Alex Lasnier).
- Updated the Portuguese language texts (thanks to Cristiano A. Silva).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed the array size of Atypes in cPatFilter::Process() (thanks to
  Rolf Ahrenberg).
- Added locking to the cCutter functions to avoid a crash in case CutRecording()
  is called from a plugin (reported by Andreas Mair).
- Fixed DDS detection for HD resolution subtitles (thanks to Reinhard Nissl).
- Fixed following symbolic links in RemoveFileOrDir().
- Added support for languages that are written right-to-left (based on a patch
  from Osama Alrawab). See INSTALL for information on how to turn this on.
- Added Arabian language texts (thanks to Osama Alrawab).
This commit is contained in:
Klaus Schmidinger
2010-09-19 16:00:00 +02:00
parent c2c45d68c6
commit 58db02442b
22 changed files with 1847 additions and 333 deletions

41
font.c
View File

@@ -4,12 +4,17 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: font.c 2.4 2009/12/31 14:49:59 kls Exp $
* BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya.
*
* $Id: font.c 2.5 2010/09/19 11:49:19 kls Exp $
*/
#include "font.h"
#include <ctype.h>
#include <fontconfig/fontconfig.h>
#ifdef BIDI
#include <fribidi.h>
#endif
#include <ft2build.h>
#include FT_FREETYPE_H
#include "config.h"
@@ -240,6 +245,10 @@ int cFreetypeFont::Width(const char *s) const
{
int w = 0;
if (s) {
#ifdef BIDI
cString bs = Bidi(s);
s = bs;
#endif
uint prevSym = 0;
while (*s) {
int sl = Utf8CharLen(s);
@@ -259,6 +268,10 @@ int cFreetypeFont::Width(const char *s) const
void cFreetypeFont::DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const
{
if (s && height) { // checking height to make sure we actually have a valid font
#ifdef BIDI
cString bs = Bidi(s);
s = bs;
#endif
bool AntiAliased = Setup.AntiAlias && Bitmap->Bpp() >= 8;
bool TransparentBackground = ColorBg == clrTransparent;
int16_t BlendLevelIndex[MAX_BLEND_LEVELS]; // tIndex is 8 bit unsigned, so a negative value can be used to mark unused entries
@@ -443,6 +456,32 @@ cString cFont::GetFontFileName(const char *FontName)
return FontFileName;
}
#ifdef BIDI
cString cFont::Bidi(const char *Ltr)
{
fribidi_set_mirroring(true);
fribidi_set_reorder_nsm(false);
FriBidiCharSet fribidiCharset = FRIBIDI_CHAR_SET_UTF8;
int LtrLen = strlen(Ltr);
FriBidiCharType Base = FRIBIDI_TYPE_L;
FriBidiChar *Logical = MALLOC(FriBidiChar, LtrLen + 1) ;
int RtlLen = fribidi_charset_to_unicode(fribidiCharset, const_cast<char *>(Ltr), LtrLen, Logical);
FriBidiChar *Visual = MALLOC(FriBidiChar, LtrLen + 1) ;
char *Rtl = NULL;
bool ok = fribidi_log2vis(Logical, RtlLen, &Base, Visual, NULL, NULL, NULL);
if (ok) {
fribidi_remove_bidi_marks(Visual, RtlLen, NULL, NULL, NULL);
Rtl = MALLOC(char, RtlLen * 4);
fribidi_unicode_to_charset(fribidiCharset, Visual, RtlLen, Rtl);
}
free(Logical);
free(Visual);
if (ok)
return cString(Rtl, true);
return cString(Ltr);
}
#endif
// --- cTextWrapper ----------------------------------------------------------
cTextWrapper::cTextWrapper(void)