#include <proto/ttengine.h> |
struct Library *TTEngineBase; |
TTEngineBase = OpenLibrary("ttengine.library", 5); if (!TTEngineBase) Printf("Can't open TTEngine!\n"); |
STRPTR my_table[] = {"Tahoma", "Arial", "sans-serif", "default", NULL}; |
font = TT_OpenFont(TAG_END); |
table = {"Georgia", "Times", "serif", "default", NULL}; font = TT_OpenFont( TT_FamilyTable, (ULONG)table, TT_FontStyle, TT_FontStyle_Italic, TT_FontWeight, TT_FontWeight_Bold, TT_FontSize, 48, TAG_END); |
font = TT_OpenFont( TT_FontFile, (ULONG)"PROGDIR:fonts/SpecialSymbols.ttf", TT_FontSize, 37, TAG_END); |
TT_SetFont(window->RPort, font); |
TT_SetAttrs(window->RPort, TT_Window, (ULONG)window, TAG_END); |
Move(window->RPort, 20, 50); TT_Text(window->RPort, "Hello world!", 12); |
TT_DoneRastPort(window->RPort); CloseWindow(window); |
TT_CloseFont(font); |
CloseLibrary(TTEngineBase); |
SetDrMd(window->RPort, JAM1); SetAPen(window->RPort, 1); TT_Text(window->RPort, "[maybe] black text", 18); |
![]() |
/* obtain pen as shared */ LONG red_pen; red_pen = ObtainBestPen(window->WScreen->ViewPort.ColorMap, 0xFFFFFFFF, 0x00000000, 0x00000000, TAG_END); SetAPen(window->RPort, red_pen); TT_Text(window->RPort, "more or less red text", 21); /* ... */ TT_DoneRastPort(window->RastPort); ReleasePen(window->WScreen->ViewPort.ColorMap, red_pen); CloseWindow(window); |
![]() |
/* obtain pen as exclusive */ LONG red_pen; red_pen = ObtainPen(window->WScreen->ViewPort.ColorMap, -1, 0xFFFFFFFF, 0x00000000, 0x00000000, PEN_EXCLUSIVE); if (red_pen != -1) { SetAPen(window->RPort, red_pen); TT_Text(window->RPort, "exactly red text", 16); } else PutStr("No free pens.\n"); /* ... */ TT_DoneRastPort(window->RastPort); ReleasePen(window->WScreen->ViewPort.ColorMap, red_pen); CloseWindow(window); |
![]() |
TT_SetAttrs(window->RastPort, TT_Foreground, 0x0060FF80, TT_Background, 0x00000000, TAG_END); SetDrMd(window->RastPort, JAM2); TT_Text(window->RastPort, "neon green on black back", 24); |
![]() |
TT_SetAttrs(window->RastPort, TT_Foreground, TT_Foreground_UseRastPort, TT_Background, TT_Background_UseRastPort, TAG_END); |
![]() |
This is an example of JAM1 draw mode. Yellow glyphs are smoothly laid on the checkerboard. | ![]() |
This is JAM2. Glyphs are rendered over a rectangle of RastPort background colour. |
![]() |
JAM1 combined with INVERSVID. Foreground and transparent background are reversed. | ![]() |
JAM2 combined with INVERSVID. Background and foreground are reversed. |
JAM1 | JAM2 | Transparency |
![]() |
![]() |
20% (51, 0x33) |
![]() |
![]() |
50% (128, 0x80) |
![]() |
![]() |
80% (205, 0xCD) |
SetDrMd(window->RastPort, JAM2 | INVERSVID); TT_SetAttrs(window->RastPort, TT_Transparency, 0x40, TAG_END); |
LONG length; length = TT_TextLength(window->RastPort, "Tell me how long is it.", 25); |
struct Screen *wb; LONG textlen; wb = LockPubScreen(NULL); TT_SetFont(&wb->RastPort, font); textlen = TT_TextLength(&wb->RastPort, "Some text", 9); TT_DoneRastPort(&wb->RastPort); UnlockPubScreen(NULL, wb); |
![]() Times New Roman 8 pixels not smoothed |
![]() Times New Roman 13 pixels not smoothed |
![]() Times New Roman 18 pixels not smoothed |
![]() Times New Roman 8 pixels smoothed |
![]() Times New Roman 13 pixels smoothed |
![]() Times New Roman 18 pixels smoothed |