m17nDraw(3m17n)
π 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) isCf(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 means8. 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 toNULLif 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 memberprev_tobecause 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 membernext_frombecause 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 toNULLif no font is found for the glyph. π€MSymbol MDrawGlyph::font_typeβ Type of the font. One ofMx,Mfreetype,Mxft. πvoid* MDrawGlyph::fontpβ Pointer to the font structure. The actual type is(XFontStruct *)if the<font_type>member isMx,FT_Faceif the<font_type>member isMfreetype, and(XftFont *)if the<font_type>member isMxft. π§¬
π 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 π
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
- debian trixie: m17n-docs 1.8.4-1
- ubuntu noble: m17n-docs 1.8.4-1
- ubuntu questing: m17n-docs 1.8.4-1
- ubuntu resolute: m17n-docs 1.8.4-1build1
- ubuntu stonking: m17n-docs 1.8.4-1build1
- Copyright (C) 2001 Information-technology Promotion Agency (IPA)
- Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms