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/boflib/gfx/bitmap.h" 28 #include "bagel/boflib/error.h" 29 #include "bagel/boflib/string.h" 33 #define NUM_POINT_SIZES 32 36 #define CTEXT_COLOR RGB(0,0,0) 37 #define CTEXT_SHADOW_COLOR RGB(0,0,0) 38 #define CTEXT_YELLOW RGB(255, 255, 0) 39 #define CTEXT_WHITE RGB(255, 255, 255) 41 #define CTEXT_SHADOW_DX 2 42 #define CTEXT_SHADOW_DY 2 45 #define JUSTIFY_CENTER 0 46 #define JUSTIFY_LEFT 1 47 #define JUSTIFY_RIGHT 2 48 #define JUSTIFY_WRAP 3 56 #define DT_TOP 0x00000000 57 #define DT_LEFT 0x00000000 58 #define DT_CENTER 0x00000001 59 #define DT_RIGHT 0x00000002 60 #define DT_VCENTER 0x00000004 61 #define DT_BOTTOM 0x00000008 62 #define DT_WORDBREAK 0x00000010 63 #define DT_SINGLELINE 0x00000020 64 #define DT_EXPANDTABS 0x00000040 65 #define DT_TABSTOP 0x00000080 66 #define DT_NOCLIP 0x00000100 67 #define DT_EXTERNALLEADING 0x00000200 68 #define DT_CALCRECT 0x00000400 69 #define DT_NOPREFIX 0x00000800 70 #define DT_intERNAL 0x00001000 79 #define FONT_DEFAULT 0 82 #define TEXT_DONTCARE 0 83 #define TEXT_THIN FW_THIN 84 #define TEXT_EXTRALIGHT FW_EXTRALIGHT 85 #define TEXT_ULTRALIGHT FW_ULTRALIGHT 86 #define TEXT_LIGHT FW_LIGHT 87 #define TEXT_NORMAL FW_NORMAL 88 #define TEXT_REGULAR FW_REGULAR 89 #define TEXT_MEDIUM FW_MEDIUM 90 #define TEXT_SEMIBOLD FW_SEMIBOLD 91 #define TEXT_DEMIBOLD FW_DEMIBOLD 92 #define TEXT_BOLD FW_BOLD 93 #define TEXT_EXTRABOLD FW_EXTRABOLD 94 #define TEXT_ULTRABOLD FW_ULTRABOLD 95 #define TEXT_BLACK FW_BLACK 96 #define TEXT_HEAVY FW_HEAVY 98 #define FORMAT_TOP_LEFT ( DT_TOP | DT_LEFT ) 99 #define FORMAT_TOP_RIGHT ( DT_TOP | DT_RIGHT ) 100 #define FORMAT_TOP_CENTER ( DT_TOP | DT_CENTER ) 101 #define FORMAT_BOT_LEFT ( DT_BOTTOM | DT_LEFT ) 102 #define FORMAT_BOT_RIGHT ( DT_BOTTOM | DT_RIGHT ) 103 #define FORMAT_BOT_CENTER ( DT_BOTTOM | DT_CENTER ) 104 #define FORMAT_CENTER_LEFT ( DT_VCENTER | DT_LEFT ) 105 #define FORMAT_CENTER_RIGHT ( DT_VCENTER | DT_RIGHT ) 106 #define FORMAT_CENTER_CENTER ( DT_VCENTER | DT_CENTER ) 107 #define FORMAT_SINGLE_LINE DT_SINGLELINE 108 #define FORMAT_MULTI_LINE DT_WORDBREAK 109 #define FORMAT_DEFAULT ( FORMAT_TOP_LEFT | FORMAT_MULTI_LINE ) 111 #define FONT_DEFAULT_SIZE (-14) 112 #define FONT_8POINT 8 113 #define FONT_10POINT 10 114 #define FONT_12POINT 12 115 #define FONT_14POINT 14 116 #define FONT_15POINT 15 117 #define FONT_18POINT 18 118 #define FONT_20POINT 20 119 #define TEXT_DEFAULT_FACE TEXT_BOLD 126 CBofText(
const CBofRect *pRect,
int nJustify = JUSTIFY_CENTER, uint32 nFormatFlags = FORMAT_DEFAULT);
140 ErrorCode
setupText(
const CBofRect *pRect,
int nJustify = JUSTIFY_CENTER, uint32 nFormatFlags = FORMAT_DEFAULT);
141 ErrorCode setupTextOpt(
const CBofRect *pRect,
int nJustify = JUSTIFY_CENTER, uint32 nFormatFlags = FORMAT_DEFAULT);
144 _cCurString = cString;
146 void setColor(
const RGBCOLOR cColor) {
147 _cTextColor = cColor;
149 void SetSize(
const int nSize) {
152 void setWeight(
const int nWeight) {
153 _nCurWeight = nWeight;
156 void setShadowColor(
const RGBCOLOR cColor) {
157 _cShadowColor = cColor;
159 void setShadowSize(
int nDX,
int nDY) {
167 RGBCOLOR getColor()
const {
170 int getSize()
const {
173 int getWeight()
const {
215 ErrorCode
display(
CBofWindow *pWnd,
const char *pszText,
int nSize,
int nWeight, RGBCOLOR cColor = CTEXT_COLOR,
int nFont = FONT_DEFAULT);
227 ErrorCode
display(
CBofBitmap *pBmp,
const char *pszText,
int nSize,
int nWeight, RGBCOLOR cColor = CTEXT_COLOR,
int nFont = FONT_DEFAULT);
243 int nWeight, RGBCOLOR cColor, RGBCOLOR cShadow = CTEXT_SHADOW_COLOR,
244 int nDX = CTEXT_SHADOW_DX,
int nDY = CTEXT_SHADOW_DY,
int nFont = FONT_DEFAULT);
247 void flushBackground() {
251 static ErrorCode initialize();
252 static ErrorCode shutdown();
267 static Graphics::Font *getFont(
int nFont,
int nSize,
int nWeight);
273 void initializeFields();
286 ErrorCode displayText(
CBofWindow *pWnd,
const char *pszText,
CBofRect *pRect,
int nSize,
int nWeight,
bool bShadowed,
int nFont = FONT_DEFAULT);
287 ErrorCode displayText(
CBofBitmap *pBmp,
const char *pszText,
CBofRect *pRect,
int nSize,
int nWeight,
bool bShadowed,
int nFont = FONT_DEFAULT);
297 RGBCOLOR _cTextColor;
298 RGBCOLOR _cShadowColor;
308 uint32 _nFormatFlags;
315 static bool _initialized;
323 ErrorCode paintText(
CBofWindow *pWnd,
CBofRect *pRect,
const char *,
int nSize,
int nWeight, RGBCOLOR cColor = CTEXT_COLOR,
int nJustify = JUSTIFY_CENTER, uint32 nFormat = FORMAT_DEFAULT,
int nFont = FONT_DEFAULT);
324 ErrorCode paintText(
CBofBitmap *pBmp,
CBofRect *pRect,
const char *,
int nSize,
int nWeight, RGBCOLOR cColor = CTEXT_COLOR,
int nJustify = JUSTIFY_CENTER, uint32 nFormat = FORMAT_DEFAULT,
int nFont = FONT_DEFAULT);
326 ErrorCode paintShadowedText(
CBofBitmap *,
CBofRect *pRect,
const char *,
int nSize,
int nWeight, RGBCOLOR cColor = CTEXT_COLOR,
int nJustify = JUSTIFY_CENTER, uint32 n = FORMAT_DEFAULT,
int nFont = FONT_DEFAULT);
Definition: managed_surface.h:51
ErrorCode displayTextEx(CBofBitmap *pBmp, const char *pszText, CBofRect *pRect, int nSize, int nWeight, bool bShadowed, int nFont=0)
TextAlign
Definition: font.h:48
ErrorCode erase(CBofWindow *pWnd)
ErrorCode setupText(const CBofRect *pRect, int nJustify=0, uint32 nFormatFlags=((0x00000000|0x00000000)|0x00000010))
ErrorCode displayShadowed(CBofWindow *pWnd, const char *pszText, int nSize, int nWeight, RGBCOLOR cColor, RGBCOLOR cShadow=RGB(0, 0, 0), int nDX=2, int nDY=2, int nFont=0)
ErrorCode display(CBofWindow *pWnd)