Handbook
Glossary
offset>x ( n font string -- x )
Factor handbook
»
UI framework
»
Implementing new gadgets
»
Customizing gadget appearance
»
Implementing custom drawing logic
»
Rendering text
Prev:
x>offset ( x font string -- n )
Next:
draw-text ( font text -- )
Vocabulary
ui
.
text
Inputs
n
an
integer
font
a
font
string
a
string
Outputs
x
a
real
Generic word contract
Outputs the x coordinate of the character at the given index.
Definition
USING:
ui.text.private
;
IN:
ui.text
HOOK:
offset>x
font-renderer
( n font string -- x )
Methods
USING:
accessors
core-text
io.encodings.string
io.encodings.utf16
math
opengl
sequences
ui.text
ui.text.core-text
;
M::
core-text-renderer
offset>x
( n font string -- x )
font string
cached-line
line>>
0 n string
subseq
utf16n
encode
length
2
/i
f
CTLineGetOffsetForStringIndex
gl-unscale
;