patzy/glaw — Issue #2: index out of bounds on unicode char
Author: kenanb
Created: 2012-02-25 20:39:08+00:00
State: open

(glaw-examples:run-example 'glaw-examples:console)

I press "ş" and I get this:

Index 351 out of bounds for (SIMPLE-VECTOR 256), should be nonnegative and <256.
[Condition of type SB-INT:INVALID-ARRAY-INDEX-ERROR]

Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [TERMINATE-THREAD] Terminate this thread (#)

Backtrace:
0: (SB-INT:INVALID-ARRAY-INDEX-ERROR ..)
Locals:
ARRAY = #(#S(GLAW::GLYPH :U NIL :V NIL :DU NIL :DV NIL :ADVANCE 0 :ID NIL) #S(GLAW::GLYPH :U NIL :V NIL :DU NIL :DV NIL :ADVANCE 0 :ID NIL) #S(GLAW::GLYPH :U NIL :V NIL :DU NIL :DV NIL :ADVANCE 0 :ID NIL) ..)
SB-IMPL::AXIS = NIL
SB-IMPL::BOUND = 256
SB-INT:INDEX = 351
1: (SB-KERNEL::INVALID-ARRAY-INDEX-ERROR-HANDLER ..)
Locals:
SB-DEBUG::ARG-0 = :
SB-DEBUG::ARG-1 = #.(SB-SYS:INT-SAP #X7FFFF496D900)
SB-DEBUG::ARG-2 = #
SB-DEBUG::ARG-3 = (149 84 468)
2: (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #X7FFFF496D480) #)
Locals:
SB-DEBUG::ARG-0 = #.(SB-SYS:INT-SAP #X7FFFF496D480)
SB-DEBUG::ARG-1 = :
3: ("foreign function: #x4180DF")
[No Locals]

the array is

#<(SIMPLE-VECTOR 256) {100B15CBFF}>
--------------------
Dimensions: (256)
Element type: T
Total size: 256
Adjustable: NIL
Fill pointer: NIL

It consists of GLAW::GLYPH structs.

I think the problem is in font.lisp in glaw source. create-font font-build-cache and destroy-font all seem to iterate on an index of 256.