本文整理汇总了C++中FontInfo类的典型用法代码示例。如果您正苦于以下问题:C++ FontInfo类的具体用法?C++ FontInfo怎么用?C++ FontInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FontInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void View::DrawPgHeader(DeviceContext *dc, RunningElement *pgHeader)
{
assert(dc);
assert(pgHeader);
dc->StartGraphic(pgHeader, "", pgHeader->GetUuid());
FontInfo pgHeadTxt;
TextDrawingParams params;
// If we have not timestamp
params.m_x = pgHeader->GetDrawingX();
params.m_y = pgHeader->GetDrawingY();
params.m_width = pgHeader->GetWidth();
params.m_alignment = HORIZONTALALIGNMENT_NONE;
params.m_laidOut = true;
params.m_pointSize = m_doc->GetDrawingLyricFont(100)->GetPointSize();
pgHeadTxt.SetPointSize(params.m_pointSize);
dc->SetBrush(m_currentColour, AxSOLID);
dc->SetFont(&pgHeadTxt);
DrawRunningChildren(dc, pgHeader, params);
dc->ResetFont();
dc->ResetBrush();
dc->EndGraphic(pgHeader, this);
}
示例2: assert
void View::DrawLyricString ( DeviceContext *dc, int x, int y, std::wstring s, int staffSize)
{
assert( dc );
dc->StartText( ToDeviceContextX( x ), ToDeviceContextY( y ) );
std::wistringstream iss( s );
std::wstring token;
while( std::getline( iss, token, L'_' ))
{
dc->DrawText( UTF16to8( token.c_str() ), token );
// no _
if (iss.eof())
break;
FontInfo vrvTxt;
vrvTxt.SetFaceName("VerovioText");
vrvTxt.SetPointSize( m_doc->GetDrawingLyricFont(staffSize)->GetPointSize() );
dc->SetFont( &vrvTxt );
dc->VrvTextFont();
std::wstring str;
str.push_back(VRV_TEXT_E551);
dc->DrawText( UTF16to8( str.c_str() ), str );
dc->ResetFont();
}
//std::wcout << std::endl;
dc->EndText( );
}
示例3: change_
ColorChanger::ColorChanger(FontInfo & font, ColorCode color,
bool really_change_color)
: Changer<FontInfo, ColorCode>(font, font.color()), change_(really_change_color)
{
if (change_) {
font.setColor(color);
}
}
示例4: 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());
}
示例5: getBar
static FontState getBar(FontInfo const & fi)
{
if (fi.emph() == FONT_TOGGLE)
return EMPH_TOGGLE;
if (fi.underbar() == FONT_TOGGLE)
return UNDERBAR_TOGGLE;
if (fi.strikeout() == FONT_TOGGLE)
return STRIKEOUT_TOGGLE;
if (fi.uuline() == FONT_TOGGLE)
return UULINE_TOGGLE;
if (fi.uwave() == FONT_TOGGLE)
return UWAVE_TOGGLE;
if (fi.noun() == FONT_TOGGLE)
return NOUN_TOGGLE;
if (fi.emph() == FONT_IGNORE
&& fi.underbar() == FONT_IGNORE
&& fi.noun() == FONT_IGNORE)
return IGNORE;
return INHERIT;
}
示例6: dimension
void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
{
Dimension const dim = dimension(*pi.base.bv);
x += ADD_TO_VSPACE_WIDTH;
int const start = y - dim.asc;
int const end = y + dim.des;
// y-values for top arrow
int ty1, ty2;
// y-values for bottom arrow
int by1, by2;
if (space_.kind() == VSpace::VFILL) {
ty1 = ty2 = start;
by1 = by2 = end;
} else {
// adding or removing space
bool const added = space_.kind() != VSpace::LENGTH ||
space_.length().len().value() >= 0.0;
ty1 = added ? (start + vspace_arrow_size) : start;
ty2 = added ? start : (start + vspace_arrow_size);
by1 = added ? (end - vspace_arrow_size) : end;
by2 = added ? end : (end - vspace_arrow_size);
}
int const midx = x + vspace_arrow_size;
int const rightx = midx + vspace_arrow_size;
// first the string
int w = 0;
int a = 0;
int d = 0;
FontInfo font;
font.setColor(Color_added_space);
font.decSize();
font.decSize();
docstring const lab = label();
theFontMetrics(font).rectText(lab, w, a, d);
pi.pain.rectText(x + 2 * vspace_arrow_size + 5,
start + (end - start) / 2 + (a - d) / 2,
lab, font, Color_none, Color_none);
// top arrow
pi.pain.line(x, ty1, midx, ty2, Color_added_space);
pi.pain.line(midx, ty2, rightx, ty1, Color_added_space);
// bottom arrow
pi.pain.line(x, by1, midx, by2, Color_added_space);
pi.pain.line(midx, by2, rightx, by1, Color_added_space);
// joining line
pi.pain.line(midx, ty2, midx, by2, Color_added_space);
}
示例7: getLayout
FontInfo InsetNote::getFont() const
{
FontInfo font = getLayout().font();
// FIXME: This hardcoded color is a hack!
if (params_.type == InsetNoteParams::Greyedout
&& buffer().params().notefontcolor != lyx::rgbFromHexName("#cccccc")) {
ColorCode c = lcolor.getFromLyXName("notefontcolor");
if (c != Color_none)
font.setColor(c);
}
return font;
}
示例8: GuiDialog
GuiDelimiter::GuiDelimiter(GuiView & lv)
: GuiDialog(lv, "mathdelimiter", qt_("Math Delimiter"))
{
setupUi(this);
connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));
setFocusProxy(leftLW);
leftLW->setViewMode(QListView::IconMode);
rightLW->setViewMode(QListView::IconMode);
leftLW->setDragDropMode(QAbstractItemView::NoDragDrop);
rightLW->setDragDropMode(QAbstractItemView::NoDragDrop);
initMathSymbols();
typedef map<char_type, QListWidgetItem *> ListItems;
ListItems list_items;
// The last element is the empty one.
int const end = nr_latex_delimiters - 1;
for (int i = 0; i < end; ++i) {
string const delim = latex_delimiters[i];
MathSymbol const & ms = mathSymbol(delim);
QString symbol(ms.fontcode?
QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
QListWidgetItem * lwi = new QListWidgetItem(symbol);
lwi->setToolTip(toqstr(delim));
FontInfo lyxfont;
lyxfont.setFamily(ms.fontfamily);
lwi->setFont(frontend::getFont(lyxfont));
list_items[ms.unicode] = lwi;
leftLW->addItem(lwi);
}
for (int i = 0; i != leftLW->count(); ++i) {
MathSymbol const & ms = mathSymbol(
fromqstr(leftLW->item(i)->toolTip()));
rightLW->addItem(list_items[doMatch(ms.unicode)]->clone());
}
// The last element is the empty one.
leftLW->addItem(qt_("(None)"));
rightLW->addItem(qt_("(None)"));
sizeCO->addItem(qt_("Variable"));
for (int i = 0; *biggui[i]; ++i)
sizeCO->addItem(qt_(biggui[i]));
on_leftLW_currentRowChanged(0);
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
}
示例9: draw
void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
{
FontInfo font = pi.base.font;
augmentFont(font, from_ascii("mathnormal"));
font.setShape(UP_SHAPE);
font.setColor(Color_latex);
Dimension t = theFontMetrics(font).dimension('{');
pi.pain.text(x, y, '{', font);
cell(0).draw(pi, x + t.wid, y);
Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
pi.pain.text(x + t.wid + dim0.width(), y, '}', font);
drawMarkers(pi, x, y);
}
示例10: m_pGui
/**
* @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);
}
示例11: paintTextDecoration
void RowPainter::paintTextDecoration(Row::Element const & e) const
{
// element selected?
bool const sel = (e.pos >= row_.sel_beg && e.endpos <= row_.sel_end)
|| pi_.selected;
FontInfo copy = e.font.fontInfo();
if (sel || e.change.changed()) {
Color const col = e.change.changed() ? e.change.color()
: Color_selectiontext;
copy.setPaintColor(col);
}
pi_.pain.textDecoration(copy, int(x_), yo_, int(e.full_width()));
}
示例12: draw
void RenderButton::draw(PainterInfo & pi, int x, int y) const
{
// Draw it as a box with the LaTeX text
FontInfo font = sane_font;
font.setColor(Color_command);
font.decSize();
if (editable_) {
pi.pain.buttonText(x + 1, y, text_, font, renderState());
} else {
pi.pain.rectText(x + 1, y, text_, font,
Color_commandbg, Color_commandframe);
}
}
示例13: metrics
void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
{
FontInfo font = sane_font;
font.decSize();
frontend::FontMetrics const & fm =
theFontMetrics(font);
if (editable_)
fm.buttonText(text_, dim.wid, dim.asc, dim.des);
else
fm.rectText(text_, dim.wid, dim.asc, dim.des);
dim.wid += 2;
dim_ = dim;
}
示例14: GetSize
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++;
}
}
示例15: Grayscale
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);
}