m17nDraw(3m17n)

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

πŸ‘‘ m17nDraw (3m17n) πŸ‘‘

okay so bestie, this is a page from The m17n Library manual, and it's literally all about drawing M-texts on a window. Grab a snack, it's a long one β€” this is part 1, so no, we're not done yet. πŸ“


✨ NAME ✨

m17nDraw_-_Dra β€” - β€” Drawing M-texts on a window. πŸ’…

(no we did not typo that, that's genuinely what it says, iykyk πŸ™ˆ)


🌸 SYNOPSIS 🌸

πŸŽ€ Data Structures

  • struct MDrawControl β€” the type of a text drawing control. it's giving "the remote control for your text".
  • struct MDrawMetric β€” the type of metric for glyphs and texts. measurements, but make it fashion.
  • struct MDrawGlyphInfo β€” the type of information about a glyph.
  • struct MDrawGlyph β€” the type of information about a glyph metric and font.

πŸ¦‹ Typedefs

  • typedef void * MDrawWindow β€” window system dependent type for a window. lowkey it's just a pointer, don't overthink it.
  • typedef void * MDrawRegion β€” window system dependent type for a region. same energy, different noun.

πŸ’– Functions

  • int mdraw_text (MFrame *frame, MDrawWindow win, int x, int y, MText *mt, int from, int to) β€” Draw an M-text on a window.
  • int mdraw_image_text (MFrame *frame, MDrawWindow win, int x, int y, MText *mt, int from, int to) β€” Draw an M-text on a window as an image.
  • int mdraw_text_with_control (MFrame *frame, MDrawWindow win, int x, int y, MText *mt, int from, int to, MDrawControl *control) β€” Draw an M-text on a window with fine control. the control freak option, respectfully.
  • int mdraw_text_extents (MFrame *frame, MText *mt, int from, int to, MDrawControl *control, MDrawMetric *overall_ink_return, MDrawMetric *overall_logical_return, MDrawMetric *overall_line_return) β€” Compute text pixel width.
  • 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) β€” Compute the text dimensions of each character of M-text.
  • int mdraw_coordinates_position (MFrame *frame, MText *mt, int from, int to, int x_offset, int y_offset, MDrawControl *control) β€” Return the character position nearest to the coordinates.
  • int mdraw_glyph_info (MFrame *frame, MText *mt, int from, int pos, MDrawControl *control, MDrawGlyphInfo *info) β€” Compute information about a glyph.
  • int mdraw_glyph_list (MFrame *frame, MText *mt, int from, int to, MDrawControl *control, MDrawGlyph *glyphs, int array_size, int *num_glyphs_return) β€” Compute information about glyph sequence.
  • void mdraw_text_items (MFrame *frame, MDrawWindow win, int x, int y, MDrawTextItem *items, int nitems) β€” Draw one or more textitems.
  • int mdraw_default_line_break (MText *mt, int pos, int from, int to, int line, int y) β€” Calculate a line breaking position.
  • void mdraw_per_char_extents (MFrame *frame, MText *mt, MDrawMetric *array_return, MDrawMetric *overall_return) β€” Obtain per character dimension information.
  • void mdraw_clear_cache (MText *mt) β€” clear cached information.

and then there's literally a lone " chillin' at the end of that list. we keep it. we don't ask questions. 🫢

⭐ Variables

  • int mdraw_line_break_option β€” Option of line breaking for drawing text.

🌈 Detailed Description 🌈

Drawing M-texts on a window. that's the whole assignment, bestie.

The m17n GUI API provides functions to draw M-texts. yes, an entire API, just for putting your fancy multilingual text on screen. iconic behavior honestly.

The fonts used for drawing are selected automatically based on the fontset and the properties of a face. and a face also specifies the appearance of M-texts β€” think font size, color, underline, etc. it's giving glam team for your glyphs. πŸ’…βœ¨

The drawing format of M-texts can be controlled in a variety of ways, which provides a powerful 2-dimensional layout facility. powerful. 2-D. layout. periodt. πŸ‘‘


