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


C++ FontInfo::GetHeight方法代码示例

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


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

示例1: Paint

void AppPreview::Paint(Draw& w)
{
	Size sz = GetSize();
	FontInfo fi = CourierZ(12).Info();
	int y = 0;
	int i = sb;
	while(y < sz.cy) {
		bool hdr = i < line.GetCount() && line[i].header;
		w.DrawRect(0, y, sz.cx, fi.GetHeight(), hdr ? LtCyan : SColorPaper);
		if(i < line.GetCount())
			w.DrawText(0, y, line[i].text, hdr ? ArialZ(12).Bold().Italic() : CourierZ(12), SColorText);
		y += fi.GetHeight();
		i++;
	}
}
开发者ID:kolyden,项目名称:mirror,代码行数:15,代码来源:Template.cpp

示例2: GetStdSize

Size FileList::GetStdSize(const Value& q) const
{
	const File& m = ValueTo<File>(q);
	FontInfo fi = m.font.Info();
	int cx = GetTextSize(fi, WString(m.name)) + 2 + iconwidth + 2 + 3;
	if(!IsNull(m.desc))
		cx += GetTextSize(m.descfont.Info(), WString(m.desc)) + fi.GetHeight();
	return Size(cx, GetItemHeight());
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:9,代码来源:FileList.cpp

示例3: Load

/**
*  @brief
*    Constructor
*/
Font::Font(Gui &cGui, const FontInfo &cFontInfo) :
	m_pGui(&cGui),
	m_pFontImpl(nullptr),
	m_sFamily(cFontInfo.GetFamily()),
	m_nHeight(cFontInfo.GetHeight()),
	m_nWeight(cFontInfo.GetWeight()),
	m_nStyle(cFontInfo.GetStyle()),
	m_sFilename(cFontInfo.GetFilename())
{
	// Load font
	if (m_sFilename.GetLength() > 0) LoadFromFile(m_sFilename, m_nHeight);
	else							 Load(m_sFamily, m_nHeight, m_nWeight, m_nStyle);
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:17,代码来源:Font.cpp

示例4: Paint

void FileList::Paint(Draw& w, const Rect& r, const Value& q,
		             Color ink, Color paper, dword style) const
{
	const File& m = ValueTo<File>(q);
	bool dark = Grayscale(paper) < 150;
	w.DrawRect(r, paper);
	int x = r.left + 2;
	w.DrawImage(x, r.top + (r.Height() - m.icon.GetSize().cy) / 2, m.icon);
	x += iconwidth;
	x += 2;
	FontInfo fi = m.font.Info();
	DrawFileName(w, x, r.top + (r.Height() - fi.GetHeight()) / 2,
	             r.right - x - 2, r.Height(), WString(m.name), m.isdir, m.font,
	             dark ? SColorHighlightText : m.ink,
	             dark ? SColorHighlightText : m.extink,
	             WString(m.desc), m.descfont, justname, m.underline);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:17,代码来源:FileList.cpp

示例5: GetTextSize

Size GetTextSize(const wchar *text, Font font, int n)
{
#if defined(flagWINGL) || defined(flagLINUXGL)
	return GetTextSize(text, resources.GetFont(font), n);
#else
	FontInfo fi = font.Info();
	if(n < 0)
		n = wstrlen(text);
	Size sz;
	sz.cx = 0;
	const wchar *wtext = (const wchar *)text;
	while(n > 0) {
		sz.cx += fi[*wtext++];
		n--;
	}
	sz.cy = fi.GetHeight();
	return sz;
#endif
}
开发者ID:koz4k,项目名称:soccer,代码行数:19,代码来源:DrawText.cpp

示例6: GetFontSize

Size LineEdit::GetFontSize() const {
	FontInfo fi = font.Info();
	return Size(max(fi['M'], fi['W']), fi.GetHeight());
}
开发者ID:pedia,项目名称:raidget,代码行数:4,代码来源:LineEdit.cpp

示例7: DrawFileName

void DrawFileName(Draw& ww, int x0, int y, int wcx0, int cy, const WString& mname, bool isdir, Font font,
                  Color ink, Color extink, const WString& desc, Font descfont, bool justname, Color uln)
{
	for(int pass = IsNull(uln); pass < 2; pass++) {
		NilDraw nd;
		Draw *w = pass ? &ww : &nd;
		FontInfo fi = font.Info();
		int extpos = (isdir ? -1 : mname.ReverseFind('.'));
		int slash = isdir ? -1 : max(mname.ReverseFind('\\'), mname.ReverseFind('/'));
		if(extpos < slash)
			extpos = -1;
		const wchar *ext = extpos >= slash && extpos >= 0 ? mname.Begin() + extpos + 1
		                                                  : mname.End();
		const wchar *name = mname;
		if(justname && slash >= 0)
			name += slash + 1;
		int txtcx = GetTextSize(fi, name);
		int x = x0;
		int wcx = wcx0;
		if(txtcx <= wcx) {
			if(pass == 0)
				ww.DrawRect(x0, y + fi.GetAscent() + 1, txtcx, 1, uln);
			ww.DrawText(x, y, name, font, ink, (int)(ext - name));
			ww.DrawText(x + GetTextSize(fi, name, ext), y, ext, font, extink, (int)(mname.End() - ext));
			if(!IsEmpty(desc) && pass)
				DrawTextEllipsis(ww, x + fi.GetHeight(), y, wcx - txtcx,
				                 desc, "...", descfont, extink);
			x += txtcx;
			return;
		}
		else {
			int dot3 = 3 * fi['.'];
			if(2 * dot3 > wcx) {
				int n = GetTextFitCount(fi, name, wcx);
				w->DrawText(x, y, name, font, ink, n);
				x += GetTextSize(fi, name, name + n);
			}
			else {
				const wchar *end = mname.End();
				int dircx = 2 * fi['.'] + fi[DIR_SEP];
				const wchar *bk = strdirsep(name);
				if(bk) {
					wcx -= dircx;
					w->DrawText(x, y, ".." DIR_SEPS, font, SColorDisabled, 3);
					x += dircx;
					do {
						txtcx -= GetTextSize(fi, name, bk + 1);
						name = bk + 1;
						if(txtcx < wcx) {
							w->DrawText(x, y, name, font, ink, (int)(ext - name));
							x += GetTextSize(fi, name, ext);
							w->DrawText(x, y, ext, font, extink, (int)(end - ext));
							x += GetTextSize(fi, ext, end);
							goto end;
						}
						bk = strdirsep(name);
					}
					while(bk);
				}
				wcx -= dot3;
				int extcx = GetTextSize(fi, ext, end);
				if(2 * extcx > wcx || ext == end) {
					int n = GetTextFitCount(fi, name, wcx);
					w->DrawText(x, y, name, font, ink, n);
					x += GetTextSize(fi, name, name + n);
					w->DrawText(x, y, "...", font, SColorDisabled, 3);
					x += dot3;
				}
				else {
					wcx -= extcx;
					int n = (int)(GetTextFitLim(fi, name, end, wcx) - name);
					w->DrawText(x, y, name, font, ink, n);
					x += GetTextSize(fi, name, name + n);
					w->DrawText(x, y, "...", font, SColorDisabled, 3);
					w->DrawText(x + dot3, y, ext, font, extink, (int)(end - ext));
					x += dot3 + extcx;
				}
			}
		}
	end:
		if(pass == 0)
			ww.DrawRect(x0, y + fi.GetAscent() + 1, x - x0, 1, uln);
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:84,代码来源:FileList.cpp


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