The following figure shows how to select a Helvetica outline font, set the size of the character box, change the foreground color to red, set the character angle, and move the cursor to a specified location. Then, GpiCharString is used to write a string of characters with the specified size, color, angle, and location.
#define INCL_GPIPRIMITIVES
#define INCL_GPILCIDS
#include <os2.h>
void fncFONT09(void){
POINTL ptl = { 100, 50 };
GRADIENTL grad = { 4, 1 };
SIZEF sizfx;
FATTRS fat;
CHARBUNDLE cbnd;
FONTMETRICS afm[80];
HPS hps;
HDC hdc;
LONG cHelvFonts, i;
LONG cFonts = 0;
LONG lcid = 1;
LONG devRes[2]; /* Horizontal, vertical font resolutions */
cHelvFonts = GpiQueryFonts(hps, QF_PUBLIC, "Helv",
&cFonts, sizeof(FONTMETRICS), NULL);
GpiQueryFonts(hps, QF_PUBLIC, "Helv", &cHelvFonts,
sizeof(FONTMETRICS), afm);
/* Find an outline Helvetica font. */
for (i = 0; (!(afm[i].fsDefn & FM_DEFN_OUTLINE)) &&
i < cHelvFonts; i++) ;
fat.usRecordLength = sizeof(FATTRS);
fat.fsSelection = 0;
fat.lMatch = afm[i].lMatch;
StringCopy(fat.szFacename, afm[i].szFacename);
fat.idRegistry = 0;
fat.usCodePage = 0;
fat.lMaxBaselineExt = 0;
fat.lAveCharWidth = 0;
fat.fsType = 0;
fat.fsFontUse = FATTR_FONTUSE_OUTLINE;
GpiCreateLogFont(hps, (PSTR8) NULL, lcid, &fat);
GpiSetCharSet(hps, lcid);
DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 2L, devRes);
sizfx.cx = MAKEFIXED((afm[i].sNominalPointSize * devRes[0])/ 720, 0);
sizfx.cy = MAKEFIXED((afm[i].sNominalPointSize * devRes[1])/ 720, 0);
GpiSetCharBox(hps, &sizfx);
cbnd.lColor = CLR_RED;
GpiSetAttrs(hps, PRIM_CHAR, CBB_COLOR, NULLHANDLE, &cbnd);
GpiSetCharAngle(hps, &grad);
GpiMove(hps, &ptl);
GpiCharString(hps, 11, "Vector Text");
} /* fncFONT09 */
Certain parameters in the above example are explained in Fonts.