✨ Data Structure Documentation ✨

πŸ’– MDrawControl πŸ’–

Type of a text drawing control. periodt πŸ’…

πŸŽ€ FIELD DOCUMENTATION πŸŽ€

  • unsigned MDrawControl::as_image β€” If it's nonzero, draw an M-text as an image, like, with the background filled with the background colors of the faces put on the M-text. If it's zero, the background is not changed. πŸ–ΌοΈ
  • unsigned MDrawControl::align_head β€” If it's nonzero and the first glyph of each line has negative lbearing, shift glyphs horizontally to the right so that no pixel is drawn to the left of the specified position. Slay alignment. ✨
  • unsigned MDrawControl::two_dimensional β€” If it's nonzero, draw an M-text two-dimensionally: newlines in the M-text break lines, and the following characters get drawn on the next line. If <format> is non-NULL and the function returns a nonzero line width, a line longer than that width is also broken. πŸ“
  • unsigned MDrawControl::orientation_reversed β€” If it's nonzero, draw an M-text to the right of a specified position. Not left, bestie. ➑️
  • unsigned MDrawControl::enable_bidi β€” If it's nonzero, reorder glyphs correctly for bidi text. Bidi rights! 🌈
  • unsigned MDrawControl::ignore_formatting_char β€” If it's nonzero, don't draw characters whose general category (in Unicode) is Cf (Other, format). Bye invisible formatting characters. πŸ™ˆ
  • unsigned MDrawControl::fixed_width β€” If it's nonzero, draw glyphs suitable for a terminal. Not yet implemented. So don't hold your breath, bestie. πŸ’€
  • unsigned MDrawControl::anti_alias β€” If it's nonzero, draw glyphs with anti-aliasing if a backend font driver supports it. Smooth like butter. 🧈✨
  • unsigned MDrawControl::disable_overlapping_adjustment β€” If it's nonzero, disable the adjustment of glyph positions to avoid horizontal overlapping at font boundary. No overlap, no problem. 🚫
  • unsigned int MDrawControl::min_line_ascent β€” If it's nonzero, the values are minimum line ascent pixels. πŸ“
  • unsigned int MDrawControl::min_line_descent β€” If it's nonzero, the values are minimum line descent pixels. πŸ“
  • unsigned int MDrawControl::max_line_ascent β€” If it's nonzero, the values are maximum line ascent pixels. πŸ“
  • unsigned int MDrawControl::max_line_descent β€” If it's nonzero, the values are maximum line descent pixels. πŸ“
  • unsigned int MDrawControl::max_line_width β€” If it's nonzero, this value says how many pixels each line can occupy on the display. The value zero means there is no limit. It is ignored if <format> is non-NULL. 🚧
  • unsigned int MDrawControl::tab_width β€” If it's nonzero, this value sets the distance between tab stops in columns (and one column is the width of a space in the default font of the frame). The value zero means 8. Tabs, but make it fashion. πŸŽ€
  • void(* MDrawControl::format) (int line, int y, int *indent, int *width) β€” If it's non-NULL, the value is a function that calculates the indentation and width limit of each line based on the line number LINE and the coordinate Y. The function stores the indentation and width limit at the place pointed to by INDENT and WIDTH, respectively.

The indentation specifies how many pixels the first glyph of each line is shifted to the right (if the member <orientation_reversed> is zero) or to the left (otherwise). If the value is negative, each line is shifted to the reverse direction.

The width limit specifies how many pixels each line can occupy on the display. The value 0 means there is no limit.

LINE and Y are reset to 0 when a line is broken by a newline character, and incremented each time a long line is broken because of the width limit.

This has an effect only when <two_dimensional> is nonzero. Formatting queen πŸ‘‘

  • int(* MDrawControl::line_break) (MText *mt, int pos, int from, int to, int line, int y) β€” If it's non-NULL, the value is a function that calculates a line breaking position when a line is too long to fit within the width limit. POS is the position of the character next to the last one that fits within the limit. FROM is the position of the first character of the line, and TO is the position of the last character displayed on the line if there were no width limit. LINE and Y are the same as the arguments to <format>.

