#endif
#ifndef WX_PRECOMP
+ #include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/log.h"
#endif
const wxString& filename)
: wxFontInstanceBase(ptSize, aa)
{
- int scrSizePx, scrSizeMM;
- wxDisplaySize(NULL, &scrSizePx);
- wxDisplaySizeMM(NULL, &scrSizeMM);
- double dpi = (scrSizePx / (scrSizeMM * mm2inches));
// NB: DFB's fract_height value is 32bit integer with the last 6 bit
// representing fractional value, hence the multiplication by 64;
// 1pt=1/72inch, hence "/ 72"
- int pixSize = int(ptSize * dpi * 64 / 72);
+ int pixSize = int(ptSize * wxGetDisplayPPI().y * 64 / 72);
DFBFontDescription desc;
desc.flags = (DFBFontDescriptionFlags)(
else
m_font = wxIDirectFB::Get()->CreateFont(filename.fn_str(), &desc);
- wxASSERT_MSG( m_font, _T("cannot create font instance") );
+ wxASSERT_MSG( m_font, "cannot create font instance" );
}
// ----------------------------------------------------------------------------
void wxFontsManager::AddAllFonts()
{
wxString path;
- if ( !wxGetEnv(_T("WXDFB_FONTPATH"), &path) )
- path = _T(wxINSTALL_PREFIX "/share/wx/fonts");
+ if ( !wxGetEnv("WXDFB_FONTPATH", &path) )
+ path = wxT(wxINSTALL_PREFIX "/share/wx/fonts");
wxStringTokenizer tkn(path, wxPATH_SEP);
while ( tkn.HasMoreTokens() )
if ( !wxDir::Exists(dir) )
{
- wxLogDebug(_T("font directory %s doesn't exist"), dir);
+ wxLogDebug("font directory %s doesn't exist", dir);
continue;
}
wxArrayString indexFiles;
- if ( !wxDir::GetAllFiles(dir, &indexFiles, _T("FontsIndex")) )
+ if ( !wxDir::GetAllFiles(dir, &indexFiles, "FontsIndex") )
continue;
for ( wxArrayString::const_iterator i = indexFiles.begin();
{
// We can fall back to the builtin default font if no other fonts are
// defined:
- wxLogTrace(_T("font"),
+ wxLogTrace("font",
_("no fonts found in %s, using builtin font"), path);
AddBundle
return;
}
- wxLogTrace(_T("font"), _T("adding fonts from %s"), dir.c_str());
+ wxLogTrace("font", "adding fonts from %s", dir.c_str());
wxFileConfig cfg(wxEmptyString, wxEmptyString,
indexFile, wxEmptyString,
if ( p.empty() || wxFileName(p).IsAbsolute() )
return p;
- return dir + _T("/") + p;
+ return dir + "/" + p;
}
void wxFontsManager::AddFont(const wxString& dir,
const wxString& name,
wxFileConfig& cfg)
{
- wxLogTrace(_T("font"), _T("adding font '%s'"), name.c_str());
+ wxLogTrace("font", "adding font '%s'", name.c_str());
- wxConfigPathChanger ch(&cfg, wxString::Format(_T("/%s/"), name.c_str()));
+ wxConfigPathChanger ch(&cfg, wxString::Format("/%s/", name.c_str()));
AddBundle
(
new wxFontBundle
(
name,
- ReadFilePath(_T("Regular"), dir, cfg),
- ReadFilePath(_T("Italic"), dir, cfg),
- ReadFilePath(_T("Bold"), dir, cfg),
- ReadFilePath(_T("BoldItalic"), dir, cfg),
- cfg.Read(_T("IsFixed"), (long)false)
+ ReadFilePath("Regular", dir, cfg),
+ ReadFilePath("Italic", dir, cfg),
+ ReadFilePath("Bold", dir, cfg),
+ ReadFilePath("BoldItalic", dir, cfg),
+ cfg.Read("IsFixed", (long)false)
)
);
}
{
wxString name;
- if ( cfg.Read(_T("Default"), &name) )
+ if ( cfg.Read("Default", &name) )
{
m_defaultFacenames[wxFONTFAMILY_DECORATIVE] =
m_defaultFacenames[wxFONTFAMILY_ROMAN] =
m_defaultFacenames[wxFONTFAMILY_TELETYPE] = name;
}
- if ( cfg.Read(_T("DefaultDecorative"), &name) )
+ if ( cfg.Read("DefaultDecorative", &name) )
m_defaultFacenames[wxFONTFAMILY_DECORATIVE] = name;
- if ( cfg.Read(_T("DefaultRoman"), &name) )
+ if ( cfg.Read("DefaultRoman", &name) )
m_defaultFacenames[wxFONTFAMILY_ROMAN] = name;
- if ( cfg.Read(_T("DefaultScript"), &name) )
+ if ( cfg.Read("DefaultScript", &name) )
m_defaultFacenames[wxFONTFAMILY_SCRIPT] = name;
- if ( cfg.Read(_T("DefaultSwiss"), &name) )
+ if ( cfg.Read("DefaultSwiss", &name) )
m_defaultFacenames[wxFONTFAMILY_SWISS] = name;
- if ( cfg.Read(_T("DefaultModern"), &name) )
+ if ( cfg.Read("DefaultModern", &name) )
m_defaultFacenames[wxFONTFAMILY_MODERN] = name;
- if ( cfg.Read(_T("DefaultTeletype"), &name) )
+ if ( cfg.Read("DefaultTeletype", &name) )
m_defaultFacenames[wxFONTFAMILY_TELETYPE] = name;
}