From patchwork Sat Mar 1 10:24:26 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 12618 Received: from raven.cadsoft.de ([217.7.101.211]) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1JVOtL-0004yN-Nv for vdr@linuxtv.org; Sat, 01 Mar 2008 11:24:31 +0100 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.13.3/8.13.3) with ESMTP id m21AORJr007710 for ; Sat, 1 Mar 2008 11:24:27 +0100 Message-ID: <47C92EDA.6010107@cadsoft.de> Date: Sat, 01 Mar 2008 11:24:26 +0100 From: Klaus Schmidinger Organization: CadSoft Computer GmbH User-Agent: Thunderbird 2.0.0.9 (X11/20070801) MIME-Version: 1.0 To: vdr@linuxtv.org References: <47C74C01.40301@e-tobi.net> <47C808A2.4030602@cadsoft.de> <47C80A6F.3080406@cadsoft.de> <47C880B4.9080007@e-tobi.net> In-Reply-To: <47C880B4.9080007@e-tobi.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (raven.cadsoft.de [192.168.1.1]); Sat, 01 Mar 2008 11:24:27 +0100 (CET) Subject: Re: [vdr] vdr 1.5.16 - minor problem in font.c X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Mar 2008 10:24:31 -0000 Status: O X-Status: X-Keywords: X-UID: 15906 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 *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();