mtext_data(3m17n)

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

✨ mtext_data ✨

okay bestie, welcome to the m17n library manual, page mtext_data(3m17n) πŸ’– this one is literally about peeking inside your M-text and finding out what its data is actually made of. no cap.


🌸 SYNOPSIS 🌸

void* mtext_data (MText * mt, enum MTextFormat * fmt, int * nunits, int
* pos_idx, int * unit_idx)

πŸ¦‹ DESCRIPTION πŸ¦‹

so like… this function gets you info about the text data inside an M-text. iconic behavior honestly πŸ’…

The mtext_data() function returns a pointer to the text data of M-text mt. that's the main character of this whole operation right there ✨

If fmt is not NULL, the format of the text data gets stored in it. if nunits is not NULL, the number of units of the text data gets stored in it. simple as that πŸŽ€

Now here's the lil plot twist β€” if pos_idx is not NULL and it points to a non-negative number, then what it points to is a character position. In that case, the return value is a pointer to the text data of a character at that position. got it? good 🫢

Otherwise, if unit_idx is not NULL, it points to a unit position. In that case, the return value is a pointer to the text data of a character containing that unit. yes queen, character-level logic 🧚

The character position and unit position of the return value get stored in pos_idx and unit_idx respectively, if they are not NULL. very demure, very mindful of your pointers πŸ’œ

  • If the format of the text data is MTEXT_FORMAT_US_ASCII or MTEXT_FORMAT_UTF_8, one unit is unsigned char.
  • If the format is MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE, one unit is unsigned short.
  • If the format is MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE, one unit is unsigned int.
lowkey important: the unit type totally depends on which format you're rocking, so vibe check your fmt before you go poking at units bestie 😭

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>.


and that's the whole page, bestie!! πŸŽ€ this was Version 1.8.4, dated Mon Sep 25 2023, dropping as mtext_data(3m17n) β€” slay, periodt, go forth and read your text data πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from