shithub: riscv

Download patch

ref: 1cddff55da9e7fad085bb446ae9c786e9511c8d3
parent: e1da4f17500da3350ffd32de3819094ea1e42ee9
author: Sigrid <[email protected]>
date: Wed Aug 5 10:25:21 EDT 2020

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

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