* added a version of SetFont() that takes a DrawState* to DrawingEngine and

Painter, that is needed to be able to tell if anti-aliasing is to be used,
  since the flags in the font can be overruled by the flags in the view...
* fixes aliased fonts reliably, tested with FontDemo


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21869 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2007-08-09 09:48:28 +00:00
parent 98eadf4b9d
commit fe914c98b4
5 changed files with 31 additions and 14 deletions
+1 -2
View File
@@ -1271,9 +1271,8 @@ ServerWindow::_DispatchViewMessage(int32 code,
{ {
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
fCurrentLayer->CurrentState()->ReadFontFromLink(link); fCurrentLayer->CurrentState()->ReadFontFromLink(link);
// _UpdateDrawState(fCurrentLayer);
fWindowLayer->GetDrawingEngine()->SetFont( fWindowLayer->GetDrawingEngine()->SetFont(
fCurrentLayer->CurrentState()->Font()); fCurrentLayer->CurrentState());
break; break;
} }
case AS_LAYER_GET_STATE: case AS_LAYER_GET_STATE:
@@ -246,6 +246,13 @@ DrawingEngine::SetFont(const ServerFont& font)
} }
void
DrawingEngine::SetFont(const DrawState* state)
{
fPainter->SetFont(state);
}
// #pragma mark - // #pragma mark -
+1
View File
@@ -79,6 +79,7 @@ public:
void SetBlendingMode(source_alpha srcAlpha, void SetBlendingMode(source_alpha srcAlpha,
alpha_function alphaFunc); alpha_function alphaFunc);
void SetFont(const ServerFont& font); void SetFont(const ServerFont& font);
void SetFont(const DrawState* state);
void SuspendAutoSync(); void SuspendAutoSync();
void Sync(); void Sync();
+12 -3
View File
@@ -130,9 +130,7 @@ Painter::SetDrawState(const DrawState* data, int32 xOffset, int32 yOffset)
// but for now... // but for now...
SetPenSize(data->PenSize()); SetPenSize(data->PenSize());
SetFont(data->Font()); SetFont(data);
fTextRenderer.SetAntialiasing(!(data->ForceFontAliasing()
|| data->Font().Flags() & B_DISABLE_ANTIALIASING));
fSubpixelPrecise = data->SubPixelPrecise(); fSubpixelPrecise = data->SubPixelPrecise();
@@ -260,6 +258,17 @@ void
Painter::SetFont(const ServerFont& font) Painter::SetFont(const ServerFont& font)
{ {
fTextRenderer.SetFont(font); fTextRenderer.SetFont(font);
fTextRenderer.SetAntialiasing(
!(font.Flags() & B_DISABLE_ANTIALIASING));
}
// SetFont
void
Painter::SetFont(const DrawState* state)
{
fTextRenderer.SetFont(state->Font());
fTextRenderer.SetAntialiasing(!(state->ForceFontAliasing()
|| state->Font().Flags() & B_DISABLE_ANTIALIASING));
} }
// #pragma mark - drawing // #pragma mark - drawing
@@ -85,6 +85,7 @@ class Painter {
alpha_function alphaFunc); alpha_function alphaFunc);
void SetFont(const ServerFont& font); void SetFont(const ServerFont& font);
void SetFont(const DrawState* state);
inline const ServerFont& Font() const inline const ServerFont& Font() const
{ return fTextRenderer.Font(); } { return fTextRenderer.Font(); }