antialiasing now disabled for small fonts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -177,7 +177,6 @@ bool wxFont::Create(int pointSize,
|
|||||||
|
|
||||||
struct font_t *wxFont::GetMGLfont_t(float scale, bool antialiased)
|
struct font_t *wxFont::GetMGLfont_t(float scale, bool antialiased)
|
||||||
{
|
{
|
||||||
// FIXME_MGL -- no antialiasing for fonts smaller than certain treshold!
|
|
||||||
if ( !M_FONTDATA->m_valid )
|
if ( !M_FONTDATA->m_valid )
|
||||||
{
|
{
|
||||||
wxMGLFontLibrary *old = M_FONTDATA->m_library;
|
wxMGLFontLibrary *old = M_FONTDATA->m_library;
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "wx/listimpl.cpp"
|
#include "wx/listimpl.cpp"
|
||||||
|
#include "wx/sysopt.h"
|
||||||
#include "wx/mgl/private.h"
|
#include "wx/mgl/private.h"
|
||||||
|
|
||||||
#include <mgraph.h>
|
#include <mgraph.h>
|
||||||
@@ -228,6 +229,8 @@ void wxMGLFontLibrary::DecRef()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gs_antialiasingThreshold = -1;
|
||||||
|
|
||||||
wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
||||||
float scale, bool aa)
|
float scale, bool aa)
|
||||||
{
|
{
|
||||||
@@ -235,10 +238,28 @@ wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
|||||||
|
|
||||||
wxString facename;
|
wxString facename;
|
||||||
bool slant;
|
bool slant;
|
||||||
bool antialiased =
|
bool antialiased;
|
||||||
(m_fontLib->fontLibType == MGL_BITMAPFONT_LIB) ? FALSE : aa;
|
|
||||||
float pt = (float)font->GetPointSize() * scale;
|
float pt = (float)font->GetPointSize() * scale;
|
||||||
|
|
||||||
|
if ( gs_antialiasingThreshold == -1 )
|
||||||
|
{
|
||||||
|
gs_antialiasingThreshold = 10;
|
||||||
|
#if wxUSE_SYSTEM_OPTIONS
|
||||||
|
if ( wxSystemOptions::HasOption(wxT("mgl.aa-threshold") )
|
||||||
|
gs_antialiasingThreshold =
|
||||||
|
wxSystemOptions::GetOptionInt(wxT("mgl.aa-threshold"));
|
||||||
|
wxLogTrace("mgl_font", "AA threshold set to %i", gs_antialiasingThreshold);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Small characters don't look good when antialiased with the algorithm
|
||||||
|
// that FreeType uses (mere 2x2 supersampling), so lets disable it AA
|
||||||
|
// completely for small fonts.
|
||||||
|
if ( pt <= gs_antialiasingThreshold )
|
||||||
|
antialiased = FALSE;
|
||||||
|
else
|
||||||
|
antialiased = (m_fontLib->fontLibType == MGL_BITMAPFONT_LIB) ? FALSE : aa;
|
||||||
|
|
||||||
slant = (((m_type & wxFONTFACE_ITALIC) == 0) &&
|
slant = (((m_type & wxFONTFACE_ITALIC) == 0) &&
|
||||||
(font->GetStyle() == wxSLANT || font->GetStyle() == wxITALIC));
|
(font->GetStyle() == wxSLANT || font->GetStyle() == wxITALIC));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user