render ( line -- line image )


Vocabulary
core-text

Inputs
linean object


Outputs
linean object
imagean object


Definition


:: render ( line -- line image )
line line>> :> ctline line string>> :> string line font>>
:> font line render-loc>> [
ctline line-rect :> rect rect origin>> CGPoint>loc
:> (loc) rect size>> CGSize>dim :> (dim) (loc) vfloor
:> loc (dim) vceiling :> dim dim [ >integer 1 + ] map
:> ext loc line render-loc<< dim line render-dim<<
ext line render-ext<< line metrics>> loc dim line-loc
line loc<<
] unless
line render-loc>> :> loc line render-dim>> :> dim line
render-ext>> :> ext line ext [
{
[ font ext fill-background ]
[
loc first 0 2array dim first ext second 2array
ctline string fill-selection-background
]
[ loc set-text-position ]
[ [ ctline ] dip CTLineDraw ]
} cleave
] make-bitmap-image load-2x? >>2x? ;