Re: vdr 1.5.16 - minor problem in font.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/29/08 23:01, Tobi wrote:
> Klaus Schmidinger wrote:
> 
>>> Can you please verify if the attached patch does this correctly?
>> Maybe the attached version is even better, because there are also other
>> places where Glyph() is called.
> 
> The patch works, but you should also pass the AntiAliased parameter when
> recursivly calling Glyph().

Right.

> Besides this - I have the 0xA0 about 80 times in my epg.data (very often on
> DMAX). As far as I can tell, the 0xA0 is used as NON-BREAKING SPACE to avoid the
> collapsing of two or more spaces. Therefore the 0xA0 might as well be rendered
> as normal single space by default:
> 
> if (CharCode == 0xA0)
>    CharCode = 0x20;

That's certainly the correct solution - 0xA0 is officially specified as
non-breaking space.

Attached is the complete patch, please verify.

Klaus
--- font.c	2008/02/09 11:52:25	1.23
+++ font.c	2008/03/01 10:19:41
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: font.c 1.23 2008/02/09 11:52:25 kls Exp $
+ * $Id: font.c 1.24 2008/02/29 13:35:15 kls Exp kls $
  */
 
 #include "font.h"
@@ -184,6 +184,10 @@
 
 cGlyph* cFreetypeFont::Glyph(uint CharCode, bool AntiAliased) const
 {
+  // Non-breaking space:
+  if (CharCode == 0xA0)
+     CharCode = 0x20;
+
   // Lookup in cache:
   cList<cGlyph> *glyphCache = AntiAliased ? &glyphCacheAntiAliased : &glyphCacheMonochrome;
   for (cGlyph *g = glyphCache->First(); g; g = glyphCache->Next(g)) {
@@ -214,6 +218,9 @@
         return Glyph;
         }
      }
+#define UNKNOWN_GLYPH_INDICATOR '?'
+  if (CharCode != UNKNOWN_GLYPH_INDICATOR)
+     return Glyph(UNKNOWN_GLYPH_INDICATOR, AntiAliased);
   return NULL;
 }
 
@@ -258,6 +265,8 @@
            uint sym = Utf8CharGet(s, sl);
            s += sl;
            cGlyph *g = Glyph(sym, AntiAliased);
+           if (!g)
+              continue;
            int kerning = Kerning(g, prevSym);
            prevSym = sym;
            uchar *buffer = g->Bitmap();
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux