Skip to content

Commit 6cd6cb0

Browse files
authored
Merge pull request #7 from anovik/charcodeToGID_fix
[US-196] Fix for charcodeToGid check.
2 parents 18b71dc + 3b096d1 commit 6cd6cb0

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)