string-dim ( font string -- dim ) (original) (raw)
string-dim ( font string -- dim )
Factor handbook » UI framework » Implementing new gadgets » Customizing gadget appearance » Implementing custom drawing logic » Rendering text
Prev: | string-height ( font string -- h ) |
---|---|
Next: | draw-string ( font string -- ) |
Inputs
font | a font |
---|---|
string | a string |
Outputs
dim | a pair of integers |
---|
Generic word contract
Outputs the dimensions of a string.
Notes
This is a low-level word; use text-dim instead.
Definition
HOOK: string-dim font-renderer ( font string -- dim )
Methods
USING: accessors core-text math.vectors sequences
ui.text.core-text ui.text.core-text.private ui.text.private ;
M: core-text-renderer string-dim
[ " " string-dim { 0 1 } v* ]
[ cached-line dim>> scale-dim ] if-empty ;