.\" Copyright (C) 2001 Information-technology Promotion Agency (IPA) .\" Copyright (C) 2001-2011 .\" National Institute of Advanced Industrial Science and Technology (AIST) .\" This file is part of the m17n library documentation. .\" Permission is granted to copy, distribute and/or modify this document .\" under the terms of the GNU Free Documentation License, Version 1.2 or .\" any later version published by the Free Software Foundation; with no .\" Invariant Section, no Front-Cover Texts, .\" and no Back-Cover Texts. A copy of the license is included in the .\" appendix entitled "GNU Free Documentation License". .TH "mdraw_text" 3m17n "Mon Sep 25 2023" "Version 1.8.4" "The m17n Library" \" -*- nroff -*- .ad l .nh .SH NAME mdraw_text \- .SH SYNOPSIS int \fBmdraw_text\fP (\fBMFrame\fP * \fIframe\fP, \fBMDrawWindow\fP \fIwin\fP, int \fIx\fP, int \fIy\fP, \fBMText\fP * \fImt\fP, int \fIfrom\fP, int \fIto\fP) .SH DESCRIPTION .PP Draw an M\-text on a window\&. The .ft B mdraw_text() .ft R function draws the text between .ft B from .ft R and .ft B to .ft R of M\-text .ft B mt .ft R on window .ft B win .ft R of frame .ft B frame .ft R at coordinate (\fBx\fP, .ft R .ft B y\fP)\&. .PP The appearance of the text (size, style, color, etc) is specified by the value of the text property whose key is .ft C Mface\fP\&. If the M\-text or a part of the M\-text does not have such a text property, the default face of .ft B frame .ft R is used\&. .PP The font used to draw a character in the M\-text is selected from the value of the fontset property of a face by the following algorithm: .PP .PD 0 .IP "1." 4 Search the text properties given to the character for the one whose key is .ft C Mcharset\fP; .ft R its value should be either a symbol specifying a charset or .ft B Mnil\fP\&. If the value is .ft B Mnil\fP, .ft R proceed to the next step\&. .PP Otherwise, search the mapping table of the fontset for the charset\&. If no entry is found proceed to the next step\&. .br .PP .nf If an entry is found, use one of the fonts in the entry that .fi .fi has a glyph for the character and that matches best with the face properties\&. If no such font exists, proceed to the next step\&. .PP .IP "2." 4 Get the character property 'script' of the character\&. If it is 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\&. .PP Search the text properties given to the character for the one whose key is .ft C Mlanguage\fP; .ft R its value should be either a symbol specifying a language or .ft C Mnil\fP\&. .PP 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\&. .br .PP .nf If an entry is found, use one of the fonts in the entry that .fi .fi has a glyph for the character and that matches best with the face properties\&. If no such font exists, proceed to the next step\&. .PP .IP "3." 4 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\&. .PP .PP .PP If no font is found by the algorithm above, this function draws an empty box for the character\&. .PP This function draws only the glyph foreground\&. To specify the background color, use .ft B mdraw_image_text() .ft R or .ft B mdraw_text_with_control()\fP\&. .PP This function is the counterpart of .ft C XDrawString()\fP, .ft R .ft C XmbDrawString()\fP, .ft R and .ft C XwcDrawString() .ft R functions in the X Window System\&. .PP .SH RETURN VALUE .PP .RS 4 If the operation was successful, .ft B mdraw_text() .ft R returns 0\&. If an error is detected, it returns \-1 and assigns an error code to the external variable .ft B merror_code\fP\&. .br .RE .PP .SH ERRORS .PP .RS 4 \fCMERROR_RANGE .ft R .RE .PP .SH "SEE ALSO" .PP .RS 4 \fBmdraw_image_text() .ft R .br .RE .PP .SH COPYRIGHT Copyright (C) 2001 Information\-technology Promotion Agency (IPA) .br Copyright (C) 2001\-2011 National Institute of Advanced Industrial Science and Technology (AIST) .br Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License .