mdraw_text(3m17n)

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

✨ NAME ✨

mdraw_text β€” bestie it literally just draws text, that's the whole thing πŸ’–


🌸 SYNOPSIS 🌸

int mdraw_text (MFrame * frame, MDrawWindow win, int x, int y, MText *
mt, int from, int to)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. mdraw_text() draws an M-text on a window, no cap. Specifically it draws the text between from and to of M-text mt on window win of frame frame, at coordinate (x, y). that's it. that's the function. iconic 🌈

how the text looks β€” size, style, color, etc β€” is decided by the value of the text property whose key is Mface. and if the M-text, or even just part of the M-text, doesn't have that text property? no stress, it just falls back to the default face of frame. πŸ’…

the font used to draw a character in the M-text gets picked from the value of the fontset property of a face, and the algorithm goes like this:

  1. search the text properties given to the character for the one whose key is Mcharset. its value should be either a symbol specifying a charset or Mnil. if the value is Mnil, proceed to the next step. otherwise, search the mapping table of the fontset for the charset. if no entry is found, proceed to the next step.

if an entry is found, use one of the fonts in the entry that

  • has a glyph for the character and
  • that matches best with the face properties.

if no such font exists, proceed to the next step.

  1. get the character property 'script' of the character. if it's inherited, get the script property from the previous characters. if there is no previous character, or none of them has the script property other than inherited, proceed to the next step.

search the text properties given to the character for the one whose key is Mlanguage; its value should be either a symbol specifying a language or Mnil.

search the mapping table of the fontset for the combination of the script and language. if no entry is found, proceed to the next step.

if an entry is found, use one of the fonts in the entry that

  • has a glyph for the character and
  • that matches best with the face properties.

if no such font exists, proceed to the next step.

  1. search the fall-back table of the fontset for a font that has a glyph of the character. if such a font is found, use that font.

and if no font is found by the algorithm above? 😭 this function draws an empty box for the character. yeah. the little tofu box. we've all been there.

⚠️ heads up bestie β€” this function draws only the glyph foreground. if you want to specify the background color, you gotta use mdraw_image_text() or mdraw_text_with_control() instead. don't come for me, that's just how it is. πŸ™ˆ

also, for the record: this function is the counterpart of XDrawString(), XmbDrawString(), and XwcDrawString() functions in the X Window System. iykyk. πŸ’œ


⭐ RETURN VALUE ⭐

if the operation was successful, mdraw_text() returns 0. slay. πŸŽ€

if an error is detected, it returns -1 and assigns an error code to the external variable merror_code. not slay. πŸ’€


πŸ’… ERRORS πŸ’…

  • MERROR_RANGE

πŸ‘‘ SEE ALSO πŸ‘‘

  • mdraw_image_text()

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, and it's the mdraw_text(3m17n) page from the m17n Library. go forth and draw some glyphs, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from