Example #1
0
/////////////////////////////////////////////////////////////////////////////
// Main UI function.
//    op = 0  ==> run common font dialog
//    op < 0  ==> font size smaller
//    op < 0  ==> font size bigger
//
// Returns zBOOL, whether changed or not, and CFont has new font.
//
zBOOL
ZFontUI::OnChangeFont( CFont& font, int op, CWnd *pWnd, DWORD dwFlags )
{
   ASSERT( font.m_hObject );
   if ( op == 0 )
   {
      // Run common font dialog
      LOGFONT logfont;
      font.GetLogFont( &logfont );
      CFontDialog dlg( &logfont, dwFlags, 0, pWnd );
      dlg.m_cf.nSizeMin = m_nFontPtSizeMin;
      dlg.m_cf.nSizeMax = m_nFontPtSizeMax;
      if ( dlg.DoModal( ) != IDOK )
         return( FALSE );

      // Change the font
      font.DeleteObject( );
      return( font.CreateFontIndirect( &logfont ) );
   }

   // Grow or shrink
   CWindowDC dc( 0 );                   // use screen DC
   int pts = GetFontPointSize( font, dc ); // get point size
   pts = GrowFontSize( pts, op );          // grow ( or shrink )
   if ( pts < m_nFontPtSizeMin || pts > m_nFontPtSizeMax )
      return( FALSE );

   return( SetFontPointSize( font, dc, pts ) );
}
Example #2
0
HRESULT CLCDText::Initialize()
{

    m_hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
    if(NULL != m_hFont)
    {
        SetFontPointSize(DEFAULT_POINTSIZE);
    }

    return (NULL != m_hFont) ? S_OK : E_OUTOFMEMORY;
}
Example #3
0
bool CTransform::SetScale(float scale)
{
    if (m_scale != scale)
    {
        m_scale = scale;
        SetFontPointSize((int)(ceil(DEFAULT_FONT_SIZE * m_scale)));
        MakeComposite();
        return true;
    }
    return false;
}
Example #4
0
HRESULT CLCDStreamingText::Initialize(void)
{
    m_eState = STATE_DELAY;
    m_dwStartDelay  = 2000;
    m_dwSpeed       = 7;
	m_dwStepInPixels = 7;
    m_dwLastUpdate = 0;
    m_dwEllapsedTime = 0;
    m_dwLastUpdate = GetTickCount();
    m_bRecalcExtent = FALSE;
    m_pQueueHead = NULL;
    m_fFractDistance = 0.0f;

    m_hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
    if(NULL != m_hFont)
    {
        SetFontPointSize(DEFAULT_POINTSIZE);
    }

    return CLCDCollection::Initialize();
}