当前位置: 首页>>代码示例>>C++>>正文


C++ wxFont::SetPointSize方法代码示例

本文整理汇总了C++中wxFont::SetPointSize方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFont::SetPointSize方法的具体用法?C++ wxFont::SetPointSize怎么用?C++ wxFont::SetPointSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxFont的用法示例。


在下文中一共展示了wxFont::SetPointSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AdjustFontSize

static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize)
{
    int currentSize = 0;
    int largestGood = 0;
    int smallestBad = 0;

    bool initialGoodFound = false;
    bool initialBadFound = false;

    // NB: this assignment was separated from the variable definition
    // in order to fix a gcc v3.3.3 compiler crash
    currentSize = font.GetPointSize();
    while (currentSize > 0)
    {
        dc.SetFont(font);

        // if currentSize (in points) results in a font that is smaller
        // than required by pixelSize it is considered a good size
        if (dc.GetCharHeight() <= pixelSize.GetHeight() &&
                (!pixelSize.GetWidth() ||
                 dc.GetCharWidth() <= pixelSize.GetWidth()))
        {
            largestGood = currentSize;
            initialGoodFound = true;
        }
        else
        {
            smallestBad = currentSize;
            initialBadFound = true;
        }
        if (!initialGoodFound)
        {
            currentSize /= 2;
        }
        else if (!initialBadFound)
        {
            currentSize *= 2;
        }
        else
        {
            int distance = smallestBad - largestGood;
            if (distance == 1)
                break;

            currentSize = largestGood + distance / 2;
        }

        font.SetPointSize(currentSize);
    }

    if (currentSize != largestGood)
        font.SetPointSize(largestGood);
}
开发者ID:EdgarTx,项目名称:wx,代码行数:53,代码来源:fontcmn.cpp

示例2: SetItemFont

void SetItemFont(wxListCtrl *listctrl, long item, wxFont &font)
{
    wxListItem it;
    it.SetId(item);
    listctrl->GetItem(it);
    font.SetPointSize(g_DefaultFontSize);
    it.SetFont(font);
    listctrl->SetItem(it);
}
开发者ID:KrasnayaPloshchad,项目名称:madedit-mod,代码行数:9,代码来源:MadHighlightingDialog.cpp

示例3: wxPanel

TranslDlg::TranslDlg(wxWindow *parent) : wxPanel(parent)
{//=====================================================

	int height;
	int width;
	int x,y;
	int font_size;
	int height_ph = 350;


	wxTextAttr attr;
	wxFont font = wxFont(12,wxFONTFAMILY_ROMAN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT,false,_T(""),wxFONTENCODING_SYSTEM);

	attr.SetFont(font);

	wxClientDisplayRect(&x,&y,&width, &height);
#ifdef PLATFORM_WINDOWS
	if(height <= 768)
		height_ph = height - 416;
#else
	if(height <= 800)
		height_ph = 280;
#endif


	t_source = new wxTextCtrl(this,T_SOURCE,_T(""),wxPoint(0,4),
		wxSize(298,250),wxTE_MULTILINE,wxDefaultValidator,_T("Text input window"));
	t_source->SetDefaultStyle(attr);


	t_phonetic = new wxTextCtrl(this,T_PHONETIC,_T(""),wxPoint(0,262),
		wxSize(298,height_ph),wxTE_MULTILINE | wxTE_READONLY, wxDefaultValidator,_T("Phoneme translation window"));

	style_phonetic = t_phonetic->GetDefaultStyle();
	font_phonetic = style_phonetic.GetFont();
	font_size = font_phonetic.GetPointSize();
	font_phonetic_large = font_phonetic;
	style_phonetic_large = style_phonetic;
//font_phonetic_large.SetFamily(wxFONTFAMILY_SWISS);
	font_phonetic_large.SetPointSize(font_size+1);
	style_phonetic_large.SetFont(font_phonetic_large);

	y = height_ph + 270;
	t_translate = new wxButton(this,T_TRANSLATE,_T("Translate"),wxPoint(4,y));
	t_translate = new wxButton(this,T_RULES,_T("Show Rules"),wxPoint(4,y+32));
	t_translate = new wxButton(this,T_TRANSLATE_IPA,_T("Show IPA"),wxPoint(100,y+32));
	t_process = new wxButton(this,T_PROCESS,_T("Speak"),wxPoint(100,y));

	t_source->SetFocus();
}  // end of TransDlg::TransDlg
开发者ID:Shqip,项目名称:ar-espeak,代码行数:50,代码来源:transldlg.cpp

示例4: GetFont

