📄 qfont.3qt
字号:
If you had both an Adobe and a Cronyx Helvetica, you might get either..PP.nf.br QFont f1( "Helvetica [Cronyx]" ); // Qt 3.x.br QFont f2( "Cronyx-Helvetica" ); // Qt 2.x compatibility.br.fiYou can specify the foundry you want in the family name. Both fonts, f1 and f2, in the above example will be set to "Helvetica [Cronyx]"..PPTo determine the attributes of the font actually used in the window system, use a QFontInfo object, e.g..PP.nf.br QFontInfo info( f1 );.br QString family = info.family();.br.fi.PPTo find out font metrics use a QFontMetrics object, e.g..PP.nf.br QFontMetrics fm( f1 );.br int pixelWidth = fm.width( "How many pixels wide is this text?" );.br int pixelHeight = fm.height();.br.fi.PPFor more general information on fonts, see the comp.fonts FAQ. Information on encodings can be found from Roman Czyborra's page..PPSee also QFontMetrics, QFontInfo, QFontDatabase, QApplication::setFont(), QWidget::font, QPainter::setFont(), QFont::StyleHint, QFont::Weight, Widget Appearance and Style, Graphics Classes, and Implicitly and Explicitly Shared Classes..SS "Member Type Documentation".SH "QFont::Script"This enum represents Unicode allocated scripts. For exhaustive coverage see The Unicode Standard Version 3.0. The following scripts are supported:.PPModern European alphabetic scripts (left to right):.TP\fCQFont::Latin\fR - consists of most alphabets based on the original Latin alphabet..TP\fCQFont::Greek\fR - covers ancient and modern Greek and Coptic..TP\fCQFont::Cyrillic\fR - covers the Slavic and non-Slavic languages using cyrillic alphabets..TP\fCQFont::Armenian\fR - contains the Armenian alphabet used with the Armenian language..TP\fCQFont::Georgian\fR - covers at least the language Georgian..TP\fCQFont::Runic\fR - covers the known constituents of the Runic alphabets used by the early and medieval societies in the Germanic, Scandinavian, and Anglo-Saxon areas..TP\fCQFont::Ogham\fR - is an alphabetical script used to write a very early form of Irish..TP\fCQFont::SpacingModifiers\fR - are small signs indicating modifications to the preceeding letter..TP\fCQFont::CombiningMarks\fR - consist of diacritical marks not specific to a particular alphabet, diacritical marks used in combination with mathematical and technical symbols, and glyph encodings applied to multiple letterforms..PPMiddle Eastern scripts (right to left):.TP\fCQFont::Hebrew\fR - is used for writing Hebrew, Yiddish, and some other languages..TP\fCQFont::Arabic\fR - covers the Arabic language as well as Persian, Urdu, Kurdish and some others..TP\fCQFont::Syriac\fR - is used to write the active liturgical languages and dialects of several Middle Eastern and Southeast Indian communities..TP\fCQFont::Thaana\fR - is used to write the Maledivian Dhivehi language..PPSouth and Southeast Asian scripts (left to right with few historical exceptions):.TP\fCQFont::Devanagari\fR - covers classical Sanskrit and modern Hindi as well as several other languages..TP\fCQFont::Bengali\fR - is a relative to Devanagari employed to write the Bengali language used in West Bengal/India and Bangladesh as well as several minority languages..TP\fCQFont::Gurmukhi\fR - is another Devanagari relative used to write Punjabi..TP\fCQFont::Gujarati\fR - is closely related to Devanagari and used to write the Gujarati language of the Gujarat state in India..TP\fCQFont::Oriya\fR - is used to write the Oriya language of Orissa state/India..TP\fCQFont::Tamil\fR - is used to write the Tamil language of Tamil Nadu state/India, Sri Lanka, Singapore and parts of Malaysia as well as some minority languages..TP\fCQFont::Telugu\fR - is used to write the Telugu language of Andhra Pradesh state/India and some minority languages..TP\fCQFont::Kannada\fR - is another South Indian script used to write the Kannada language of Karnataka state/India and some minority languages..TP\fCQFont::Malayalam\fR - is used to write the Malayalam language of Kerala state/India..TP\fCQFont::Sinhala\fR - is used for Sri Lanka's majority language Sinhala and is also employed to write Pali, Sanskrit, and Tamil..TP\fCQFont::Thai\fR - is used to write Thai and other Southeast Asian languages..TP\fCQFont::Lao\fR - is a language and script quite similar to Thai..TP\fCQFont::Tibetan\fR - is the script used to write Tibetan in several countries like Tibet, the bordering Indian regions and Nepal. It is also used in the Buddist philosophy and liturgy of the Mongolian cultural area..TP\fCQFont::Myanmar\fR - is mainly used to write the Burmese language of Myanmar (former Burma)..TP\fCQFont::Khmer\fR - is the official language of Kampuchea..PPEast Asian scripts (traditionally top-down, right to left, modern often horizontal left to right):.TP\fCQFont::Han\fR - consists of the CJK (Chinese, Japanese, Korean) idiographic characters..TP\fCQFont::Hiragana\fR - is a cursive syllabary used to indicate phonetics and pronounciation of Japanese words..TP\fCQFont::Katakana\fR - is a non-cursive syllabic script used to write Japanese words with visual emphasis and non-Japanese words in a phonetical manner..TP\fCQFont::Hangul\fR - is a Korean script consisting of alphabetic components..TP\fCQFont::Bopomofo\fR - is a phonetic alphabet for Chinese (mainly Mandarin)..TP\fCQFont::Yi\fR - (also called Cuan or Wei) is a syllabary used to write the Yi language of Southwestern China, Myanmar, Laos, and Vietnam..PPAdditional scripts that do not fit well into the script categories above:.TP\fCQFont::Ethiopic\fR - is a syllabary used by several Central East African languages..TP\fCQFont::Cherokee\fR - is a left-to-right syllabic script used to write the Cherokee language..TP\fCQFont::CanadianAboriginal\fR - consists of the syllabics used by some Canadian aboriginal societies..TP\fCQFont::Mongolian\fR - is the traditional (and recently reintroduced) script used to write Mongolian..PPSymbols:.TP\fCQFont::CurrencySymbols\fR - contains currency symbols not encoded in other scripts..TP\fCQFont::LetterlikeSymbols\fR - consists of symbols derived from ordinary letters of an alphabetical script..TP\fCQFont::NumberForms\fR - are provided for compatibility with other existing character sets..TP\fCQFont::MathematicalOperators\fR - consists of encodings for operators, relations and other symbols like arrows used in a mathematical context..TP\fCQFont::TechnicalSymbols\fR - contains representations for control codes, the space symbol, APL symbols and other symbols mainly used in the context of electronic data processing..TP\fCQFont::GeometricSymbols\fR - covers block elements and geometric shapes..TP\fCQFont::MiscellaneousSymbols\fR - consists of a heterogeneous collection of symbols that do not fit any other Unicode character block, e.g. Dingbats..TP\fCQFont::EnclosedAndSquare\fR - is provided for compatibility with some East Asian standards..TP\fCQFont::Braille\fR - is an international writing system used by blind people. This script encodes the 256 eight-dot patterns with the 64 six-dot patterns as a subset..TP\fCQFont::Unicode\fR - includes all the above scripts..PPThe values below are provided for completeness and must \fInot\fR be used in user programs..TP\fCQFont::HanX11\fR - For internal use only..TP\fCQFont::LatinBasic\fR - For internal use only..TP\fCQFont::LatinExtendedA_2\fR - For internal use only..TP\fCQFont::LatinExtendedA_3\fR - For internal use only..TP\fCQFont::LatinExtendedA_4\fR - For internal use only..TP\fCQFont::LatinExtendedA_14\fR - For internal use only..TP\fCQFont::LatinExtendedA_15\fR - For internal use only..TP\fCQFont::KatakanaHalfWidth\fR - For internal use only..TP\fCQFont::LastPrivateScript\fR - For internal use only..TP\fCQFont::NScripts\fR - For internal use only..TP\fCQFont::NoScript\fR - For internal use only..TP\fCQFont::UnknownScript\fR - For internal use only..SH "QFont::StyleHint"Style hints are used by the font matching algorithm to find an appropriate default family if a selected font family is not available..TP\fCQFont::AnyStyle\fR - leaves the font matching algorithm to choose the family. This is the default..TP\fCQFont::SansSerif\fR - the font matcher prefer sans serif fonts..TP\fCQFont::Helvetica\fR - is a synonym for SansSerif..TP\fCQFont::Serif\fR - the font matcher prefers serif fonts..TP\fCQFont::Times\fR - is a synonym for Serif..TP\fCQFont::TypeWriter\fR - the font matcher prefers fixed pitch fonts..TP\fCQFont::Courier\fR - a synonym for TypeWriter..TP\fCQFont::OldEnglish\fR - the font matcher prefers decorative fonts..TP\fCQFont::Decorative\fR - is a synonym for OldEnglish..TP\fCQFont::System\fR - the font matcher prefers system fonts..SH "QFont::StyleStrategy"The style strategy tells the font matching algorithm what type of fonts should be used to find an appropriate default family..PPThe following strategies are available:.TP\fCQFont::PreferDefault\fR - the default style strategy. It does not prefer any type of font..TP\fCQFont::PreferBitmap\fR - prefers bitmap fonts (as opposed to outline fonts). On X11, this will cause Qt to disregard fonts from the Xft font extension..TP\fCQFont::PreferDevice\fR - prefers device fonts..TP\fCQFont::PreferOutline\fR - prefers outline fonts (as opposed to bitmap fonts)..TP\fCQFont::ForceOutline\fR - forces the use of outline fonts..TP\fCQFont::NoAntialias\fR - don't antialias the fonts..TP\fCQFont::PreferAntialias\fR - antialias if possible..PPAny of these may be OR-ed with one of these flags:.TP\fCQFont::PreferMatch\fR - prefer an exact match. The font matcher will try to use the exact font size that has been specified..TP\fCQFont::PreferQuality\fR - prefer the best quality font. The font matcher will use the nearest standard point size that the font supports..SH "QFont::Weight"Qt uses a weighting scale from 0 to 99 similar to, but not the same as, the scales used in Windows or CSS. A weight of 0 is ultralight, whilst 99 will be an extremely black..PPThis enum contains the predefined font weights:.TP\fCQFont::Light\fR - 25.TP\fCQFont::Normal\fR - 50.TP\fCQFont::DemiBold\fR - 63.TP\fCQFont::Bold\fR - 75.TP\fCQFont::Black\fR - 87.SH MEMBER FUNCTION DOCUMENTATION.SH "QFont::QFont ()"Constructs a font object that uses the application's default font..PPSee also QApplication::setFont() and QApplication::font()..SH "QFont::QFont ( const QString & family, int pointSize = 12, int weight = Normal, bool italic = FALSE )"Constructs a font object with the specified \fIfamily\fR, \fIpointSize\fR, \fIweight\fR and \fIitalic\fR settings..PPIf \fIpointSize\fR is <= 0 it is set to 1..PPThe \fIfamily\fR name may optionally also include a foundry name, e.g. "Helvetica [Cronyx]". (The Qt 2.x syntax, i.e." Cronyx-Helvetica", is also supported.) If the \fIfamily\fR is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. If the family isn't available a family will be set using the font matching algorithm..PPSee also Weight, setFamily(), setPointSize(), setWeight(), setItalic(), setStyleHint(), and QApplication::font()..SH "QFont::QFont ( const QFont & font )"Constructs a font that is a copy of \fIfont\fR..SH "QFont::~QFont ()"Destroys the font object and frees all allocated resources..SH "bool QFont::bold () const"Returns TRUE if weight() is a value greater than QFont::Normal; otherwise returns FALSE..PPSee also weight(), setBold(), and QFontInfo::bold()..PPExample: chart/optionsform.cpp..SH "int QFont::deciPointSize () const\fC [protected]\fR"Returns the point size in 1/10ths of a point..PPThe returned value will be -1 if the font size has been specified in pixels..PPSee also pointSize() and pointSizeFloat()..SH "QString QFont::defaultFamily () const"Returns the family name that corresponds to the current style hint..PPSee also StyleHint, styleHint(), and setStyleHint()..SH "QFont QFont::defaultFont ()\fC [static]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPPlease use QApplication::font() instead..SH "bool QFont::dirty () const\fC [protected]\fR"Returns TRUE if the font attributes have been changed and the font has to be (re)loaded; otherwise returns FALSE..SH "bool QFont::exactMatch () const"Returns TRUE if a window system font exactly matching the settings of this font is available..PPSee also QFontInfo..SH "QString QFont::family () const"Returns the requested font family name, i.e. the name set in the constructor or the last setFont() call..PPSee also setFamily(), substitutes(), and substitute()..PPExamples:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -