* 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:
@@ -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 -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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(); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user