core-text: cache attribute assoc.
parent
7b7df45c50
commit
f278cb5447
|
@ -34,16 +34,19 @@ FUNCTION: CGRect CTLineGetImageBounds ( CTLineRef line, CGContextRef context ) ;
|
||||||
|
|
||||||
ERROR: not-a-string object ;
|
ERROR: not-a-string object ;
|
||||||
|
|
||||||
|
MEMO: make-attributes ( open-font color -- hashtable )
|
||||||
|
[
|
||||||
|
kCTForegroundColorAttributeName ,,
|
||||||
|
kCTFontAttributeName ,,
|
||||||
|
] H{ } make ;
|
||||||
|
|
||||||
: <CTLine> ( string open-font color -- line )
|
: <CTLine> ( string open-font color -- line )
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
dup selection? [ string>> ] when
|
dup selection? [ string>> ] when
|
||||||
dup string? [ not-a-string ] unless
|
dup string? [ not-a-string ] unless
|
||||||
] 2dip
|
] 2dip
|
||||||
[
|
make-attributes <CFAttributedString> &CFRelease
|
||||||
kCTForegroundColorAttributeName ,,
|
|
||||||
kCTFontAttributeName ,,
|
|
||||||
] H{ } make <CFAttributedString> &CFRelease
|
|
||||||
CTLineCreateWithAttributedString
|
CTLineCreateWithAttributedString
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue