⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qfont.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    pitch off.    \sa fixedPitch(), QFontInfo*/void QFont::setFixedPitch(bool enable){    detach();    d->request.fixedPitch = enable;    d->request.ignorePitch = false;    resolve_mask |= QFontPrivate::FixedPitch;}/*!  Returns true if kerning should be used when drawing text with this font.  \sa setKerning()*/bool QFont::kerning() const{    return d->kerning;}/*!    Enables kerning for this font if \a enable is true; otherwise    disables it. By default, kerning is enabled.    When kerning is enabled, glyph metrics do not add up anymore,    even for Latin text. In other words, the assumption that    width('a') + width('b') is equal to width("ab") is not    neccesairly true.    \sa kerning(), QFontMetrics*/void QFont::setKerning(bool enable){    detach();    d->kerning = enable;    resolve_mask |= QFontPrivate::Kerning;}/*!    Returns the StyleStrategy.    The style strategy affects the \l{QFont}{font matching} algorithm.    See \l QFont::StyleStrategy for the list of available strategies.    \sa setStyleHint() QFont::StyleHint*/QFont::StyleStrategy QFont::styleStrategy() const{    return (StyleStrategy) d->request.styleStrategy;}/*!    Returns the StyleHint.    The style hint affects the \l{QFont}{font matching} algorithm.    See \l QFont::StyleHint for the list of available hints.    \sa setStyleHint(), QFont::StyleStrategy QFontInfo::styleHint()*/QFont::StyleHint QFont::styleHint() const{    return (StyleHint) d->request.styleHint;}/*!    \enum QFont::StyleHint    Style hints are used by the \l{QFont}{font matching} algorithm to    find an appropriate default family if a selected font family is    not available.    \value AnyStyle leaves the font matching algorithm to choose the           family. This is the default.    \value SansSerif the font matcher prefer sans serif fonts.    \value Helvetica is a synonym for \c SansSerif.    \value Serif the font matcher prefers serif fonts.    \value Times is a synonym for \c Serif.    \value TypeWriter the font matcher prefers fixed pitch fonts.    \value Courier a synonym for \c TypeWriter.    \value OldEnglish the font matcher prefers decorative fonts.    \value Decorative is a synonym for \c OldEnglish.    \value System the font matcher prefers system fonts.*//*!    \enum QFont::StyleStrategy    The style strategy tells the \l{QFont}{font matching} algorithm    what type of fonts should be used to find an appropriate default    family.    The following strategies are available:    \value PreferDefault the default style strategy. It does not prefer           any type of font.    \value PreferBitmap prefers bitmap fonts (as opposed to outline           fonts).    \value PreferDevice prefers device fonts.    \value PreferOutline prefers outline fonts (as opposed to bitmap fonts).    \value ForceOutline forces the use of outline fonts.    \value NoAntialias don't antialias the fonts.    \value PreferAntialias antialias if possible.    \value OpenGLCompatible forces the use of OpenGL compatible           fonts.    \value NoFontMerging If a font does not contain a character requested           to draw then Qt automatically chooses a similar looking for that contains           the character. This flag disables this feature.    Any of these may be OR-ed with one of these flags:    \value PreferMatch prefer an exact match. The font matcher will try to           use the exact font size that has been specified.    \value PreferQuality prefer the best quality font. The font matcher           will use the nearest standard point size that the font           supports.*//*!    Sets the style hint and strategy to \a hint and \a strategy,    respectively.    If these aren't set explicitly the style hint will default to    \c AnyStyle and the style strategy to \c PreferDefault.    Qt does not support style hints on X11 since this information    is not provided by the window system.    \sa StyleHint, styleHint(), StyleStrategy, styleStrategy(), QFontInfo*/void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy){    detach();    if ((resolve_mask & (QFontPrivate::StyleHint | QFontPrivate::StyleStrategy)) &&         (StyleHint) d->request.styleHint == hint &&         (StyleStrategy) d->request.styleStrategy == strategy)        return;    d->request.styleHint = hint;    d->request.styleStrategy = strategy;    resolve_mask |= QFontPrivate::StyleHint;    resolve_mask |= QFontPrivate::StyleStrategy;#if defined(Q_WS_X11)    d->request.addStyle.clear();#endif // Q_WS_X11}/*!    Sets the style strategy for the font to \a s.    \sa QFont::StyleStrategy*/void QFont::setStyleStrategy(StyleStrategy s){    detach();    if ((resolve_mask & QFontPrivate::StyleStrategy) &&         s == (StyleStrategy)d->request.styleStrategy)        return;    d->request.styleStrategy = s;    resolve_mask |= QFontPrivate::StyleStrategy;}/*!    \enum QFont::Stretch    Predefined stretch values that follow the CSS naming convention. The higher    the value, the more stretched the text is.    \value UltraCondensed 50    \value ExtraCondensed 62    \value Condensed 75    \value SemiCondensed 87    \value Unstretched 100    \value SemiExpanded 112    \value Expanded 125    \value ExtraExpanded 150    \value UltraExpanded 200    \sa setStretch() stretch()*//*!    Returns the stretch factor for the font.    \sa setStretch() */int QFont::stretch() const{    return d->request.stretch;}/*!    Sets the stretch factor for the font.    The stretch factor changes the width of all characters in the font    by \a factor percent.  For example, setting \a factor to 150    results in all characters in the font being 1.5 times (ie. 150%)    wider.  The default stretch factor is 100.  The minimum stretch    factor is 1, and the maximum stretch factor is 4000.    The stretch factor is only applied to outline fonts.  The stretch    factor is ignored for bitmap fonts.    NOTE: QFont cannot stretch XLFD fonts.  When loading XLFD fonts on    X11, the stretch factor is matched against a predefined set of    values for the SETWIDTH_NAME field of the XLFD.    \sa stretch() QFont::Stretch*/void QFont::setStretch(int factor){    if (factor < 1 || factor > 4000) {        qWarning("QFont::setStretch: Parameter '%d' out of range", factor);        return;    }    detach();    if ((resolve_mask & QFontPrivate::Stretch) &&         d->request.stretch == (uint)factor)        return;    d->request.stretch = (uint)factor;    resolve_mask |= QFontPrivate::Stretch;}/*!    If \a enable is true, turns raw mode on; otherwise turns raw mode    off. This function only has an effect under X11.    If raw mode is enabled, Qt will search for an X font with a    complete font name matching the family name, ignoring all other    values set for the QFont. If the font name matches several fonts,    Qt will use the first font returned by X. QFontInfo \e cannot be    used to fetch information about a QFont using raw mode (it will    return the values set in the QFont for all parameters, including    the family name).    \warning Do not use raw mode unless you really, really need it! In    most (if not all) cases, setRawName() is a much better choice.    \sa rawMode(), setRawName()*/void QFont::setRawMode(bool enable){    detach();    if ((bool) d->rawMode == enable) return;    d->rawMode = enable;}/*!    Returns true if a window system font exactly matching the settings    of this font is available.    \sa QFontInfo*/bool QFont::exactMatch() const{    QFontEngine *engine = d->engineForScript(QUnicodeTables::Common);    Q_ASSERT(engine != 0);    return (d->rawMode            ? engine->type() != QFontEngine::Box            : d->request.exactMatch(engine->fontDef));}/*!    Returns true if this font is equal to \a f; otherwise returns    false.    Two QFonts are considered equal if their font attributes are    equal. If rawMode() is enabled for both fonts, only the family    fields are compared.    \sa operator!=() isCopyOf()*/bool QFont::operator==(const QFont &f) const{    return (f.d == d            || (f.d->request   == d->request                && f.d->request.pointSize == d->request.pointSize                && f.d->underline == d->underline                && f.d->overline  == d->overline                && f.d->strikeOut == d->strikeOut                && f.d->kerning == d->kerning));}/*!    Provides an arbitrary comparison of this font and font \a f.    All that is guaranteed is that the operator returns false if both    fonts are equal and that (f1 \< f2) == !(f2 \< f1) if the fonts    are not equal.    This function is useful in some circumstances, for example if you    want to use QFont objects as keys in a QMap.    \sa operator==() operator!=() isCopyOf()*/bool QFont::operator<(const QFont &f) const{    if (f.d == d) return false;    // the < operator for fontdefs ignores point sizes.    QFontDef &r1 = f.d->request;    QFontDef &r2 = d->request;    if (r1.pointSize != r2.pointSize) return r1.pointSize < r2.pointSize;    if (r1.pixelSize != r2.pixelSize) return r1.pixelSize < r2.pixelSize;    if (r1.weight != r2.weight) return r1.weight < r2.weight;    if (r1.style != r2.style) return r1.style < r2.style;    if (r1.stretch != r2.stretch) return r1.stretch < r2.stretch;    if (r1.styleHint != r2.styleHint) return r1.styleHint < r2.styleHint;    if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy;    if (r1.family != r2.family) return r1.family < r2.family;#ifdef Q_WS_X11    if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;#endif // Q_WS_X11    int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;    int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;    return f1attrs < f2attrs;}/*!    Returns true if this font is different from \a f; otherwise    returns false.    Two QFonts are considered to be different if their font attributes    are different. If rawMode() is enabled for both fonts, only the    family fields are compared.    \sa operator==()*/bool QFont::operator!=(const QFont &f) const{    return !(operator==(f));}/*!   Returns the font as a QVariant*/QFont::operator QVariant() const{    return QVariant(QVariant::Font, this);}/*!    Returns true if this font and \a f are copies of each other, i.e.    one of them was created as a copy of the other and neither has    been modified since. This is much stricter than equality.    \sa operator=() operator==()*/bool QFont::isCopyOf(const QFont & f) const{    return d == f.d;}/*!    Returns true if raw mode is used for font name matching; otherwise    returns false.    \sa setRawMode() rawName()*/bool QFont::rawMode() const{    return d->rawMode;}/*!    Returns a new QFont that has attributes copied from \a other that    have not been previously set on this font.*/QFont QFont::resolve(const QFont &other) const{    if (*this == other        && (resolve_mask == other.resolve_mask || resolve_mask == 0)        && d->dpi == other.d->dpi) {        QFont o = other;        o.resolve_mask = resolve_mask;        return o;    }    QFont font(*this);    font.detach();    font.d->resolve(resolve_mask, other.d);    return font;}/*!    \fn uint QFont::resolve() const    \internal*//*!    \fn void QFont::resolve(uint mask)    \internal*/#ifdef QT3_SUPPORT/*! \obsolete  Please use QApplication::font() instead.*/QFont QFont::defaultFont(){    return QApplication::font();}/*! \obsolete  Please use QApplication::setFont() instead.*/void QFont::setDefaultFont(const QFont &f){    QApplication::setFont(f);}/*!    \fn qreal QFont::pointSizeFloat() const    \compat    Use pointSizeF() instead.*//*!    \fn void QFont::setPointSizeFloat(qreal size)    \compat    Use setPointSizeF() instead.*/#endif/*****************************************************************************  QFont substitution management *****************************************************************************/typedef QHash<QString, QStringList> QFontSubst;Q_GLOBAL_STATIC(QFontSubst, globalFontSubst)// create substitution dictstatic void initFontSubst(){    // default substitutions    static const char *initTbl[] = {#if defined(Q_WS_X11)        "arial",        "helvetica",        "times new roman", "times",        "courier new",  "courier",        "sans serif",   "helvetica",#elif defined(Q_WS_WIN)        "times",        "times new roman",        "courier",      "courier new",        "helvetica",    "arial",        "sans serif",   "arial",#endif        0,              0    };    QFontSubst *fontSubst = globalFontSubst();    Q_ASSERT(fontSubst != 0);    if (!fontSubst->isEmpty())

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -