libttf: fix cmap subtable offset type and rank UCS-4 higher (more codepoints). fixes runes > 0xffff

This commit is contained in:
Sigrid 2020-08-05 14:25:21 +02:00
parent e1da4f1750
commit 1cddff55da

View file

@ -90,9 +90,9 @@ static int
ttfgotosub(TTFontU *f) ttfgotosub(TTFontU *f)
{ {
int i; int i;
u16int nsub, id, sid, off; u16int nsub, id, sid;
int rank, maxrank; int rank, maxrank;
u32int maxoff; u32int maxoff, off;
#define SUBID(a,b) ((a)<<16|(b)) #define SUBID(a,b) ((a)<<16|(b))
if(ttfgototable(f, "cmap") < 0) if(ttfgototable(f, "cmap") < 0)
@ -106,13 +106,13 @@ ttfgotosub(TTFontU *f)
case SUBID(0, 4): /* Unicode 2.0 or later (BMP and non-BMP) */ case SUBID(0, 4): /* Unicode 2.0 or later (BMP and non-BMP) */
rank = 100; rank = 100;
break; break;
case SUBID(3, 10): /* Windows, UCS-4 */
rank = 80;
break;
case SUBID(0, 0): /* Unicode default */ case SUBID(0, 0): /* Unicode default */
case SUBID(0, 1): /* Unicode 1.1 */ case SUBID(0, 1): /* Unicode 1.1 */
case SUBID(0, 2): /* ISO 10646 */ case SUBID(0, 2): /* ISO 10646 */
case SUBID(0, 3): /* Unicode 2.0 (BMP) */ case SUBID(0, 3): /* Unicode 2.0 (BMP) */
rank = 80;
break;
case SUBID(3, 10): /* Windows, UCS-4 */
rank = 60; rank = 60;
break; break;
case SUBID(3, 1): /* Windows, UCS-2 */ case SUBID(3, 1): /* Windows, UCS-2 */