- AppGraphics Documentation
- Getting Started with AppGraphics
- Window Management
- Colors and Patterns
- Mouse Interactions
- Keyboard Interaction
- Graphics Shapes and Primitives
- Text Output
- Graphic Viewports
- Images
- Windows Controls
- Common Dialogs
- Clipboard Operations
- Threads, Thread Safety, and Idling
- AppGraphics License Agreement
Text Output
The following procedures are used for writing text into a window and configuring the style to use while drawing said text.
gettextsettings
C void gettextsettings (texttypeinfo)
Fortran subroutine gettextsettings (texttypeinfo)
Description
Retrieves the settings for writing text to the current window
Parameters
Parameter | C Type | Fortran Type | Description |
texttypeinfo | textsettingstype * | type(textsettingstype) | A pointer to a variable to receive the current settings or the variable to be populated with the current settings |
The textsettingstype struct / derived type has the following members:
Member | C Type | Fortran Type | Description |
font | int | integer(kind=c_int) | The selected font |
direction | int | integer(kind=c_int) | The current text direction (HORIZ_DIR or VERT_DIR) |
charsize | int | integer(kind=c_int) | The font size |
horiz | int | integer(kind=c_int) | The horizontal text justification (see settextjustify) |
vert | int | integer(kind=c_int) | The vertical text justification (see settextjustify) |
outtext
C void outtext (text)
Fortran subroutine outtext (text, perform_trim)
Description
Writes the specified string to the current window at the current text position. This routine will respect new line characters within the string. After this call, the text position will be the text line below the just-drawn text, effectively adding a line feed after output.
Parameters
Parameter | C Type | Fortran Type | Description |
text | char * | character(*) | The text to output |
perform_trim1 | N/A | logical | True to trim the string (the default behavior), false to use the entire string |
outtextxy
C void outtextxy (x, y, text)
Fortran subroutine outtextxy (x, y, text, perform_trim)
Description
Writes the specified string to the current window at the specified graphics coordinates. This routine will respect new line characters within the string. After this call, the text position will be the text line below the just-drawn text, effectively adding a line feed after output. This routine is identical to calling settextxy followed by outtext with the appropriate parameters.
Parameters
Parameter | C Type | Fortran Type | Description |
x | int | integer | The horizontal coordinate to start drawing text, representing the left-most text position |
y | int | integer | The vertical coordinate to start drawing text, representing the top-most text position |
text | char * | character(*) | The text to output |
perform_trim1 | N/A | logical | True to trim the string (the default behavior), false to use the entire string |
setmatchthemetextstyle
C void setmatchthemetextstyle ( )
Fortran subroutine setmatchthemetextstyle ( )
Description
Sets the font face and character height to match the default Windows theme settings.
settextxy
C void settextxy (x, y)
Fortran subroutine settextxy (x, y)
Description
Sets the graphical position of the top-left corner where text will be output on the next call to outtext.
Parameters
Parameter | C Type | Fortran Type | Description |
x | int | integer | The horizontal coordinate to start drawing text, representing the left-most text position |
y | int | integer | The vertical coordinate to start drawing text, representing the top-most text position |
settextjustify
C void settextjustify (horiz, vert)
Fortran subroutine settextjustify (horiz, vert)
Description
Sets the justification of text both horizontally and vertically. The allowed values are:
ID | Description |
LEFT_TEXT | Left-justify text |
CENTER_TEXT | Center text (horizontally or vertically) |
RIGHT_TEXT | Right-justify text |
BOTTOM_TEXT | Bottom-justify text |
TOP_TEXT | Top-justify text |
Parameters
Parameter | C Type | Fortran Type | Description |
horiz | int | integer | The horizontal text justification (LEFT_TEXT, CENTER_TEXT, RIGHT_TEXT) |
vert | int | integer | The horizontal text justification (BOTTOM_TEXT, CENTER_TEXT, TOP_TEXT) |
settextstyle
C void settextstyle (font, direction, charsize)
Fortran subroutine settextstyle (font, direction, charsize)
Description
Sets the style of text to be used. The value of font must be one of the following:
ID | Description |
DEFAULT_FONT | The default Windows GUI font |
SANS_SERIF_FONT | An Arial- or Helvetica-style font |
SERIF_FONT | A font similar to Times New Roman |
CURSIVE_FONT | A font appearing to be hand-written |
BOLD_SANS_SERIF_FONT | Same as SANS_SERIF_FONT, but in bold |
BOLD_SERIF_FONT | Same as SERIF_FONT, but in bold |
MONOSPACE_FONT | A monospace font |
WINDOWS_FONT | The font used for any static control text |
The value of direction may be:
ID | Description |
HORIZ_DIR | Text is horizontally output |
VERT_DIR | Text is vertically output |
Parameters
Parameter | C Type | Fortran Type | Description |
font | int | integer | The font family to use |
direction | int | integer | The direction the text is generated |
charsize | int | integer | The size of characters in pixels |
textheight
C int textheight (textstring)
Fortran function textheight (textstring, perform_trim)
Description
Calculates and returns the height in pixels of a given string based on the current text style settings.
Parameters
Parameter | C Type | Fortran Type | Description |
textstring | char * | character(*) | The text string for which to calculate the height |
perform_trim1 | N/A | logical | True to trim the string (the default behavior), false to use the entire string |
Return Value
C int
Fortran integer
The height of the text
textwidth
C int textwidth (textstring)
Fortran function textwidth (textstring, perform_trim)
Description
Calculates and returns the width in pixels of a given string based on the current text style settings.
Parameters
Parameter | C Type | Fortran Type | Description |
textstring | char * | character(*) | The text string for which to calculate the width |
perform_trim1 | N/A | logical | True to trim the string (the default behavior), false to use the entire string |
Return Value
C int
Fortran integer
The width of the text
useansitext
C void useansitext ()
Fortran subroutine useansitext ()
Description
By default, the outtext and outtextxy procedures will treat any text as UTF-8 encoded strings. Calling this routine will permanently switch the application to a mode using legacy ANSI text encoding, limiting strings to system default ANSI codepage as defined by Windows.
If your application expects ANSI text, this routine should be called before creating any windows.
1 Optional named argument