Esempio n. 1
0
Transformable
ServerFont::EmbeddedTransformation() const
{
	// TODO: cache this?
	Transformable transform;

	transform.ShearBy(B_ORIGIN, (90.0 - fShear) * M_PI / 180.0, 0.0);
	transform.RotateBy(B_ORIGIN, -fRotation * M_PI / 180.0);

	return transform;
}
Esempio n. 2
0
// 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);
}