* Kill 180 lines of code by removing duplicate *::Render() functions and giving a default value to the renderMode parameter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632
diff --git a/src/FTFont/FTBitmapFont.cpp b/src/FTFont/FTBitmapFont.cpp
index da86613..c14d4f1 100644
--- a/src/FTFont/FTBitmapFont.cpp
+++ b/src/FTFont/FTBitmapFont.cpp
@@ -63,7 +63,7 @@ FTGlyph* FTBitmapFont::MakeGlyph(FT_GlyphSlot ftGlyph)
template <typename T>
-inline void FTBitmapFontImpl::RenderI(const T *string)
+inline void FTBitmapFontImpl::RenderI(const T *string, int renderMode)
{
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
glPushAttrib(GL_ENABLE_BIT);
@@ -73,21 +73,21 @@ inline void FTBitmapFontImpl::RenderI(const T *string)
glDisable(GL_BLEND);
- FTFontImpl::Render(string);
+ FTFontImpl::Render(string, renderMode);
glPopAttrib();
glPopClientAttrib();
}
-void FTBitmapFontImpl::Render(const char* string)
+void FTBitmapFontImpl::Render(const char* string, int renderMode)
{
- RenderI(string);
+ RenderI(string, renderMode);
}
-void FTBitmapFontImpl::Render(const wchar_t* string)
+void FTBitmapFontImpl::Render(const wchar_t* string, int renderMode)
{
- RenderI(string);
+ RenderI(string, renderMode);
}
diff --git a/src/FTFont/FTBitmapFontImpl.h b/src/FTFont/FTBitmapFontImpl.h
index a0c5f0b..1b9000a 100644
--- a/src/FTFont/FTBitmapFontImpl.h
+++ b/src/FTFont/FTBitmapFontImpl.h
@@ -42,14 +42,14 @@ class FTBitmapFontImpl : public FTFontImpl
size_t bufferSizeInBytes) :
FTFontImpl(ftFont, pBufferBytes, bufferSizeInBytes) {};
- virtual void Render(const char* string);
+ virtual void Render(const char* string, int renderMode);
- virtual void Render(const wchar_t* string);
+ virtual void Render(const wchar_t* string, int renderMode);
private:
/* Internal generic Render() implementation */
template <typename T>
- inline void RenderI(const T* string);
+ inline void RenderI(const T* string, int renderMode);
};
#endif // __FTBitmapFontImpl__
diff --git a/src/FTFont/FTFont.cpp b/src/FTFont/FTFont.cpp
index cc47932..f16a63f 100644
--- a/src/FTFont/FTFont.cpp
+++ b/src/FTFont/FTFont.cpp
@@ -153,18 +153,6 @@ float FTFont::LineHeight() const
}
-void FTFont::Render(const wchar_t* string)
-{
- return impl->Render(string);
-}
-
-
-void FTFont::Render(const char * string)
-{
- return impl->Render(string);
-}
-
-
void FTFont::Render(const char * string, int renderMode)
{
return impl->Render(string, renderMode);
@@ -288,19 +276,6 @@ inline void FTFontImpl::RenderI(const T* string, int renderMode)
}
-void FTFontImpl::Render(const char * string)
-{
- RenderI((const unsigned char *)string,
- FTGL::RENDER_FRONT | FTGL::RENDER_BACK | FTGL::RENDER_SIDE);
-}
-
-
-void FTFontImpl::Render(const wchar_t* string)
-{
- RenderI(string, FTGL::RENDER_FRONT | FTGL::RENDER_BACK | FTGL::RENDER_SIDE);
-}
-
-
void FTFontImpl::Render(const char * string, int renderMode)
{
RenderI((const unsigned char *)string, renderMode);
diff --git a/src/FTFont/FTFontImpl.h b/src/FTFont/FTFontImpl.h
index 7007211..4406b7d 100644
--- a/src/FTFont/FTFontImpl.h
+++ b/src/FTFont/FTFontImpl.h
@@ -67,12 +67,8 @@ class FTFontImpl
virtual float LineHeight() const;
- virtual void Render(const char* string);
-
virtual void Render(const char* string, int renderMode);
- virtual void Render(const wchar_t* string);
-
virtual void Render(const wchar_t *string, int renderMode);
virtual bool FaceSize(const unsigned int size,
diff --git a/src/FTFont/FTOutlineFont.cpp b/src/FTFont/FTOutlineFont.cpp
index 05a7ed8..61c1d27 100644
--- a/src/FTFont/FTOutlineFont.cpp
+++ b/src/FTFont/FTOutlineFont.cpp
@@ -70,7 +70,7 @@ FTGlyph* FTOutlineFont::MakeGlyph(FT_GlyphSlot ftGlyph)
template <typename T>
-inline void FTOutlineFontImpl::RenderI(const T* string)
+inline void FTOutlineFontImpl::RenderI(const T* string, int renderMode)
{
glPushAttrib(GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT
| GL_COLOR_BUFFER_BIT);
@@ -82,32 +82,20 @@ inline void FTOutlineFontImpl::RenderI(const T* string)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
- FTFontImpl::Render(string);
+ FTFontImpl::Render(string, renderMode);
glPopAttrib();
}
-void FTOutlineFontImpl::Render(const char* string)
-{
- RenderI(string);
-}
-
-
void FTOutlineFontImpl::Render(const char* string, int renderMode)
{
- RenderI(string);
-}
-
-
-void FTOutlineFontImpl::Render(const wchar_t* string)
-{
- RenderI(string);
+ RenderI(string, renderMode);
}
void FTOutlineFontImpl::Render(const wchar_t* string, int renderMode)
{
- RenderI(string);
+ RenderI(string, renderMode);
}
diff --git a/src/FTFont/FTOutlineFontImpl.h b/src/FTFont/FTOutlineFontImpl.h
index d62be83..8118318 100644
--- a/src/FTFont/FTOutlineFontImpl.h
+++ b/src/FTFont/FTOutlineFontImpl.h
@@ -52,13 +52,6 @@ class FTOutlineFontImpl : public FTFontImpl
virtual void Outset(float o) { outset = o; }
/**
- * Renders a string of characters
- *
- * @param string 'C' style string to be output.
- */
- virtual void Render(const char* string);
-
- /**
* Render a string of characters
*
* @param string 'C' style string to be output.
@@ -67,13 +60,6 @@ class FTOutlineFontImpl : public FTFontImpl
virtual void Render(const char* string, int renderMode);
/**
- * Renders a string of characters
- *
- * @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t* string);
-
- /**
* Render a string of characters
*
* @param string wchar_t string to be output.
@@ -89,7 +75,7 @@ class FTOutlineFontImpl : public FTFontImpl
/* Internal generic Render() implementation */
template <typename T>
- inline void RenderI(const T* string);
+ inline void RenderI(const T* string, int renderMode);
};
#endif // __FTOutlineFontImpl__
diff --git a/src/FTFont/FTPixmapFont.cpp b/src/FTFont/FTPixmapFont.cpp
index 58ca566..73438ec 100644
--- a/src/FTFont/FTPixmapFont.cpp
+++ b/src/FTFont/FTPixmapFont.cpp
@@ -63,7 +63,7 @@ FTGlyph* FTPixmapFont::MakeGlyph(FT_GlyphSlot ftGlyph)
template <typename T>
-inline void FTPixmapFontImpl::RenderI(const T* string)
+inline void FTPixmapFontImpl::RenderI(const T* string, int renderMode)
{
glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
@@ -81,33 +81,21 @@ inline void FTPixmapFontImpl::RenderI(const T* string)
glPixelTransferf(GL_BLUE_SCALE, ftglColour[2]);
glPixelTransferf(GL_ALPHA_SCALE, ftglColour[3]);
- FTFontImpl::Render(string);
+ FTFontImpl::Render(string, renderMode);
glPopClientAttrib();
glPopAttrib();
}
-void FTPixmapFontImpl::Render(const char* string)
-{
- RenderI(string);
-}
-
-
void FTPixmapFontImpl::Render(const char* string, int renderMode)
{
- RenderI(string);
-}
-
-
-void FTPixmapFontImpl::Render(const wchar_t* string)
-{
- RenderI(string);
+ RenderI(string, renderMode);
}
void FTPixmapFontImpl::Render(const wchar_t* string, int renderMode)
{
- RenderI(string);
+ RenderI(string, renderMode);
}
diff --git a/src/FTFont/FTPixmapFontImpl.h b/src/FTFont/FTPixmapFontImpl.h
index 7e8e436..e2fb24e 100644
--- a/src/FTFont/FTPixmapFontImpl.h
+++ b/src/FTFont/FTPixmapFontImpl.h
@@ -43,13 +43,6 @@ class FTPixmapFontImpl : public FTFontImpl
FTFontImpl(ftFont, pBufferBytes, bufferSizeInBytes) {};
/**
- * Renders a string of characters
- *
- * @param string 'C' style string to be output.
- */
- virtual void Render(const char* string);
-
- /**
* Render a string of characters
*
* @param string 'C' style string to be output.
@@ -58,13 +51,6 @@ class FTPixmapFontImpl : public FTFontImpl
virtual void Render(const char* string, int renderMode);
/**
- * Renders a string of characters
- *
- * @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t* string);
-
- /**
* Render a string of characters
*
* @param string wchar_t string to be output.
@@ -75,7 +61,7 @@ class FTPixmapFontImpl : public FTFontImpl
private:
/* Internal generic Render() implementation */
template <typename T>
- inline void RenderI(const T* string);
+ inline void RenderI(const T* string, int renderMode);
};
#endif // __FTPixmapFontImpl__
diff --git a/src/FTFont/FTTextureFont.cpp b/src/FTFont/FTTextureFont.cpp
index c8159f5..23cdb2b 100644
--- a/src/FTFont/FTTextureFont.cpp
+++ b/src/FTFont/FTTextureFont.cpp
@@ -224,37 +224,25 @@ bool FTTextureFontImpl::FaceSize(const unsigned int size, const unsigned int res
template <typename T>
-inline void FTTextureFontImpl::RenderI(const T* string)
+inline void FTTextureFontImpl::RenderI(const T* string, int renderMode)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
FTTextureGlyphImpl::ResetActiveTexture();
- FTFontImpl::Render(string);
-}
-
-
-void FTTextureFontImpl::Render(const char* string)
-{
- RenderI(string);
+ FTFontImpl::Render(string, renderMode);
}
void FTTextureFontImpl::Render(const char* string, int renderMode)
{
- RenderI(string);
-}
-
-
-void FTTextureFontImpl::Render(const wchar_t* string)
-{
- RenderI(string);
+ RenderI(string, renderMode);
}
void FTTextureFontImpl::Render(const wchar_t* string, int renderMode)
{
- RenderI(string);
+ RenderI(string, renderMode);
}
diff --git a/src/FTFont/FTTextureFontImpl.h b/src/FTFont/FTTextureFontImpl.h
index 893726b..eb80408 100644
--- a/src/FTFont/FTTextureFontImpl.h
+++ b/src/FTFont/FTTextureFontImpl.h
@@ -55,13 +55,6 @@ class FTTextureFontImpl : public FTFontImpl
const unsigned int res = 72);
/**
- * Renders a string of characters
- *
- * @param string 'C' style string to be output.
- */
- virtual void Render(const char* string);
-
- /**
* Render a string of characters
*
* @param string 'C' style string to be output.
@@ -70,13 +63,6 @@ class FTTextureFontImpl : public FTFontImpl
virtual void Render(const char* string, int renderMode);
/**
- * Renders a string of characters
- *
- * @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t* string);
-
- /**
* Render a string of characters
*
* @param string wchar_t string to be output.
@@ -165,7 +151,7 @@ class FTTextureFontImpl : public FTFontImpl
/* Internal generic Render() implementation */
template <typename T>
- inline void RenderI(const T* string);
+ inline void RenderI(const T* string, int renderMode);
};
#endif // __FTTextureFontImpl__
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index 9dad775..1d31ab7 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -275,31 +275,19 @@ class FTGL_EXPORT FTFont
* Render a string of characters
*
* @param string 'C' style string to be output.
+ * @param renderMode Render mode to display (optional)
*/
- virtual void Render(const char* string);
-
- /**
- * Render a string of characters
- *
- * @param string 'C' style string to be output.
- * @param renderMode Render mode to display
- */
- virtual void Render(const char* string, int renderMode);
-
- /**
- * Render a string of characters
- *
- * @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t* string);
+ virtual void Render(const char* string,
+ int renderMode = FTGL::RENDER_ALL);
/**
* Render a string of characters
*
* @param string wchar_t string to be output.
- * @param renderMode Render mode to display
+ * @param renderMode Render mode to display (optional)
*/
- virtual void Render(const wchar_t *string, int renderMode);
+ virtual void Render(const wchar_t *string,
+ int renderMode = FTGL::RENDER_ALL);
/**
* Queries the Font for errors.
diff --git a/src/FTGL/FTLayout.h b/src/FTGL/FTLayout.h
index 564aa3a..cebf2b6 100644
--- a/src/FTGL/FTLayout.h
+++ b/src/FTGL/FTLayout.h
@@ -92,31 +92,19 @@ class FTGL_EXPORT FTLayout
* Render a string of characters
*
* @param string 'C' style string to be output.
+ * @param renderMode Render mode to display (optional)
*/
- virtual void Render(const char *string) = 0;
-
- /**
- * Render a string of characters
- *
- * @param string 'C' style string to be output.
- * @param renderMode Render mode to diplay
- */
- virtual void Render(const char *string, int renderMode) = 0;
-
- /**
- * Render a string of characters
- *
- * @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t *string) = 0;
+ virtual void Render(const char *string,
+ int renderMode = FTGL::RENDER_ALL) = 0;
/**
* Render a string of characters
*
* @param string wchar_t string to be output.
- * @param renderMode Render mode to diplay
+ * @param renderMode Render mode to display (optional)
*/
- virtual void Render(const wchar_t *string, int renderMode) = 0;
+ virtual void Render(const wchar_t *string,
+ int renderMode = FTGL::RENDER_ALL) = 0;
/**
* Queries the Layout for errors.
diff --git a/src/FTGL/FTSimpleLayout.h b/src/FTGL/FTSimpleLayout.h
index a04ffa6..69d63a2 100644
--- a/src/FTGL/FTSimpleLayout.h
+++ b/src/FTGL/FTSimpleLayout.h
@@ -80,31 +80,19 @@ class FTGL_EXPORT FTSimpleLayout : public FTLayout
* Render a string of characters
*
* @param string 'C' style string to be output.
+ * @param renderMode Render mode to display (optional)
*/
- virtual void Render(const char *string);
-
- /**
- * Render a string of characters
- *
- * @param string 'C' style string to be output.
- * @param renderMode Render mode to diplay
- */
- virtual void Render(const char *string, int renderMode);
-
- /**
- * Render a string of characters
- *
- * @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t *string);
+ virtual void Render(const char *string,
+ int renderMode = FTGL::RENDER_ALL);
/**
* Render a string of characters
*
* @param string wchar_t string to be output.
- * @param renderMode Render mode to diplay
+ * @param renderMode Render mode to display (optional)
*/
- virtual void Render(const wchar_t *string, int renderMode);
+ virtual void Render(const wchar_t *string,
+ int renderMode = FTGL::RENDER_ALL);
/**
* Set the font to use for rendering the text.
diff --git a/src/FTGL/ftgl.h b/src/FTGL/ftgl.h
index ef3af4d..67b0237 100644
--- a/src/FTGL/ftgl.h
+++ b/src/FTGL/ftgl.h
@@ -52,25 +52,25 @@ namespace FTGL
{
typedef enum
{
- RENDER_FRONT = 0x01,
- RENDER_BACK = 0x02,
- RENDER_SIDE = 0x04,
- RENDER_ALL = 0xffff
+ RENDER_FRONT = 0x0001,
+ RENDER_BACK = 0x0002,
+ RENDER_SIDE = 0x0004,
+ RENDER_ALL = 0xffff
} RenderMode;
typedef enum
{
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT,
- ALIGN_JUSTIFY
+ ALIGN_LEFT = 0,
+ ALIGN_CENTER = 1,
+ ALIGN_RIGHT = 2,
+ ALIGN_JUSTIFY = 3
} TextAlignment;
}
#else
-# define FTGL_RENDER_FRONT 0x0001
-# define FTGL_RENDER_BACK 0x0002
-# define FTGL_RENDER_SIDE 0x0004
-# define FTGL_RENDER_ALL 0xffff
+# define FTGL_RENDER_FRONT 0x0001
+# define FTGL_RENDER_BACK 0x0002
+# define FTGL_RENDER_SIDE 0x0004
+# define FTGL_RENDER_ALL 0xffff
# define FTGL_ALIGN_LEFT 0
# define FTGL_ALIGN_CENTER 1
diff --git a/src/FTLayout/FTSimpleLayout.cpp b/src/FTLayout/FTSimpleLayout.cpp
index ce4faaa..26a9966 100644
--- a/src/FTLayout/FTSimpleLayout.cpp
+++ b/src/FTLayout/FTSimpleLayout.cpp
@@ -59,18 +59,6 @@ FTBBox FTSimpleLayout::BBox(const wchar_t *string)
}
-void FTSimpleLayout::Render(const char *string)
-{
- return dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string);
-}
-
-
-void FTSimpleLayout::Render(const wchar_t* string)
-{
- return dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string);
-}
-
-
void FTSimpleLayout::Render(const char *string, int renderMode)
{
return dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string, renderMode);
@@ -190,18 +178,6 @@ inline void FTSimpleLayoutImpl::RenderI(const T *string, int renderMode)
}
-void FTSimpleLayoutImpl::Render(const char *string)
-{
- RenderI(string, FTGL::RENDER_FRONT | FTGL::RENDER_BACK | FTGL::RENDER_SIDE);
-}
-
-
-void FTSimpleLayoutImpl::Render(const wchar_t* string)
-{
- RenderI(string, FTGL::RENDER_FRONT | FTGL::RENDER_BACK | FTGL::RENDER_SIDE);
-}
-
-
void FTSimpleLayoutImpl::Render(const char *string, int renderMode)
{
RenderI(string, renderMode);
diff --git a/src/FTLayout/FTSimpleLayoutImpl.h b/src/FTLayout/FTSimpleLayoutImpl.h
index f7add36..79c805d 100644
--- a/src/FTLayout/FTSimpleLayoutImpl.h
+++ b/src/FTLayout/FTSimpleLayoutImpl.h
@@ -60,13 +60,6 @@ class FTSimpleLayoutImpl : public FTLayoutImpl
* Render a string of characters
*
* @param string 'C' style string to be output.
- */
- virtual void Render(const char* string);
-
- /**
- * Render a string of characters
- *
- * @param string 'C' style string to be output.
* @param renderMode Render mode to display
*/
virtual void Render(const char* string, int renderMode);
@@ -75,13 +68,6 @@ class FTSimpleLayoutImpl : public FTLayoutImpl
* Render a string of characters
*
* @param string wchar_t string to be output.
- */
- virtual void Render(const wchar_t* string);
-
- /**
- * Render a string of characters
- *
- * @param string wchar_t string to be output.
* @param renderMode Render mode to display
*/
virtual void Render(const wchar_t* string, int renderMode);