Skip to content

Commit 3b096d1

Browse files
committed
charcodeToGid check fix.
1 parent 18b71dc commit 3b096d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

truetype/truetype.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ func (f *Font) Index(x rune) Index {
497497
return Index(val)
498498
}
499499

500-
if len(f.charcodeToGID) > int(c) {
500+
if len(f.charcodeToGID) > 0 && c < 256 {
501+
// charcodeToGID is not empty and c is in 0..255 uint8 range
501502
val := f.charcodeToGID[uint8(c)]
502503
return Index(val)
503504
}

0 commit comments

Comments
 (0)