freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] [PATCH] pcf_cmap_char_next: don't stop dead, skip over defaul


From: Tobias Ulmer
Subject: [ft-devel] [PATCH] pcf_cmap_char_next: don't stop dead, skip over defaultChar
Date: Mon, 1 Apr 2019 02:34:51 +0200
User-agent: NeoMutt/20170113 (1.7.2)

Problem: pcf_cmap_char_next() stops further progress when it encounters
defaultChar that isn't at 0. In case of Dina, it's at index 31, and
result will be 0.

FT_Get_Next_Char() returns *agindex == 0 for char_code 30.

This breaks charset enumeration done by fontconfig, which in turn
trickles up to XftCharExists(), takes out rxvt-unicode and more.

It's believed the same happens with gohufont, but I didn't have time to check.

The issue can be identified with fc-match -v Dina

broken:
0000: 7fffffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000

with supplied patch:
0000: 7fffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff

On another machine with older freetype:
0000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff

There's likely a better and more correct way to fixing this, however I'm
not familiar with the PCF spec or freetype to make a better call.

Signed-off-by: Tobias Ulmer <address@hidden>
---
 src/pcf/pcfdrivr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index 54bbb9d11..a13ad575b 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -163,7 +163,7 @@ THE SOFTWARE.
       result = (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
                                      ( enc->lastCol - enc->firstCol + 1 ) +
                                        charcodeCol - enc->firstCol          ];
-      if ( result != 0xFFFFU )
+      if ( result != 0xFFFFU && charcode != enc->defaultChar )
         break;
     }
 
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]