fix text rendering crash with strings containing nulls
parent
3bf3e13f2e
commit
e91e0edc3b
|
@ -12,8 +12,6 @@
|
||||||
- optimize away dispatch
|
- optimize away dispatch
|
||||||
|
|
||||||
- code gc
|
- code gc
|
||||||
- ppc register decls
|
|
||||||
|
|
||||||
- #jump-f #jump-f-label
|
- #jump-f #jump-f-label
|
||||||
- extract word inside M:, C:, and structure browsing for these
|
- extract word inside M:, C:, and structure browsing for these
|
||||||
- each-slot combinator
|
- each-slot combinator
|
||||||
|
@ -22,7 +20,6 @@
|
||||||
- don't hardcode so many colors
|
- don't hardcode so many colors
|
||||||
- ffi unicode strings: null char security hole
|
- ffi unicode strings: null char security hole
|
||||||
- utf16 string boxing
|
- utf16 string boxing
|
||||||
- sdl console crash
|
|
||||||
- more accurate types for various words
|
- more accurate types for various words
|
||||||
- optimize out >array, >tuple, >hashtable etc
|
- optimize out >array, >tuple, >hashtable etc
|
||||||
- write read: write should flush
|
- write read: write should flush
|
||||||
|
|
|
@ -133,8 +133,13 @@ global [
|
||||||
SDL_LockSurface
|
SDL_LockSurface
|
||||||
] when drop ;
|
] when drop ;
|
||||||
|
|
||||||
|
: filter-nulls ( str -- str )
|
||||||
|
"\0" over str-contains? [
|
||||||
|
[ dup CHAR: \0 = [ drop CHAR: \s ] when ] str-map
|
||||||
|
] when ;
|
||||||
|
|
||||||
: draw-string ( x y font text fg -- width )
|
: draw-string ( x y font text fg -- width )
|
||||||
over str-length 0 = [
|
>r filter-nulls r> over str-length 0 = [
|
||||||
2drop 3drop 0
|
2drop 3drop 0
|
||||||
] [
|
] [
|
||||||
>r >r lookup-font r> r>
|
>r >r lookup-font r> r>
|
||||||
|
@ -145,7 +150,7 @@ global [
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
||||||
: size-string ( font text -- w h )
|
: size-string ( font text -- w h )
|
||||||
>r lookup-font r> dup str-length 0 = [
|
>r lookup-font r> filter-nulls dup str-length 0 = [
|
||||||
drop TTF_FontHeight 0 swap
|
drop TTF_FontHeight 0 swap
|
||||||
] [
|
] [
|
||||||
<int-box> <int-box> [ TTF_SizeUNICODE drop ] 2keep
|
<int-box> <int-box> [ TTF_SizeUNICODE drop ] 2keep
|
||||||
|
|
|
@ -7,7 +7,7 @@ USE: lists
|
||||||
|
|
||||||
num-types [
|
num-types [
|
||||||
[
|
[
|
||||||
(instances) [
|
builtin-type instances [
|
||||||
class drop
|
class drop
|
||||||
] each
|
] each
|
||||||
] keep
|
] keep
|
||||||
|
|
|
@ -51,8 +51,3 @@ C: quuux-tuple-2
|
||||||
|
|
||||||
point-x
|
point-x
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Ensure we have a fresh word.
|
|
||||||
DEFER: losing-eq FORGET: losing-eq
|
|
||||||
[ t ] [ DEFER: losing-eq \ losing-eq TUPLE: losing-eq x y ; \ losing-eq eq? ]
|
|
||||||
unit-test
|
|
||||||
|
|
Loading…
Reference in New Issue