diff options
| author | Philippe Saint-Pierre <stpere@gmail.com> | 2012-07-21 12:23:18 -0400 |
|---|---|---|
| committer | Philippe Saint-Pierre <stpere@gmail.com> | 2012-07-21 12:23:18 -0400 |
| commit | c5e8e32acd64dbbf41b67aee6dd7badb66c1ca7b (patch) | |
| tree | 4353171b2a2913395716dd7622b0b2fda529f549 | |
| parent | 6b0362305fa9f8a35ce0f2b7052b4c901d040fe9 (diff) | |
FontDemo: Cleanup of previous UTF-8 compliancy fixhrev44374
Avoid using the private API, rather use the public BString. Thanks mmlr.
| -rw-r--r-- | src/apps/fontdemo/FontDemoView.cpp | 14 | ||||
| -rw-r--r-- | src/apps/fontdemo/Jamfile | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/apps/fontdemo/FontDemoView.cpp b/src/apps/fontdemo/FontDemoView.cpp index 077ac6e1c1..5294eca5ff 100644 --- a/src/apps/fontdemo/FontDemoView.cpp +++ b/src/apps/fontdemo/FontDemoView.cpp @@ -19,8 +19,7 @@ #include <Font.h> #include <Message.h> #include <Shape.h> - -#include <utf8_functions.h> +#include <String.h> #include "messages.h" @@ -101,7 +100,8 @@ FontDemoView::_DrawView(BView* view) view->SetFont(&fFont, B_FONT_ALL); - const size_t size = UTF8CountChars(fString, -1); + BString tmpString(fString); + const size_t size = tmpString.CountChars(); BRect boundBoxes[size]; if (OutLineLevel()) @@ -138,8 +138,6 @@ FontDemoView::_DrawView(BView* view) // region area instead of the whole view. fBoxRegion.MakeEmpty(); - - char *tmpString = fString; for (size_t i = 0; i < size; i++) { xCoordArray[i] = 0.0f; @@ -163,10 +161,10 @@ FontDemoView::_DrawView(BView* view) } else { view->SetHighColor(0, 0, 0); view->SetDrawingMode(fDrawingMode); - int32 length = UTF8NextCharLen(tmpString); - view->DrawString(tmpString, length, + int32 charLength; + const char* charAt = tmpString.CharAt(i, &charLength); + view->DrawString(charAt, charLength, BPoint(xCoordArray[i], yCoordArray[i])); - tmpString += length; } if (BoundingBoxes() && !OutLineLevel()) { diff --git a/src/apps/fontdemo/Jamfile b/src/apps/fontdemo/Jamfile index a02fa1f33f..616621f2b0 100644 --- a/src/apps/fontdemo/Jamfile +++ b/src/apps/fontdemo/Jamfile @@ -2,8 +2,6 @@ SubDir HAIKU_TOP src apps fontdemo ; SetSubDirSupportedPlatformsBeOSCompatible ; -UsePrivateHeaders interface ; - Application FontDemo : ControlView.cpp FontDemo.cpp |
