5bc9fb9d24
* Remove no longer necessary support functions. * The new version uses a single BString as input/output parameter and only modifies that one by removing non-fitting chars and inserting the ellipsis where appropriate, so avoids copying around bytes/chars/strings in a few places. It uses the new Chars functions of BString so also no need for manual multibyte handling. * Adjusted the BFont and ServerFont usage of truncate_string() which are both simplified by using the single BString. It avoids a lot of temprary allocations and string copying. The char * version of BFont GetTruncatedStrings() now uses the BString version and not the other way around anymore which requires us to allocate temporary BString objects, it's not worse than before though. * This fixes a bunch of problems with the previous functions like always prepending the ellipsis for B_TRUNCATE_BEGINNING, crashing on short enough widths, violating the width in the B_TRUNCATE_END case when the width was short enough, non-optimal truncation in a few cases and sometimes truncation where none would've been needed. Also fixes #4128 which was a symptom of the broken B_TRUNCATE_BEGINNING. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35381 a95241bf-73f2-0310-859d-f6bbb57e9c96
15 lines
386 B
C
15 lines
386 B
C
/*
|
|
* Copyright 2010, Michael Lotz <mmlr@mlotz.ch>. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef TRUNCATE_STRING_H
|
|
#define TRUNCATE_STRING_H
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
void truncate_string(BString& string, uint32 mode, float width,
|
|
const float* escapementArray, float fontSize, float ellipsisWidth,
|
|
int32 numChars);
|
|
|
|
#endif // TRUNCATE_STRING_H
|