#include #include #include #include "paintlabel.h" /* * FontByName is a simple aux function that builds a new font from a four-part * spec of family, weight, slant, and pointsize. It encapsulates the * disgusting X convention for generating font names. */ Font* FontByName(char* fam, char* wgt, char* sl, char* pnt) { char fontname[200]; sprintf(fontname, "*-*-%s-%s-%s-normal-*-*-%s0-*-*-*-*-iso8859-1", fam, wgt, sl, pnt, "\0"); return new Font(fontname); } /* * Implementation of the PaintLabel constructor. Allocate a new Painter for * Label, set the label's font, and call Reconfig to burn in the font change. * This was addapted from InterViews tutorial t4. */ PaintLabel::PaintLabel(char* msg, char* fam, char* wgt, char *sl, char *pnt) : Message(msg) { output = new Painter(); output->SetFont(FontByName(fam, wgt, sl, pnt)); Reconfig(); }