~s-cecilio/lenmus/v5.1.x

« back to all changes in this revision

Viewing changes to src/graphic/GraphicManager.cpp

  • Committer: cecilios
  • Date: 2008-10-17 21:06:31 UTC
  • Revision ID: svn-v4:2587a929-2f0e-0410-ae78-fe6f687d5efe:trunk:406

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
// access to global some global flags
49
49
extern bool g_fUseAntiAliasing;         // in TheApp.cpp
50
50
 
 
51
 
 
52
#define lmUSE_FREETYPE  1
 
53
 
 
54
wxString m_sMusicFont = _T("lmbasic2.ttf");
 
55
 
51
56
//-----------------------------------------------------------------------------------------
52
57
 
53
58
lmGraphicManager::lmGraphicManager()
74
79
    m_yPageSize = 0;
75
80
}
76
81
 
77
 
 
78
 
 
79
82
lmGraphicManager::~lmGraphicManager()
80
83
{
81
84
    if (m_pBoxScore)
103
106
        delete m_pBoxScore;
104
107
        m_pBoxScore = (lmBoxScore*) NULL;
105
108
    }
 
109
#if lmUSE_FREETYPE
 
110
    wxMemoryDC memDC;
 
111
    wxBitmap* pBitmap = new wxBitmap(1, 1);     //allocate something to paint on it
 
112
    memDC.SelectObject(*pBitmap);
 
113
    memDC.SetMapMode(lmDC_MODE);
 
114
    memDC.SetUserScale( m_rScale, m_rScale );
 
115
    lmAggDrawer* pDrawer = new lmAggDrawer(&memDC, m_xPageSize, m_yPageSize, m_rScale);
 
116
    pDrawer->FtLoadFont(m_sMusicFont);
 
117
    m_pPaper->SetDrawer(pDrawer);
 
118
#endif
106
119
    m_pBoxScore = m_pScore->Layout(m_pPaper);
107
120
    m_fReLayout = false;
 
121
#if lmUSE_FREETYPE
 
122
    memDC.SelectObject(wxNullBitmap);
 
123
    delete pBitmap;
 
124
#endif
108
125
}
109
126
 
110
127
wxBitmap* lmGraphicManager::RenderScore(int nPage, int nOptions)
143
160
            memDC.SelectObject(*pBitmap);
144
161
            memDC.SetMapMode(lmDC_MODE);
145
162
            memDC.SetUserScale( m_rScale, m_rScale );
146
 
            lmAggDrawer* pDrawer = new lmAggDrawer(&memDC, m_xPageSize, m_yPageSize);
 
163
            lmAggDrawer* pDrawer = new lmAggDrawer(&memDC, m_xPageSize, m_yPageSize, m_rScale);
 
164
#if lmUSE_FREETYPE
 
165
            //TODO: During layout phase we need the font to compute glyph path and save it in the shape
 
166
            pDrawer->FtLoadFont(m_sMusicFont);
 
167
#endif
147
168
            m_pPaper->SetDrawer(pDrawer);
148
169
            wxASSERT(m_pBoxScore);  //Layout phase omitted?
149
170
            m_pBoxScore->RenderPage(nPage, m_pPaper);