layout>> 0 pango_layout_get_line_readonly ;
: line-offset>x ( layout n -- x )
- #! n is an index into the UTF8 encoding of the text
+ ! n is an index into the UTF8 encoding of the text
[ drop first-line ] [ swap string>> >utf8-index ] 2bi
f { int } [ pango_layout_line_index_to_x ] with-out-parameters
pango>float ;
: x>line-offset ( layout x -- n )
- #! n is an index into the UTF8 encoding of the text
+ ! n is an index into the UTF8 encoding of the text
[
[ first-line ] dip
float>pango
] make-bitmap-image ;
: escape-nulls ( str -- str' )
- #! Replace nulls with something else since Pango uses null-terminated
- #! strings
+ ! Replace nulls with something else since Pango uses null-terminated
+ ! strings
H{ { 0 CHAR: zero-width-no-break-space } } substitute ;
: unpack-selection ( layout string/selection -- layout )
swap <PangoLayout> &g_object_unref layout-extents drop dim>> second ;
MEMO: missing-font-metrics ( font -- metrics )
- #! Pango doesn't provide x-height and cap-height but Core Text does, so we
- #! simulate them on Pango.
+ ! Pango doesn't provide x-height and cap-height but Core Text does, so we
+ ! simulate them on Pango.
[
[ metrics new ] dip
[ "x" glyph-height >>x-height ]