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 <tobi...@tmux.org>
---
 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


_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to