// BoundingBox BRect Painter::BoundingBox(const char* utf8String, uint32 length, const BPoint& baseLine) const { Transformable transform; transform.TranslateBy(baseLine); BRect dummy; return fTextRenderer->RenderString(utf8String, length, fFontRendererSolid, fFontRendererBin, transform, dummy, true); }
// DrawString BRect Painter::DrawString(const char* utf8String, uint32 length, BPoint baseLine, const escapement_delta* delta) { BRect bounds(0.0, 0.0, -1.0, -1.0); fPatternHandler->SetPattern(B_SOLID_HIGH); if (fBuffer) { Transformable transform; transform.ShearBy(B_ORIGIN, (90.0 - fFont.Shear()) * PI / 180.0, 0.0); transform.RotateBy(B_ORIGIN, -fFont.Rotation() * PI / 180.0); transform.TranslateBy(baseLine); transform.ScaleBy(B_ORIGIN, fScale, fScale); transform.TranslateBy(fOrigin); BRect clippingFrame; if (fClippingRegion) clippingFrame = _Transform(fClippingRegion->Frame()); bounds = fTextRenderer->RenderString(utf8String, length, fFontRendererSolid, fFontRendererBin, transform, clippingFrame, false, &fPenLocation); // pen location is not transformed in quite the same way, // or transformations would add up transform.Reset(); transform.RotateBy(B_ORIGIN, -fFont.Rotation()); transform.TranslateBy(baseLine); transform.Transform(&fPenLocation); } return _Clipped(bounds); }