Tscope5
textio03.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// textio03.c
// - Get the dimension of a piece of text that is printed on the display.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
void print_some_text()
{
double w, h;
w = ts5_printf(0.0, 40.0, "this piece of text ");
ts5_printf(0.0, 0.0, "is %5.2f pixels long", w);
ts5_printf(0.0, -40.0, "and %5.2f pixels high", h);
ts5_printf(0.0, -80, "the letter \"M\" is %5.2f pixels long", w);
ts5_draw_mouse_button(ax(0.9), ay(-0.8));
}
int main()
{
ts5_printf(0.0, 120.0, "standard font");
print_some_text();
ts5_set_font_type(TS5_ARIAL);
ts5_set_font_style(TS5_BOLD);
ts5_printf(0.0, 120.0, "Arial 35 Bold font");
print_some_text();
return 0;
}