-
- // 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) &&
- (font->GetStyle() == wxSLANT || font->GetStyle() == wxITALIC));
-
- // FIXME_MGL -- MGL does not yet support slant, although the API is there
- slant = FALSE;
-
- wxLogTrace("mgl_font", "requested instance of '%s' slant=%i pt=%0.1f aa=%i",
- m_fileName.mb_str(), slant, pt, antialiased);
-
- wxMGLFontInstance *i;
- wxMGLFontInstanceList::Node *node;
-
- for (node = m_instances->GetFirst(); node; node = node->GetNext())
- {
- i = node->GetData();
- if ( i->GetPt() == pt && i->GetSlant() == slant &&
- i->GetAA() == antialiased )
- {
- wxLogTrace("mgl_font", " got from cache: slant=%i pt=%0.1f aa=%i",
- i->GetSlant(), i->GetPt(), i->GetAA());
- return i;
- }
- }
-
- i = new wxMGLFontInstance(this, pt, slant, antialiased);
- m_instances->Append(i);
- return i;
-}
-
-
-wxMGLFontFamily::wxMGLFontFamily(const font_info_t *info)
-{
- m_name = info->familyName;
- m_fontInfo = info;
-
- if ( info->regularFace[0] == '\0' )
- m_fontLibs[wxFONTFACE_REGULAR] = NULL;
- else
- m_fontLibs[wxFONTFACE_REGULAR] =
- new wxMGLFontLibrary(info->regularFace, wxFONTFACE_REGULAR, this);
-
- if ( info->italicFace[0] == '\0' )
- m_fontLibs[wxFONTFACE_ITALIC] = NULL;
- else
- m_fontLibs[wxFONTFACE_ITALIC] =
- new wxMGLFontLibrary(info->italicFace, wxFONTFACE_ITALIC, this);
-
- if ( info->boldFace[0] == '\0' )
- m_fontLibs[wxFONTFACE_BOLD] = NULL;
- else
- m_fontLibs[wxFONTFACE_BOLD] =
- new wxMGLFontLibrary(info->boldFace, wxFONTFACE_BOLD, this);
-
- if ( info->boldItalicFace[0] == '\0' )
- m_fontLibs[wxFONTFACE_BOLD_ITALIC] = NULL;
- else
- m_fontLibs[wxFONTFACE_BOLD_ITALIC] =
- new wxMGLFontLibrary(info->boldItalicFace, wxFONTFACE_BOLD_ITALIC, this);
-
- wxLogTrace("mgl_font", "new family '%s' (r=%s, i=%s, b=%s, bi=%s)\n",
- info->familyName, info->regularFace, info->italicFace,
- info->boldFace, info->boldItalicFace);
-}
-
-wxMGLFontFamily::~wxMGLFontFamily()
-{
- for (size_t i = 0; i < wxFONTFACE_MAX; i++)
- delete m_fontLibs[i];
-}
-
-bool wxMGLFontFamily::HasFace(int type) const
-{
- return (m_fontLibs[type] != NULL);
-}
-
-
-// ----------------------------------------------------------------------------
-// wxFontsManager
-// ----------------------------------------------------------------------------
-
-wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
-{
- wxMGLFontFamily *family;
- int type;
- wxString facename = font->GetFaceName();
-
- if ( !facename.IsEmpty() )
- family = GetFamily(facename);