added escapement_delta to AGGTextRenderer::RenderString and Painter
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14095 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3c40c4cead
commit
7f74cecda3
@ -1093,7 +1093,7 @@ DisplayDriverPainter::DrawString(const char* string, int32 length,
|
||||
// TODO: make the availability of the hardware cursor part of the
|
||||
// HW acceleration flags and skip all calculations for HideSoftwareCursor
|
||||
// in case we don't have one.
|
||||
BRect b = fPainter->BoundingBox(string, length, pt);
|
||||
BRect b = fPainter->BoundingBox(string, length, pt, delta);
|
||||
// stop here if we're supposed to render outside of the clipping
|
||||
b = fPainter->ClipRect(b);
|
||||
if (b.IsValid()) {
|
||||
|
@ -899,7 +899,8 @@ Painter::DrawString(const char* utf8String, uint32 length,
|
||||
baseLine,
|
||||
fClippingRegion->Frame(),
|
||||
false,
|
||||
&fPenLocation);
|
||||
&fPenLocation,
|
||||
delta);
|
||||
}
|
||||
return _Clipped(bounds);
|
||||
}
|
||||
@ -985,14 +986,16 @@ Painter::InvertRect(const BRect& r) const
|
||||
// BoundingBox
|
||||
BRect
|
||||
Painter::BoundingBox(const char* utf8String, uint32 length,
|
||||
const BPoint& baseLine) const
|
||||
const BPoint& baseLine, const escapement_delta* delta) const
|
||||
{
|
||||
static BRect dummy;
|
||||
BPoint penPosition;
|
||||
return fTextRenderer->RenderString(utf8String,
|
||||
length,
|
||||
fFontRendererSolid,
|
||||
fFontRendererBin,
|
||||
baseLine, dummy, true);
|
||||
baseLine, dummy, true, &penPosition,
|
||||
delta);
|
||||
}
|
||||
|
||||
// StringWidth
|
||||
|
@ -204,9 +204,8 @@ class Painter {
|
||||
|
||||
BRect InvertRect( const BRect& r) const;
|
||||
|
||||
BRect BoundingBox( const char* utf8String,
|
||||
uint32 length,
|
||||
const BPoint& baseLine) const;
|
||||
BRect BoundingBox( const char* utf8String, uint32 length,
|
||||
const BPoint& baseLine, const escapement_delta* delta = NULL) const;
|
||||
|
||||
float StringWidth( const char* utf8String,
|
||||
uint32 length) const;
|
||||
|
@ -41,6 +41,17 @@ rect_to_int(BRect r,
|
||||
bottom = (int32)ceilf(r.bottom);
|
||||
}
|
||||
|
||||
|
||||
// is_white_space
|
||||
inline bool
|
||||
is_white_space(uint16 glyph)
|
||||
{
|
||||
// TODO: handle them all!
|
||||
if (glyph == ' ' || glyph == B_TAB)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
#define DEFAULT_UNI_CODE_BUFFER_SIZE 2048
|
||||
|
||||
// constructor
|
||||
@ -150,7 +161,8 @@ AGGTextRenderer::RenderString(const char* string,
|
||||
const BPoint& baseLine,
|
||||
const BRect& clippingFrame,
|
||||
bool dryRun,
|
||||
BPoint* nextCharPos)
|
||||
BPoint* nextCharPos,
|
||||
const escapement_delta* delta)
|
||||
{
|
||||
//printf("RenderString(\"%s\", length: %ld, dry: %d)\n", string, length, dryRun);
|
||||
|
||||
@ -210,6 +222,9 @@ AGGTextRenderer::RenderString(const char* string,
|
||||
x += advanceX;
|
||||
y += advanceY;
|
||||
|
||||
if (delta)
|
||||
x += is_white_space(*p) ? delta->space : delta->nonspace;
|
||||
|
||||
// "glyphBounds" is the bounds of the glyph transformed
|
||||
// by the x y location of the glyph along the base line,
|
||||
// it is therefor yet "untransformed".
|
||||
|
@ -41,7 +41,8 @@ class AGGTextRenderer {
|
||||
const BPoint& baseLine,
|
||||
const BRect& clippingFrame,
|
||||
bool dryRun = false,
|
||||
BPoint* nextCharPos = NULL);
|
||||
BPoint* nextCharPos = NULL,
|
||||
const escapement_delta* delta = NULL);
|
||||
|
||||
double StringWidth(const char* utf8String,
|
||||
uint32 length);
|
||||
|
Loading…
Reference in New Issue
Block a user