The m17n Library: MDrawControl Struct Reference

# MDrawControl Struct Reference
[Drawing]

Type of a text drawing control. More...

## Data Fields
unsigned | as_image: 1
unsigned | align_head: 1
unsigned | two_dimensional: 1
unsigned | orientation_reversed: 1
unsigned | enable_bidi: 1
unsigned | ignore_formatting_char: 1
unsigned | fixed_width: 1
unsigned | anti_alias: 1
unsigned | disable_overlapping_adjustment: 1
unsigned int | min_line_ascent
unsigned int | min_line_descent
unsigned int | max_line_ascent
unsigned int | max_line_descent
unsigned int | max_line_width
unsigned int | tab_width
void(* | format )(int line, int y, int *indent, int *width)
int(* | line_break )(MText *mt, int pos, int from, int to, int line, int y)
int | with_cursor
int | cursor_pos
int | cursor_width
int | cursor_bidi
int | partial_update
int | disable_caching
MDrawRegion | clip_region

## Detailed Description

Type of a text drawing control.

The type MDrawControl is the structure that controls how to draw an M-text.

## Field Documentation

unsigned MDrawControl::as_image

If nonzero, draw an M-text as image, i.e. with background filled with background colors of faces put on the M-text. Otherwise, the background is not changed.

unsigned MDrawControl::align_head

If nonzero and the first glyph of each line has negative lbearing, shift glyphs horizontally to right so that no pixel is drawn to the left of the specified position.

unsigned MDrawControl::two_dimensional

If nonzero, draw an M-text two-dimensionally, i.e., newlines in M-text breaks lines and the following characters are drawn in the next line. If <format> is non-NULL, and the function returns nonzero line width, a line longer than that width is also broken.

unsigned MDrawControl::orientation_reversed

If nonzero, draw an M-text to the right of a specified position.

unsigned MDrawControl::enable_bidi

If nonzero, reorder glyphs correctly for bidi text.

unsigned MDrawControl::ignore_formatting_char

If nonzero, don't draw characters whose general category (in Unicode) is Cf (Other, format).

unsigned MDrawControl::fixed_width

If nonzero, draw glyphs suitable for a terminal. Not yet implemented.

unsigned MDrawControl::anti_alias

If nonzero, draw glyphs with anti-aliasing if a backend font driver supports it.

unsigned MDrawControl::disable_overlapping_adjustment

If nonzero, disable the adjustment of glyph positions to avoid horizontal overlapping at font boundary.

unsigned int MDrawControl::min_line_ascent

If nonzero, the values are minimum line ascent pixels.

unsigned int MDrawControl::min_line_descent

If nonzero, the values are minimum line descent pixels.

unsigned int MDrawControl::max_line_ascent

If nonzero, the values are maximum line ascent pixels.

unsigned int MDrawControl::max_line_descent

If nonzero, the values are maximum line descent pixels.

unsigned int MDrawControl::max_line_width

If nonzero, the value specifies how many pixels each line can occupy on the display. The value zero means that there is no limit. It is ignored if <format> is non-NULL.

unsigned int MDrawControl::tab_width

If nonzero, the value specifies the distance between tab stops in columns (the width of one column is the width of a space in the default font of the frame). The value zero means 8.

void(* MDrawControl::format)(int line, int y, int *indent, int *width)

If 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 store the indentation and width limit at the place pointed 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 that there is no limit.

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

This has an effect only when <two_dimensional> is nonzero.

int(* MDrawControl::line_break)(MText *mt, int pos, int from, int to, int line, int y)

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

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

int MDrawControl::with_cursor

If nonzero, show the cursor according to <cursor_width>.

int MDrawControl::cursor_pos

Specifies the character position to display a cursor. If it is 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, cursor is not displayed.

int MDrawControl::cursor_width

If nonzero, display a cursor at the character position <cursor_pos>. If the value is positive, it is 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 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.

int MDrawControl::partial_update

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

int MDrawControl::disable_caching

If nonzero, don't cache the result of any drawing information of an M-text.

MDrawRegion MDrawControl::clip_region

If non-NULL, limit the drawing effect to the specified region.