Tscope5
|
Definitions of text input/output functions. More...
Go to the source code of this file.
Functions | |
Text input/output functions | |
The text input-output functions all take the smallest possible number of parameters to put something on the screen: two coordinates and a format string. The vertical coordinates are interpreted differently by the two coordinate systems.
The format string is the same as the standard C printf and scanf function families. Both standard C strings and Unicode strings can be used. Drawing parameters are set with the graphics parameter functions. | |
double | ts5_printf (double x, double y, const char *format,...) |
Write text to the active bitmap. More... | |
void | ts5_printf_justify (double x1, double x2, double y, double diff, const char *format,...) |
Write justified text to the active bitmap. More... | |
double | ts5_printf_ustr (double x, double y, const TS5_USTR *ustr) |
Write UTF-8 encoded text to the active bitmap. More... | |
void | ts5_printf_justify_ustr (double x1, double x2, double y, double diff, const TS5_USTR *ustr) |
Write justified UTF-8 encoded text to the active bitmap. More... | |
int | ts5_scanf (double x, double y, const char *format,...) |
Read text from the keyboard. More... | |
double | ts5_get_text_width (const char *format,...) |
Get the width of a string without printing it. More... | |
double | ts5_get_text_width_ustr (TS5_USTR *ustr) |
Get the width of a UTF-8 string without printing it. More... | |
Loading custom fonts | |
In Tscope5 three fonts are available as standard (courier, arial and times). If these do not suit your needs any TrueType font that is installed on your computer can be loaded manually. | |
TS5_FONT * | ts5_read_font (const char *fontfile, double size) |
Load a user defined font. More... | |
TS5_FONT * | ts5_set_font (TS5_FONT *font) |
Set a user defined font. More... | |
void | ts5_free_font (TS5_FONT *font) |
Free the memory used by a user defined font. More... | |
Definitions of text input/output functions.
Definition in file textio.c.
double ts5_printf | ( | double | x, |
double | y, | ||
const char * | format, | ||
... | |||
) |
Write text to the active bitmap.
x | Horizontal position of the text. |
y | Vertical position of the text. |
format | Printf style format string. |
void ts5_printf_justify | ( | double | x1, |
double | x2, | ||
double | y, | ||
double | diff, | ||
const char * | format, | ||
... | |||
) |
Write justified text to the active bitmap.
x1 | Horizontal start position of the text. |
x2 | Horizontal end position of the text. |
y | Vertical position of the text. |
diff | Maximum amount of space. If the amount of space in a line of text is greater than the diff value, left justified text will be written. |
format | Printf style format string. |
double ts5_printf_ustr | ( | double | x, |
double | y, | ||
const TS5_USTR * | ustr | ||
) |
void ts5_printf_justify_ustr | ( | double | x1, |
double | x2, | ||
double | y, | ||
double | diff, | ||
const TS5_USTR * | ustr | ||
) |
Write justified UTF-8 encoded text to the active bitmap.
x1 | Horizontal start position of the text. |
x2 | Horizontal end position of the text. |
y | Vertical position of the text. |
diff | Maximum amount of space. If the amount of space in a line of text is greater than the diff value, left justified text will be written. |
ustr | Unicode string. |
int ts5_scanf | ( | double | x, |
double | y, | ||
const char * | format, | ||
... | |||
) |
Read text from the keyboard.
x | Horizontal position where the input will be echoed. |
y | Vertical position where the input will be echoed. |
format | Printf style format string. |
double ts5_get_text_width | ( | const char * | format, |
... | |||
) |
Get the width of a string without printing it.
format | Printf style format string. |
double ts5_get_text_width_ustr | ( | TS5_USTR * | ustr | ) |
TS5_FONT* ts5_read_font | ( | const char * | fontfile, |
double | size | ||
) |
Load a user defined font.
fontfile | Path to the file that describes the 1 type font. |
size | Size the font will be rendered in. |
True type fonts can be found in /Library/fonts on Mac OS X.
TS5_FONT* ts5_set_font | ( | TS5_FONT * | font | ) |
Set a user defined font.
font | The new font. |
void ts5_free_font | ( | TS5_FONT * | font | ) |
Free the memory used by a user defined font.
font | pointer to the font that will be freed. |
This function should be called at the end of the program for each font read by the user.