MDRAW_TEXT_PER_CHAR_EXTENTS(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

mdraw_text_per_char_extents β€” the lil function that measures every single character for you, one by one, no cap πŸ“βœ¨

This one lives in the m17n Library besties, section 3 of the manual, so it's a library call, iykyk πŸŽ€


✨ SYNOPSIS ✨

int mdraw_text_per_char_extents (MFrame * frame, MText * mt, int from,
       int to, MDrawControl * control, MDrawMetric * ink_array_return,
       MDrawMetric * logical_array_return, int array_size, int *
       num_chars_return, MDrawMetric * overall_ink_return, MDrawMetric *
       overall_logical_return)

okay that signature is long long, but she ate, periodt πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So like, this function computes the text dimensions of each character of an M-text. Iconic behaviour honestly 🫢

The mdraw_text_per_char_extents() function computes the drawn metric of each character between from and to of M-text mt, and it does that assuming they're drawn on a window of frame frame using the mdraw_text_with_control() function with the drawing control object control. Main character energy, fr fr ✨

Now, array_size specifies the size of ink_array_return and logical_array_return. Each successive element of ink_array_return and logical_array_return gets set to the drawn ink and logical metrics of successive characters respectively β€” and those are relative to the drawing origin of the M-text, okay? Not random, relative to the origin πŸ’– The number of elements of ink_array_return and logical_array_return that have been set gets returned to num_chars_return. Slay, everything accounted for 🌸

⚠️ okay listen bestie: if array_size is too small to return all metrics, the function returns -1 and stores the requested size in num_chars_return. Otherwise, it returns zero. So like, check that return value, don't just ignore her 😭

If the pointers overall_ink_return and overall_logical_return are not NULL, this function also computes the metrics of the overall text and stores the results in the members of the structure pointed to by overall_ink_return and overall_logical_return. Bonus measurements, we love to see it πŸ‘‘

If control->two_dimensional is nonzero, this function computes only the metrics of characters in the first line. That's it. First line only. No further questions πŸ’€


Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


okay that's the whole page bestie, you're so welcome πŸ’œ this was Version 1.8.4, dated Mon Sep 25 2023, and yes she's serving mdraw_text_per_char_extents(3m17n) realness, mwah πŸ’…πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from