qfont.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 870 行 · 第 1/4 页
HTML
870 行
either.<p> <pre> QFont f1( "Helvetica [Cronyx]" ); // Qt 3.x QFont f2( "Cronyx-Helvetica" ); // Qt 2.x compatibility </pre> You 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]".<p> To determine the attributes of the font actually used in the windowsystem, use a QFontInfo object, e.g.<pre> <a href="qfontinfo.html">QFontInfo</a> info( f1 ); <a href="qstring.html">QString</a> family = info.<a href="qfontinfo.html#family">family</a>(); </pre> <p> To find out font metrics use a <a href="qfontmetrics.html">QFontMetrics</a> object, e.g.<pre> <a href="qfontmetrics.html">QFontMetrics</a> fm( f1 ); int pixelWidth = fm.<a href="qfontmetrics.html#width">width</a>( "How many pixels wide is this text?" ); int pixelHeight = fm.<a href="qfontmetrics.html#height">height</a>(); </pre> <p> For more general information on fonts, see the<a href="http://www.nwalsh.com/comp.fonts/FAQ/">comp.fonts FAQ.</a>Information on encodings can be found from<a href="http://czyborra.com/">Roman Czyborra's</a> page.<p> <p>See also <a href="qfontmetrics.html">QFontMetrics</a>, <a href="qfontinfo.html">QFontInfo</a>, <a href="qfontdatabase.html">QFontDatabase</a>, <a href="qapplication.html#setFont">QApplication::setFont</a>(), <a href="qwidget.html#font-prop">QWidget::font</a>, <a href="qpainter.html#setFont">QPainter::setFont</a>(), <a href="#StyleHint-enum">QFont::StyleHint</a>, <a href="#Weight-enum">QFont::Weight</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="graphics.html">Graphics Classes</a> and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="Script-enum"></a>QFont::Script</h3><p> This enum represents <a href="unicode.html">Unicode</a> allocatedscripts. For exhaustive coverage see <a href="http://www.amazon.com/exec/obidos/ASIN/0201616335/trolltech/t">The Unicode Standard Version 3.0</a>. The following scripts aresupported:<p> Modern European alphabetic scripts (left to right):<ul><li><tt>QFont::Latin</tt> - consists of most alphabets based on the original Latin alphabet.<li><tt>QFont::Greek</tt> - covers ancient and modern Greek and Coptic.<li><tt>QFont::Cyrillic</tt> - covers the Slavic and non-Slavic languages usingcyrillic alphabets.<li><tt>QFont::Armenian</tt> - contains the Armenian alphabet used with theArmenian language.<li><tt>QFont::Georgian</tt> - covers at least the language Georgian.<li><tt>QFont::Runic</tt> - covers the known constituents of the Runic alphabets usedby the early and medieval societies in the Germanic,Scandinavian, and Anglo-Saxon areas.<li><tt>QFont::Ogham</tt> - is an alphabetical script used to write a very earlyform of Irish.<li><tt>QFont::SpacingModifiers</tt> - are small signs indicating modificationsto the preceeding letter.<li><tt>QFont::CombiningMarks</tt> - consist of diacritical marks not specific toa particular alphabet, diacritical marks used incombination with mathematical and technical symbols, andglyph encodings applied to multiple letterforms.</ul><p> Middle Eastern scripts (right to left):<ul><li><tt>QFont::Hebrew</tt> - is used for writing Hebrew, Yiddish, and some other languages.<li><tt>QFont::Arabic</tt> - covers the Arabic language as well as Persian, Urdu,Kurdish and some others.<li><tt>QFont::Syriac</tt> - is used to write the active liturgical languages anddialects of several Middle Eastern and Southeast Indiancommunities.<li><tt>QFont::Thaana</tt> - is used to write the Maledivian Dhivehi language.</ul><p> South and Southeast Asian scripts (left to right with few historical exceptions):<ul><li><tt>QFont::Devanagari</tt> - covers classical Sanskrit and modern Hindi aswell as several other languages.<li><tt>QFont::Bengali</tt> - is a relative to Devanagari employed to write theBengali language used in West Bengal/India and Bangladeshas well as several minority languages.<li><tt>QFont::Gurmukhi</tt> - is another Devanagari relative used to write Punjabi.<li><tt>QFont::Gujarati</tt> - is closely related to Devanagari and used to writethe Gujarati language of the Gujarat state in India.<li><tt>QFont::Oriya</tt> - is used to write the Oriya language of Orissa state/India.<li><tt>QFont::Tamil</tt> - is used to write the Tamil language of Tamil Nadu state/India,Sri Lanka, Singapore and parts of Malaysia as well as someminority languages.<li><tt>QFont::Telugu</tt> - is used to write the Telugu language of AndhraPradesh state/India and some minority languages.<li><tt>QFont::Kannada</tt> - is another South Indian script used to write theKannada language of Karnataka state/India and some minoritylanguages.<li><tt>QFont::Malayalam</tt> - is used to write the Malayalam language of Keralastate/India.<li><tt>QFont::Sinhala</tt> - is used for Sri Lanka's majority language Sinhalaand is also employed to write Pali, Sanskrit, and Tamil.<li><tt>QFont::Thai</tt> - is used to write Thai and other Southeast Asian languages.<li><tt>QFont::Lao</tt> - is a language and script quite similar to Thai.<li><tt>QFont::Tibetan</tt> - is the script used to write Tibetan in severalcountries like Tibet, the bordering Indian regions andNepal. It is also used in the Buddist philosophy andliturgy of the Mongolian cultural area.<li><tt>QFont::Myanmar</tt> - is mainly used to write the Burmese language ofMyanmar (former Burma).<li><tt>QFont::Khmer</tt> - is the official language of Kampuchea.</ul><p> East Asian scripts (traditionally top-down, right to left, modernoften horizontal left to right):<ul><li><tt>QFont::Han</tt> - consists of the CJK (Chinese, Japanese, Korean)idiographic characters.<li><tt>QFont::Hiragana</tt> - is a cursive syllabary used to indicate phoneticsand pronounciation of Japanese words.<li><tt>QFont::Katakana</tt> - is a non-cursive syllabic script used to writeJapanese words with visual emphasis and non-Japanese wordsin a phonetical manner.<li><tt>QFont::Hangul</tt> - is a Korean script consisting of alphabetic components.<li><tt>QFont::Bopomofo</tt> - is a phonetic alphabet for Chinese (mainly Mandarin).<li><tt>QFont::Yi</tt> - (also called Cuan or Wei) is a syllabary used to writethe Yi language of Southwestern China, Myanmar, Laos, and Vietnam.</ul><p> Additional scripts that do not fit well into the script categories above:<ul><li><tt>QFont::Ethiopic</tt> - is a syllabary used by several Central East African languages.<li><tt>QFont::Cherokee</tt> - is a left-to-right syllabic script used to writethe Cherokee language.<li><tt>QFont::CanadianAboriginal</tt> - consists of the syllabics used by someCanadian aboriginal societies.<li><tt>QFont::Mongolian</tt> - is the traditional (and recently reintroduced)script used to write Mongolian.</ul><p> Symbols:<ul><li><tt>QFont::CurrencySymbols</tt> - contains currency symbols not encoded in other scripts.<li><tt>QFont::LetterlikeSymbols</tt> - consists of symbols derived fromordinary letters of an alphabetical script.<li><tt>QFont::NumberForms</tt> - are provided for compatibility with otherexisting character sets.<li><tt>QFont::MathematicalOperators</tt> - consists of encodings for operators,relations and other symbols like arrows used in a mathematical context.<li><tt>QFont::TechnicalSymbols</tt> - contains representations for controlcodes, the space symbol, APL symbols and other symbolsmainly used in the context of electronic data processing.<li><tt>QFont::GeometricSymbols</tt> - covers block elements and geometric shapes.<li><tt>QFont::MiscellaneousSymbols</tt> - consists of a heterogeneous collectionof symbols that do not fit any other Unicode characterblock, e.g. Dingbats.<li><tt>QFont::EnclosedAndSquare</tt> - is provided for compatibility with someEast Asian standards.<li><tt>QFont::Braille</tt> - is an international writing system used by blindpeople. This script encodes the 256 eight-dot patterns withthe 64 six-dot patterns as a subset.</ul><p> <ul><li><tt>QFont::Unicode</tt> - includes all the above scripts.</ul><p> The values below are provided for completeness and must <em>not</em> beused in user programs.<ul><li><tt>QFont::HanX11</tt> - For internal use only.<li><tt>QFont::LatinBasic</tt> - For internal use only.<li><tt>QFont::LatinExtendedA_2</tt> - For internal use only.<li><tt>QFont::LatinExtendedA_3</tt> - For internal use only.<li><tt>QFont::LatinExtendedA_4</tt> - For internal use only.<li><tt>QFont::LatinExtendedA_14</tt> - For internal use only.<li><tt>QFont::LatinExtendedA_15</tt> - For internal use only.<li><tt>QFont::LastPrivateScript</tt> - For internal use only.<li><tt>QFont::NScripts</tt> - For internal use only.<li><tt>QFont::NoScript</tt> - For internal use only.<li><tt>QFont::UnknownScript</tt> - For internal use only.</ul><h3 class=fn><a name="StyleHint-enum"></a>QFont::StyleHint</h3><p> Style hints are used by the <a href="#fontmatching">font matching</a> algorithm to find an appropriate default familyif a selected font family is not available.<ul><li><tt>QFont::AnyStyle</tt> - leaves the font matching algorithm to choose thefamily. This is the default.<li><tt>QFont::SansSerif</tt> - the font matcher prefer sans serif fonts.<li><tt>QFont::Helvetica</tt> - is a synonym for <a href="#StyleHint-enum">SansSerif</a>.<li><tt>QFont::Serif</tt> - the font matcher prefers serif fonts.<li><tt>QFont::Times</tt> - is a synonym for <a href="#StyleHint-enum">Serif</a>.<li><tt>QFont::TypeWriter</tt> - the font matcher prefers fixed pitch fonts.<li><tt>QFont::Courier</tt> - a synonym for <a href="#StyleHint-enum">TypeWriter</a>.<li><tt>QFont::OldEnglish</tt> - the font matcher prefers decorative fonts.<li><tt>QFont::Decorative</tt> - is a synonym for <a href="#StyleHint-enum">OldEnglish</a>.<li><tt>QFont::System</tt> - the font matcher prefers system fonts.</ul><h3 class=fn><a name="StyleStrategy-enum"></a>QFont::StyleStrategy</h3><p> The style strategy tells the <a href="#fontmatching">font matching</a> algorithm what type of fonts should be used tofind an appropriate default family.<p> The following strategies are available:<ul><li><tt>QFont::PreferDefault</tt> - the default style strategy. It does not preferany type of font.<li><tt>QFont::PreferBitmap</tt> - prefers bitmap fonts (as opposed to outlinefonts). On X11, this will cause Qt to disregard fonts fromthe Xft font extension.<li><tt>QFont::PreferDevice</tt> - prefers device fonts.<li><tt>QFont::PreferOutline</tt> - prefers outline fonts (as opposed to bitmap fonts).<li><tt>QFont::ForceOutline</tt> - forces the use of outline fonts.<li><tt>QFont::NoAntialias</tt> - don't antialias the fonts.<li><tt>QFont::PreferAntialias</tt> - antialias if possible.</ul><p> Any of these may be OR-ed with one of these flags:<ul><li><tt>QFont::PreferMatch</tt> - prefer an exact match. The font matcher will try touse the exact font size that has been specified.<li><tt>QFont::PreferQuality</tt> - prefer the best quality font. The font matcherwill use the nearest standard point size that the fontsupports.</ul><h3 class=fn><a name="Weight-enum"></a>QFont::Weight</h3><p> Qt uses a weighting scale from 0 to 99 similar to, but not thesame as, the scales used in Windows or CSS. A weight of 0 isultralight, whilst 99 will be an extremely black.<p> This enum contains the predefined font weights:<ul><li><tt>QFont::Light</tt> - 25<li><tt>QFont::Normal</tt> - 50<li><tt>QFont::DemiBold</tt> - 63<li><tt>QFont::Bold</tt> - 75<li><tt>QFont::Black</tt> - 87</ul><hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QFont"></a>QFont::QFont ()</h3>Constructs a font object that uses the application's default font.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?