/// Initializes a wxFont object using the FontSetting data
/// @param font wxFont object to initialize
void FontSetting::GetFont(wxFont& font) const
{
    //------Last Checked------//
    // - Dec 6, 2004
    font.SetPointSize(GetPointSize());
    font.SetFamily(wxDEFAULT);
    font.SetStyle(((IsItalic()) ? wxITALIC : wxNORMAL));
    
    if (m_weight <= weightLight)
        font.SetWeight(wxLIGHT);
    else if (m_weight < weightBold)
        font.SetWeight(wxNORMAL);
    else
        font.SetWeight(wxBOLD);
    font.SetUnderlined(IsUnderline());
    font.SetFaceName(GetFaceName());
}
开发者ID:BackupTheBerlios,项目名称:ptparser-svn,代码行数:19,代码来源:fontsetting.cpp

示例5: SetFontPixelH

wxCoord SjVisBg::SetFontPixelH(wxDC& dc, wxFont& font, wxCoord pixelH, wxCoord fontPtSize)
{
	wxCoord w, h;

	while( 1 )
	{
		font.SetPointSize(fontPtSize);
		dc.SetFont(font);
		dc.GetTextExtent(wxT("Ag"), &w, &h);
		if( h<=pixelH || fontPtSize<=6 )
		{
			break;
		}
		fontPtSize--;
	}

	return fontPtSize;
}
开发者ID:boh1996,项目名称:silverjuke,代码行数:18,代码来源:vis_bg.cpp

示例6: Draw

void SjOscTitle::Draw(wxDC& dc, const wxSize& clientSize, bool titleChanged, const wxString& newTitle)
{
	// client size changed?
	if( m_clientSize != clientSize )
	{
		m_clientSize = clientSize;

		// create new font
		int pt = clientSize.y / 20; if( pt < 7 ) pt = 7;
		m_font.SetPointSize(pt);

		// calculate new size
		CalcCurrTitleSize(dc);
	}

	// title changed?
	if( titleChanged )
	{
		if( m_currTitle.IsEmpty() )
		{
			m_currTitle = newTitle;
			CalcCurrTitleSize(dc);
			m_titleOp = TITLEOP_WIPEIN;
			m_titleWipe = 0.0F;
		}
		else if( m_titleOp == TITLEOP_WIPEIN )
		{
			m_nextTitle = newTitle; // fast switch - however, this only happens for very short tracks
			CalcCurrTitleSize(dc);
		}
		else if( newTitle != m_currTitle )
		{
			m_nextTitle = newTitle;
			CalcCurrTitleSize(dc);
			if( m_titleOp == TITLEOP_NOP )
			{
				m_titleOp = TITLEOP_WIPEOUT;
				m_titleWipe = 0.0F;
			}
		}
	}

	// draw the title
	dc.SetFont(m_font);

	// scroll?
	#define SCROLL_PIX 8
	#define SCROLL_INITIAL_WAIT_MS 2000
	#define SCROLL_LEFT_END_WAIT_MS 2000
	#define SCROLL_RIGHT_END_WAIT_MS 12000
	if( m_scroll == SCROLL_WAIT )
	{
		m_scrollCnt--;
		if( m_scrollCnt <= 0 )
		{
			m_scroll = m_currTitleX<0? SCROLL_RIGHT : SCROLL_LEFT;
		}
	}
	else if( m_scroll == SCROLL_LEFT )
	{
		m_currTitleX -= SCROLL_PIX;
		if( m_currTitleX+m_currTitleW <= m_clientSize.x )
		{
			m_scroll = SCROLL_WAIT;
			m_scrollCnt = (SCROLL_LEFT_END_WAIT_MS / SLEEP_MS);
		}
	}
	else if( m_scroll == SCROLL_RIGHT )
	{
		m_currTitleX += SCROLL_PIX;
		if( m_currTitleX >= 0 )
		{
			m_scroll = SCROLL_WAIT;
			m_scrollCnt = (SCROLL_RIGHT_END_WAIT_MS / SLEEP_MS);
		}
	}

	// apply our wipe effect
	if( m_titleOp )
	{
		m_titleWipe += 1.0L/(double)SLEEP_MS;

		wxRect wipeRect(0, m_currTitleY, m_clientSize.x, m_currTitleH);

		if( m_titleOp == TITLEOP_WIPEIN )
		{
			wipeRect.width = (int) ( wipeRect.width * m_titleWipe );
		}
		else
		{
			wipeRect.x = (int) ( wipeRect.width * m_titleWipe );
		}

		// clip out the wipe rectangle and draw the text
		//dc.DrawRectangle(wipeRect);
		dc.SetClippingRegion(wipeRect);
		dc.DrawText(m_currTitle, m_currTitleX, m_currTitleY);
		dc.DestroyClippingRegion();

		// this wipe done?
//.........这里部分代码省略.........
开发者ID:antonivich,项目名称:Silverjuke,代码行数:101,代码来源:vis_oscilloscope.cpp


注:本文中的wxFont::SetPointSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。