22 #ifndef BAGEL_BOFLIB_GFX_TEXT_H 23 #define BAGEL_BOFLIB_GFX_TEXT_H 25 #include "graphics/font.h" 26 #include "bagel/boflib/object.h" 27 #include "bagel/spacebar/boflib/gfx/bitmap.h" 28 #include "bagel/boflib/error.h" 29 #include "bagel/boflib/string.h" 34 #define NUM_POINT_SIZES 32 37 #define CTEXT_COLOR RGB(0,0,0) 38 #define CTEXT_SHADOW_COLOR RGB(0,0,0) 39 #define CTEXT_YELLOW RGB(255, 255, 0) 40 #define CTEXT_WHITE RGB(255, 255, 255) 42 #define CTEXT_SHADOW_DX 2 43 #define CTEXT_SHADOW_DY 2 59 #define DT_TOP 0x00000000 60 #define DT_LEFT 0x00000000 61 #define DT_CENTER 0x00000001 62 #define DT_RIGHT 0x00000002 63 #define DT_VCENTER 0x00000004 64 #define DT_BOTTOM 0x00000008 65 #define DT_WORDBREAK 0x00000010 66 #define DT_SINGLELINE 0x00000020 67 #define DT_EXPANDTABS 0x00000040 68 #define DT_TABSTOP 0x00000080 69 #define DT_NOCLIP 0x00000100 70 #define DT_EXTERNALLEADING 0x00000200 71 #define DT_CALCRECT 0x00000400 72 #define DT_NOPREFIX 0x00000800 73 #define DT_intERNAL 0x00001000 82 #define FONT_DEFAULT 0 85 #define TEXT_DONTCARE 0 86 #define TEXT_THIN FW_THIN 87 #define TEXT_EXTRALIGHT FW_EXTRALIGHT 88 #define TEXT_ULTRALIGHT FW_ULTRALIGHT 89 #define TEXT_LIGHT FW_LIGHT 90 #define TEXT_NORMAL FW_NORMAL 91 #define TEXT_REGULAR FW_REGULAR 92 #define TEXT_MEDIUM FW_MEDIUM 93 #define TEXT_SEMIBOLD FW_SEMIBOLD 94 #define TEXT_DEMIBOLD FW_DEMIBOLD 95 #define TEXT_BOLD FW_BOLD 96 #define TEXT_EXTRABOLD FW_EXTRABOLD 97 #define TEXT_ULTRABOLD FW_ULTRABOLD 98 #define TEXT_BLACK FW_BLACK 99 #define TEXT_HEAVY FW_HEAVY 101 #define FORMAT_TOP_LEFT ( DT_TOP | DT_LEFT ) 102 #define FORMAT_TOP_RIGHT ( DT_TOP | DT_RIGHT ) 103 #define FORMAT_TOP_CENTER ( DT_TOP | DT_CENTER ) 104 #define FORMAT_BOT_LEFT ( DT_BOTTOM | DT_LEFT ) 105 #define FORMAT_BOT_RIGHT ( DT_BOTTOM | DT_RIGHT ) 106 #define FORMAT_BOT_CENTER ( DT_BOTTOM | DT_CENTER ) 107 #define FORMAT_CENTER_LEFT ( DT_VCENTER | DT_LEFT ) 108 #define FORMAT_CENTER_RIGHT ( DT_VCENTER | DT_RIGHT ) 109 #define FORMAT_CENTER_CENTER ( DT_VCENTER | DT_CENTER ) 110 #define FORMAT_SINGLE_LINE DT_SINGLELINE 111 #define FORMAT_MULTI_LINE DT_WORDBREAK 112 #define FORMAT_DEFAULT ( FORMAT_TOP_LEFT | FORMAT_MULTI_LINE ) 114 #define FONT_DEFAULT_SIZE (-14) 115 #define FONT_8POINT 8 116 #define FONT_10POINT 10 117 #define FONT_12POINT 12 118 #define FONT_14POINT 14 119 #define FONT_15POINT 15 120 #define FONT_18POINT 18 121 #define FONT_20POINT 20 122 #define TEXT_DEFAULT_FACE TEXT_BOLD 129 CBofText(
const CBofRect *pRect,
int nJustify = JUSTIFY_CENTER, uint32 nFormatFlags = FORMAT_DEFAULT);
143 ErrorCode
setupText(
const CBofRect *pRect,
int nJustify = JUSTIFY_CENTER, uint32 nFormatFlags = FORMAT_DEFAULT);
144 ErrorCode setupTextOpt(
const CBofRect *pRect,
int nJustify = JUSTIFY_CENTER, uint32 nFormatFlags = FORMAT_DEFAULT);
147 _cCurString = cString;
149 void setColor(
const COLORREF cColor) {
150 _cTextColor = cColor;
152 void SetSize(
const int nSize) {
155 void setWeight(
const int nWeight) {
156 _nCurWeight = nWeight;
159 void setShadowColor(
const COLORREF cColor) {
160 _cShadowColor = cColor;
162 void setShadowSize(
int nDX,
int nDY) {
170 COLORREF getColor()
const {
173 int getSize()
const {
176 int getWeight()
const {
218 ErrorCode
display(
CBofWindow *pWnd,
const char *pszText,
int nSize,
int nWeight, COLORREF cColor = CTEXT_COLOR,
int nFont = FONT_DEFAULT);
230 ErrorCode
display(
CBofBitmap *pBmp,
const char *pszText,
int nSize,
int nWeight, COLORREF cColor = CTEXT_COLOR,
int nFont = FONT_DEFAULT);
246 int nWeight, COLORREF cColor, COLORREF cShadow = CTEXT_SHADOW_COLOR,
247 int nDX = CTEXT_SHADOW_DX,
int nDY = CTEXT_SHADOW_DY,
int nFont = FONT_DEFAULT);
250 void flushBackground() {
254 static ErrorCode initialize();
255 static ErrorCode shutdown();
270 static Graphics::Font *getFont(
int nFont,
int nSize,
int nWeight);
276 void initializeFields();
289 ErrorCode displayText(
CBofWindow *pWnd,
const char *pszText,
CBofRect *pRect,
int nSize,
int nWeight,
bool bShadowed,
int nFont = FONT_DEFAULT);
290 ErrorCode displayText(
CBofBitmap *pBmp,
const char *pszText,
CBofRect *pRect,
int nSize,
int nWeight,
bool bShadowed,
int nFont = FONT_DEFAULT);
300 COLORREF _cTextColor;
301 COLORREF _cShadowColor;
311 uint32 _nFormatFlags;
318 static bool _initialized;
325 ErrorCode paintText(
CBofWindow *pWnd,
CBofRect *pRect,
const char *,
int nSize,
int nWeight, COLORREF cColor = CTEXT_COLOR,
int nJustify = JUSTIFY_CENTER, uint32 nFormat = FORMAT_DEFAULT,
int nFont = FONT_DEFAULT);
326 ErrorCode paintText(
CBofBitmap *pBmp,
CBofRect *pRect,
const char *,
int nSize,
int nWeight, COLORREF cColor = CTEXT_COLOR,
int nJustify = JUSTIFY_CENTER, uint32 nFormat = FORMAT_DEFAULT,
int nFont = FONT_DEFAULT);
328 ErrorCode paintShadowedText(
CBofBitmap *,
CBofRect *pRect,
const char *,
int nSize,
int nWeight, COLORREF cColor = CTEXT_COLOR,
int nJustify = JUSTIFY_CENTER, uint32 n = FORMAT_DEFAULT,
int nFont = FONT_DEFAULT);
Definition: managed_surface.h:51
TextAlign
Definition: font.h:48
ErrorCode setupText(const CBofRect *pRect, int nJustify=JUSTIFY_CENTER, uint32 nFormatFlags=((0x00000000|0x00000000)|0x00000010))
ErrorCode display(CBofWindow *pWnd)
ErrorCode erase(CBofWindow *pWnd)
ErrorCode displayShadowed(CBofWindow *pWnd, const char *pszText, int nSize, int nWeight, COLORREF cColor, COLORREF cShadow=RGB(0, 0, 0), int nDX=2, int nDY=2, int nFont=0)
ErrorCode displayTextEx(CBofBitmap *pBmp, const char *pszText, CBofRect *pRect, int nSize, int nWeight, bool bShadowed, int nFont=0)