The function must return a character position to break the line.

The function should not modify MT. Do not touch, bestie. πŸ›‘

The mdraw_default_line_break() function is useful for such a script that uses SPACE as a word separator. 🧠

  • int MDrawControl::with_cursor β€” If it's nonzero, show the cursor according to <cursor_width>. Blink blink. πŸ‘€
  • int MDrawControl::cursor_pos β€” Specifies the character position to display a cursor. If it's greater than the maximum character position, the cursor is displayed next to the last character of an M-text. If the value is negative, even if <cursor_width> is nonzero, the cursor is not displayed. No cursor for you. πŸ’…
  • int MDrawControl::cursor_width β€” If it's nonzero, display a cursor at the character position <cursor_pos>. If the value is positive, it's the pixel width of the cursor. If the value is negative, the cursor width is the same as the underlining glyph(s). πŸ“
  • int MDrawControl::cursor_bidi β€” If it's nonzero and <cursor_width> is also nonzero, display double bar cursors: at the character position <cursor_pos> and at the logically previous character. Both cursors have one pixel width with horizontal fringes at upper or lower positions. Double cursor, double iconic. ✌️
  • int MDrawControl::partial_update β€” If it's nonzero, on drawing partial text, pixels of surrounding texts that intrude into the drawing area are also drawn. For instance, some CVC sequence of Thai text (C is consonant, V is upper vowel) is drawn so that V is placed over the middle of two Cs. If this CVC sequence is already drawn and only the last C is drawn again (for instance by updating cursor position), the right half of V is erased if this member is zero. By setting this member to nonzero, even with such a drawing, we can keep this CVC sequence correctly displayed. Thai text stays winning πŸ‡ΉπŸ‡­
  • int MDrawControl::disable_caching β€” If it's nonzero, don't cache the result of any drawing information of an M-text. No cache, just vibes. 🧚
  • MDrawRegion MDrawControl::clip_region β€” If it's non-NULL, limit the drawing effect to the specified region. Clip it, bestie. βœ‚οΈ

πŸ’œ MDrawMetric πŸ’œ

Type of metric for glyphs and texts. Metrics, but make it cute. πŸ“

🌸 FIELD DOCUMENTATION 🌸

  • int MDrawMetric::x β€” X coordinates of a glyph or a text. ➑️
  • int MDrawMetric::y β€” Y coordinates of a glyph or a text. ⬇️
  • unsigned int MDrawMetric::width β€” Pixel width of a glyph or a text. ↔️
  • unsigned int MDrawMetric::height β€” Pixel height of a glyph or a text. ↕️

πŸ¦‹ MDrawGlyphInfo πŸ¦‹

Type of information about a glyph. Glyph gossip ✨

