added some support functions for string bounding box

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12051 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-03-26 22:09:58 +00:00
parent 4157339be2
commit 80547db1f2
3 changed files with 4 additions and 3 deletions
@@ -331,7 +331,7 @@ AGGTextRenderer::RenderString(const char* string,
// Bounds // Bounds
BRect BRect
AGGTextRenderer::Bounds(const char* string, AGGTextRenderer::Bounds(const char* string, uint32 length,
const Transformable& transform) const Transformable& transform)
{ {
fFontEngine.hinting(fHinted); fFontEngine.hinting(fHinted);
@@ -342,7 +342,7 @@ AGGTextRenderer::Bounds(const char* string,
// do a UTF8 -> Unicode conversion // do a UTF8 -> Unicode conversion
if (string) { if (string) {
int32 srcLength = strlen(string); int32 srcLength = min_c(strlen(string), length);
if (srcLength > 0) { if (srcLength > 0) {
int32 dstLength = srcLength * 4; int32 dstLength = srcLength * 4;
@@ -37,6 +37,7 @@ class AGGTextRenderer : public TextRenderer {
BPoint* nextCharPos = NULL); BPoint* nextCharPos = NULL);
virtual BRect Bounds(const char* utf8String, virtual BRect Bounds(const char* utf8String,
uint32 length,
const Transformable& transform); const Transformable& transform);
private: private:
@@ -60,7 +60,7 @@ class TextRenderer : public BArchivable {
BRect constrainRect, BRect constrainRect,
const Transformable& transform) = 0;*/ const Transformable& transform) = 0;*/
virtual BRect Bounds(const char* utf8String, virtual BRect Bounds(const char* utf8String, uint32 length,
const Transformable& transform) = 0; const Transformable& transform) = 0;
virtual void Update() {}; virtual void Update() {};