: selection-rect ( dim line selection -- rect )
[let [ start>> ] [ end>> ] [ string>> ] tri :> ( start end string )
- start end [ 0 swap string subseq utf16n encode length 2 / >integer ] bi@
+ start end [ 0 swap string subseq utf16n encode length 2 /i ] bi@
]
[ f CTLineGetOffsetForStringIndex round ] bi-curry@ bi
[ drop nip 0 ] [ swap - swap second ] 3bi <CGRect> ;
0 utf16-index 2 * str utf16n encode subseq utf16n decode length ;
:: >utf16-index ( str codepoint-index -- utf16-index )
- 0 codepoint-index str subseq utf16n encode length 2 / >integer ;
+ 0 codepoint-index str subseq utf16n encode length 2 /i ;
:: earlier-caret/mark ( editor -- loc )
editor editor-caret :> caret
] if-empty ;
M:: core-text-renderer offset>x ( n font string -- x )
- font string cached-line line>>
- 0 n string subseq utf16n encode length 2 / >integer
+ font string cached-line line>>
+ 0 n string subseq utf16n encode length 2 /i
f
CTLineGetOffsetForStringIndex unscale ;
0 utf16-index 2 * str utf16n encode subseq utf16n decode length ;
:: >utf16-index ( str codepoint-index -- utf16-index )
- 0 codepoint-index str subseq utf16n encode length 2 / >integer ;
+ 0 codepoint-index str subseq utf16n encode length 2 /i ;
PRIVATE>
: make-ssa ( dc script-string -- ssa )
dup selection? [ string>> ] when
utf16n encode ! pString
- dup length 2 / >integer ! cString
+ dup length 2 /i ! cString
dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended size"
-1 ! iCharset -- Unicode
ssa-dwFlags
{ delo D Digs3 Digs }
[ [ [ D1 of ] [ D2 of ] [ C1 of ] tri + + ] S is ]
[ [ S of 10 mod ] D is ]
- [ [ S of 10 / >integer ] C is ]
+ [ [ S of 10 /i ] C is ]
} rule
{ delo A L L } { { nonvaro A } !! } rule
:: split ( fr -- k fr' )
fr >cfrac< :> ( n a b )
- n sqrt a + b / >integer
+ n sqrt a + b /i
dup n swap
b * a swap -
b