πŸŽ€ FIELD DOCUMENTATION πŸŽ€

  • int MDrawGlyphInfo::from β€” Start position of character range corresponding to the glyph. πŸ”€
  • int MDrawGlyphInfo::to β€” End position of character range corresponding to the glyph. πŸ”š
  • int MDrawGlyphInfo::line_from β€” Start position of character range corresponding to the line of the glyph. πŸ“
  • int MDrawGlyphInfo::line_to β€” End position of character range corresponding to the line of the glyph. πŸ“
  • int MDrawGlyphInfo::x β€” X coordinates of the glyph. ➑️
  • int MDrawGlyphInfo::y β€” Y coordinates of the glyph. ⬇️
  • MDrawMetric MDrawGlyphInfo::metrics β€” Metric of the glyph. πŸ“
  • MFont* MDrawGlyphInfo::font β€” Font used for the glyph. Set to NULL if no font is found for the glyph. πŸ”€
  • int MDrawGlyphInfo::prev_from β€” Character ranges corresponding to logically previous glyphs. Note that we do not need the member prev_to because it must be the same as the member <from>. ⬅️
  • int MDrawGlyphInfo::next_to β€” Character ranges corresponding to logically next glyphs. Note that we do not need the member next_from because it must be the same as the member <to> respectively. ➑️
  • int MDrawGlyphInfo::left_from β€” Start position of character ranges corresponding to visually left glyphs. ⬅️
  • int MDrawGlyphInfo::left_to β€” End position of character ranges corresponding to visually left glyphs. ⬅️
  • int MDrawGlyphInfo::right_from β€” Start position of character ranges corresponding to visually right glyphs. ➑️
  • int MDrawGlyphInfo::right_to β€” End position of character ranges corresponding to visually left glyphs. (Yes, the page says left here. We're keeping the exact words, bestie.) πŸ‘€
  • int MDrawGlyphInfo::logical_width β€” Logical width of the glyph. Nominal distance to the next glyph. πŸ“

πŸ’… MDrawGlyph πŸ’…

Type of information about a glyph metric and font. Glyph glow-up πŸ’–

✨ FIELD DOCUMENTATION ✨

  • int MDrawGlyph::from β€” Character range corresponding to the glyph. πŸ”€
  • int MDrawGlyph::to β€” (No extra details in the original, she's just there being mysterious.) πŸ•΅οΈβ€β™€οΈ
  • int MDrawGlyph::glyph_code β€” Font glyph code of the glyph. πŸ”’
  • int MDrawGlyph::x_advance β€” Logical width of the glyph. Nominal distance to the next glyph. ➑️
  • int MDrawGlyph::y_advance β€” Logical height of the glyph. Nominal distance to the next glyph. ⬇️
  • int MDrawGlyph::x_off β€” X offset relative to the glyph position. ↔️
  • int MDrawGlyph::y_off β€” Y offset relative to the glyph position. ↕️
  • int MDrawGlyph::lbearing β€” Metric of the glyph (left-bearing). ⬅️
  • int MDrawGlyph::rbearing β€” Metric of the glyph (right-bearing). ➑️
  • int MDrawGlyph::ascent β€” Metric of the glyph (ascent). ⬆️
  • int MDrawGlyph::descent β€” Metric of the glyph (descent). ⬇️
  • MFont* MDrawGlyph::font β€” Font used for the glyph. Set to NULL if no font is found for the glyph. πŸ”€
  • MSymbol MDrawGlyph::font_type β€” Type of the font. One of Mx, Mfreetype, Mxft. 🎭
  • void* MDrawGlyph::fontp β€” Pointer to the font structure. The actual type is (XFontStruct *) if the <font_type> member is Mx, FT_Face if the <font_type> member is Mfreetype, and (XftFont *) if the <font_type> member is Mxft. 🧬

🌈 Typedef Documentation 🌈

πŸ’– typedef void* MDrawWindow πŸ’–

Window system dependent type for a window. The type MDrawWindow is for a window; a rectangular area that works in several ways like a miniature screen. πŸͺŸ

What it actually points to depends on a window system. A program that uses the m17n-X library must coerce the type Drawable to this type. Coerce it, bestie. ✨

πŸ’œ typedef void* MDrawRegion πŸ’œ

Window system dependent type for a region. The type MDrawRegion is for a region; an arbitrary set of pixels on the screen (typically a rectangular area). πŸ–ΌοΈ

What it actually points to depends on a window system. A program that uses the m17n-X library must coerce the type Region to this type. Region realness. πŸ’…

πŸ’« Variable Documentation πŸ’«

🌟 int mdraw_line_break_option 🌟

Option of line breaking for drawing text. The variable mdraw_line_break_option specifies line breaking options by logical-or of the members of MTextLineBreakOption. It controls the line breaking algorithm of the function mdraw_default_line_break(). Line break, but make it optional. πŸ”₯

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for The m17n Library from the source code. Doxygen did that. πŸ’…

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


This page is from Version 1.8.4, dated Mon Sep 25 2023, and it's the m17nDraw(3m17n) manual page. Bye bestie! πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from