FontDemo: Cleanup of previous UTF-8 compliancy fix
Avoid using the private API, rather use the public BString. Thanks mmlr.
This commit is contained in:
parent
6b0362305f
commit
c5e8e32acd
|
@ -19,8 +19,7 @@
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Shape.h>
|
#include <Shape.h>
|
||||||
|
#include <String.h>
|
||||||
#include <utf8_functions.h>
|
|
||||||
|
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
|
||||||
|
@ -101,7 +100,8 @@ FontDemoView::_DrawView(BView* view)
|
||||||
|
|
||||||
view->SetFont(&fFont, B_FONT_ALL);
|
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];
|
BRect boundBoxes[size];
|
||||||
|
|
||||||
if (OutLineLevel())
|
if (OutLineLevel())
|
||||||
|
@ -139,8 +139,6 @@ FontDemoView::_DrawView(BView* view)
|
||||||
|
|
||||||
fBoxRegion.MakeEmpty();
|
fBoxRegion.MakeEmpty();
|
||||||
|
|
||||||
char *tmpString = fString;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
xCoordArray[i] = 0.0f;
|
xCoordArray[i] = 0.0f;
|
||||||
yCoordArray[i] = 0.0f;
|
yCoordArray[i] = 0.0f;
|
||||||
|
@ -163,10 +161,10 @@ FontDemoView::_DrawView(BView* view)
|
||||||
} else {
|
} else {
|
||||||
view->SetHighColor(0, 0, 0);
|
view->SetHighColor(0, 0, 0);
|
||||||
view->SetDrawingMode(fDrawingMode);
|
view->SetDrawingMode(fDrawingMode);
|
||||||
int32 length = UTF8NextCharLen(tmpString);
|
int32 charLength;
|
||||||
view->DrawString(tmpString, length,
|
const char* charAt = tmpString.CharAt(i, &charLength);
|
||||||
|
view->DrawString(charAt, charLength,
|
||||||
BPoint(xCoordArray[i], yCoordArray[i]));
|
BPoint(xCoordArray[i], yCoordArray[i]));
|
||||||
tmpString += length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BoundingBoxes() && !OutLineLevel()) {
|
if (BoundingBoxes() && !OutLineLevel()) {
|
||||||
|
|
|
@ -2,8 +2,6 @@ SubDir HAIKU_TOP src apps fontdemo ;
|
||||||
|
|
||||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
|
||||||
UsePrivateHeaders interface ;
|
|
||||||
|
|
||||||
Application FontDemo :
|
Application FontDemo :
|
||||||
ControlView.cpp
|
ControlView.cpp
|
||||||
FontDemo.cpp
|
FontDemo.cpp
|
||||||
|
|
Loading…
Reference in New Issue