本文整理汇总了C++中QRawFont::advancesForGlyphIndexes方法的典型用法代码示例。如果您正苦于以下问题:C++ QRawFont::advancesForGlyphIndexes方法的具体用法?C++ QRawFont::advancesForGlyphIndexes怎么用?C++ QRawFont::advancesForGlyphIndexes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRawFont
的用法示例。
在下文中一共展示了QRawFont::advancesForGlyphIndexes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Rest::draw(QPainter* painter) const
{
if ( (staff() && staff()->isTabStaff()
// in tab staff, do not draw rests is rests are off OR if dur. symbols are on
&& ( !((StaffTypeTablature*)staff()->staffType())->showRests()
|| ((StaffTypeTablature*)staff()->staffType())->genDurations()) )
|| generated())
return;
qreal _spatium = spatium();
painter->setPen(curColor());
if (parent() && measure() && measure()->multiMeasure()) {
Measure* m = measure();
int n = m->multiMeasure();
qreal pw = _spatium * .7;
QPen pen(painter->pen());
pen.setWidthF(pw);
painter->setPen(pen);
qreal w = _mmWidth;
qreal y = 0.0;
qreal x1 = 0.0;
qreal x2 = w;
pw *= .5;
painter->drawLine(QLineF(x1 + pw, y, x2 - pw, y));
// draw vertical lines:
pen.setWidthF(_spatium * .2);
painter->setPen(pen);
painter->drawLine(QLineF(x1, y-_spatium, x1, y+_spatium));
painter->drawLine(QLineF(x2, y-_spatium, x2, y+_spatium));
#ifdef USE_GLYPHS
QRawFont rfont = fontId2RawFont(0);
rfont.setPixelSize(20.0 * spatium()/(PPI * SPATIUM20));
QGlyphRun glyphs;
QVector<quint32> idx = rfont.glyphIndexesForString(QString("%1").arg(n));
glyphs.setGlyphIndexes(idx);
QVector<QPointF> adv = rfont.advancesForGlyphIndexes(idx);
adv.insert(0, QPointF());
glyphs.setPositions(adv);
glyphs.setRawFont(rfont);
QRectF r = glyphs.boundingRect();
y = -_spatium * .5;
painter->drawGlyphRun(QPointF((x2 - x1) * .5 + x1 - r.width() * .5, y), glyphs);
#else
QFont font = fontId2font(0);
font.setPixelSize(lrint(20.0 * spatium()/(PPI * SPATIUM20)));
painter->setFont(font);
QFontMetricsF fm(font);
// y = -_spatium * .5 - (staff()->height()*.5) - fm.ascent();
y = -_spatium * .5 - fm.ascent();
painter->drawText(QRectF(center(x1, x2), y, .0, .0),
Qt::AlignHCenter|Qt::TextDontClip,
QString("%1").arg(n));
#endif
}
else {
qreal mag = magS();
symbols[score()->symIdx()][_sym].draw(painter, mag);
int dots = durationType().dots();
if (dots) {
qreal y = dotline * _spatium * .5;
for (int i = 1; i <= dots; ++i) {
qreal x = symbols[score()->symIdx()][_sym].width(mag)
+ point(score()->styleS(ST_dotNoteDistance)) * i;
symbols[score()->symIdx()][dotSym].draw(painter, mag, QPointF(x, y));
}
}
}
}