diff options
Diffstat (limited to 'doc/html/qfont.html')
-rw-r--r-- | doc/html/qfont.html | 922 |
1 files changed, 922 insertions, 0 deletions
diff --git a/doc/html/qfont.html b/doc/html/qfont.html new file mode 100644 index 0000000..1b31661 --- /dev/null +++ b/doc/html/qfont.html @@ -0,0 +1,922 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qfont.cpp:236 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>QFont Class</title> +<style type="text/css"><!-- +fn { margin-left: 1cm; text-indent: -1cm; } +a:link { color: #004faf; text-decoration: none } +a:visited { color: #672967; text-decoration: none } +body { background: #ffffff; color: black; } +--></style> +</head> +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr bgcolor="#E5E5E5"> +<td valign=center> + <a href="index.html"> +<font color="#004faf">Home</font></a> + | <a href="classes.html"> +<font color="#004faf">All Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped Classes</font></a> + | <a href="functions.html"> +<font color="#004faf">Functions</font></a> +</td> +<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFont Class Reference</h1> + +<p>The QFont class specifies a font used for drawing text. +<a href="#details">More...</a> +<p><tt>#include <<a href="qfont-h.html">qfont.h</a>></tt> +<p><a href="qfont-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn>enum <a href="#StyleHint-enum"><b>StyleHint</b></a> { Helvetica, SansSerif = Helvetica, Times, Serif = Times, Courier, TypeWriter = Courier, OldEnglish, Decorative = OldEnglish, System, AnyStyle }</li> +<li class=fn>enum <a href="#StyleStrategy-enum"><b>StyleStrategy</b></a> { PreferDefault = 0x0001, PreferBitmap = 0x0002, PreferDevice = 0x0004, PreferOutline = 0x0008, ForceOutline = 0x0010, PreferMatch = 0x0020, PreferQuality = 0x0040, PreferAntialias = 0x0080, NoAntialias = 0x0100, OpenGLCompatible = 0x0200 }</li> +<li class=fn>enum <a href="#Weight-enum"><b>Weight</b></a> { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 }</li> +<li class=fn>enum <a href="#Stretch-enum"><b>Stretch</b></a> { UltraCondensed = 50, ExtraCondensed = 62, Condensed = 75, SemiCondensed = 87, Unstretched = 100, SemiExpanded = 112, Expanded = 125, ExtraExpanded = 150, UltraExpanded = 200 }</li> +<li class=fn><a href="#QFont"><b>QFont</b></a> ()</li> +<li class=fn><a href="#QFont-2"><b>QFont</b></a> ( const QString & family, int pointSize = 12, int weight = Normal, bool italic = FALSE )</li> +<li class=fn><a href="#QFont-3"><b>QFont</b></a> ( const QFont & font )</li> +<li class=fn><a href="#~QFont"><b>~QFont</b></a> ()</li> +<li class=fn>QString <a href="#family"><b>family</b></a> () const</li> +<li class=fn>void <a href="#setFamily"><b>setFamily</b></a> ( const QString & family )</li> +<li class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</li> +<li class=fn>float <a href="#pointSizeFloat"><b>pointSizeFloat</b></a> () const</li> +<li class=fn>void <a href="#setPointSize"><b>setPointSize</b></a> ( int pointSize )</li> +<li class=fn>void <a href="#setPointSizeFloat"><b>setPointSizeFloat</b></a> ( float pointSize )</li> +<li class=fn>int <a href="#pixelSize"><b>pixelSize</b></a> () const</li> +<li class=fn>void <a href="#setPixelSize"><b>setPixelSize</b></a> ( int pixelSize )</li> +<li class=fn>void setPixelSizeFloat ( float pixelSize ) <em>(obsolete)</em></li> +<li class=fn>int <a href="#weight"><b>weight</b></a> () const</li> +<li class=fn>void <a href="#setWeight"><b>setWeight</b></a> ( int weight )</li> +<li class=fn>bool <a href="#bold"><b>bold</b></a> () const</li> +<li class=fn>void <a href="#setBold"><b>setBold</b></a> ( bool enable )</li> +<li class=fn>bool <a href="#italic"><b>italic</b></a> () const</li> +<li class=fn>void <a href="#setItalic"><b>setItalic</b></a> ( bool enable )</li> +<li class=fn>bool <a href="#underline"><b>underline</b></a> () const</li> +<li class=fn>void <a href="#setUnderline"><b>setUnderline</b></a> ( bool enable )</li> +<li class=fn>bool <a href="#overline"><b>overline</b></a> () const</li> +<li class=fn>void <a href="#setOverline"><b>setOverline</b></a> ( bool enable )</li> +<li class=fn>bool <a href="#strikeOut"><b>strikeOut</b></a> () const</li> +<li class=fn>void <a href="#setStrikeOut"><b>setStrikeOut</b></a> ( bool enable )</li> +<li class=fn>bool <a href="#fixedPitch"><b>fixedPitch</b></a> () const</li> +<li class=fn>void <a href="#setFixedPitch"><b>setFixedPitch</b></a> ( bool enable )</li> +<li class=fn>StyleHint <a href="#styleHint"><b>styleHint</b></a> () const</li> +<li class=fn>StyleStrategy <a href="#styleStrategy"><b>styleStrategy</b></a> () const</li> +<li class=fn>void <a href="#setStyleHint"><b>setStyleHint</b></a> ( StyleHint hint, StyleStrategy strategy = PreferDefault )</li> +<li class=fn>void <a href="#setStyleStrategy"><b>setStyleStrategy</b></a> ( StyleStrategy s )</li> +<li class=fn>int <a href="#stretch"><b>stretch</b></a> () const</li> +<li class=fn>void <a href="#setStretch"><b>setStretch</b></a> ( int factor )</li> +<li class=fn>bool <a href="#rawMode"><b>rawMode</b></a> () const</li> +<li class=fn>void <a href="#setRawMode"><b>setRawMode</b></a> ( bool enable )</li> +<li class=fn>bool <a href="#exactMatch"><b>exactMatch</b></a> () const</li> +<li class=fn>QFont & <a href="#operator-eq"><b>operator=</b></a> ( const QFont & font )</li> +<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QFont & f ) const</li> +<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QFont & f ) const</li> +<li class=fn>bool <a href="#isCopyOf"><b>isCopyOf</b></a> ( const QFont & f ) const</li> +<li class=fn>HFONT <a href="#handle"><b>handle</b></a> () const</li> +<li class=fn>void <a href="#setRawName"><b>setRawName</b></a> ( const QString & name )</li> +<li class=fn>QString <a href="#rawName"><b>rawName</b></a> () const</li> +<li class=fn>QString <a href="#key"><b>key</b></a> () const</li> +<li class=fn>QString <a href="#toString"><b>toString</b></a> () const</li> +<li class=fn>bool <a href="#fromString"><b>fromString</b></a> ( const QString & descrip )</li> +<li class=fn>void <a href="#qwsRenderToDisk"><b>qwsRenderToDisk</b></a> ( bool all = TRUE )</li> +<li class=fn>enum <a href="#Script-enum"><b>Script</b></a> { Latin, Greek, Cyrillic, Armenian, Georgian, Runic, Ogham, SpacingModifiers, CombiningMarks, Hebrew, Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar, Khmer, Han, Hiragana, Katakana, Hangul, Bopomofo, Yi, Ethiopic, Cherokee, CanadianAboriginal, Mongolian, CurrencySymbols, LetterlikeSymbols, NumberForms, MathematicalOperators, TechnicalSymbols, GeometricSymbols, MiscellaneousSymbols, EnclosedAndSquare, Braille, Unicode, Tagalog, Hanunoo, Buhid, Tagbanwa, KatakanaHalfWidth, Limbu, TaiLe }</li> +<li class=fn>QString <a href="#defaultFamily"><b>defaultFamily</b></a> () const</li> +<li class=fn>QString <a href="#lastResortFamily"><b>lastResortFamily</b></a> () const</li> +<li class=fn>QString <a href="#lastResortFont"><b>lastResortFont</b></a> () const</li> +<li class=fn>QFont <a href="#resolve"><b>resolve</b></a> ( const QFont & other ) const</li> +</ul> +<h2>Static Public Members</h2> +<ul> +<li class=fn>QString <a href="#substitute"><b>substitute</b></a> ( const QString & familyName )</li> +<li class=fn>QStringList <a href="#substitutes"><b>substitutes</b></a> ( const QString & familyName )</li> +<li class=fn>QStringList <a href="#substitutions"><b>substitutions</b></a> ()</li> +<li class=fn>void <a href="#insertSubstitution"><b>insertSubstitution</b></a> ( const QString & familyName, const QString & substituteName )</li> +<li class=fn>void <a href="#insertSubstitutions"><b>insertSubstitutions</b></a> ( const QString & familyName, const QStringList & substituteNames )</li> +<li class=fn>void <a href="#removeSubstitution"><b>removeSubstitution</b></a> ( const QString & familyName )</li> +<li class=fn>QFont defaultFont () <em>(obsolete)</em></li> +<li class=fn>void setDefaultFont ( const QFont & f ) <em>(obsolete)</em></li> +</ul> +<h2>Protected Members</h2> +<ul> +<li class=fn>bool <a href="#dirty"><b>dirty</b></a> () const</li> +<li class=fn>int <a href="#deciPointSize"><b>deciPointSize</b></a> () const</li> +</ul> +<h2>Related Functions</h2> +<ul> +<li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QFont & font )</li> +<li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QFont & font )</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The QFont class specifies a font used for drawing text. +<p> + + + +<p> When you create a QFont object you specify various attributes that +you want the font to have. Qt will use the font with the specified +attributes, or if no matching font exists, Qt will use the closest +matching installed font. The attributes of the font that is +actually used are retrievable from a <a href="qfontinfo.html">QFontInfo</a> object. If the +window system provides an exact match <a href="#exactMatch">exactMatch</a>() returns TRUE. +Use <a href="qfontmetrics.html">QFontMetrics</a> to get measurements, e.g. the pixel length of a +string using <a href="qfontmetrics.html#width">QFontMetrics::width</a>(). +<p> Use <a href="qapplication.html#setFont">QApplication::setFont</a>() to set the application's default font. +<p> If a choosen X11 font does not include all the characters that +need to be displayed, QFont will try to find the characters in the +nearest equivalent fonts. When a <a href="qpainter.html">QPainter</a> draws a character from a +font the QFont will report whether or not it has the character; if +it does not, QPainter will draw an unfilled square. +<p> Create QFonts like this: +<pre> + QFont serifFont( "Times", 10, Bold ); + QFont sansFont( "Helvetica [Cronyx]", 12 ); + </pre> + +<p> The attributes set in the constructor can also be set later, e.g. +<a href="#setFamily">setFamily</a>(), <a href="#setPointSize">setPointSize</a>(), <a href="#setPointSizeFloat">setPointSizeFloat</a>(), <a href="#setWeight">setWeight</a>() and +<a href="#setItalic">setItalic</a>(). The remaining attributes must be set after +contstruction, e.g. <a href="#setBold">setBold</a>(), <a href="#setUnderline">setUnderline</a>(), <a href="#setOverline">setOverline</a>(), +<a href="#setStrikeOut">setStrikeOut</a>() and <a href="#setFixedPitch">setFixedPitch</a>(). <a href="qfontinfo.html">QFontInfo</a> objects should be +created <em>after</em> the font's attributes have been set. A QFontInfo +object will not change, even if you change the font's +attributes. The corresponding "get" functions, e.g. <a href="#family">family</a>(), +<a href="#pointSize">pointSize</a>(), etc., return the values that were set, even though +the values used may differ. The actual values are available from a +QFontInfo object. +<p> If the requested font family is unavailable you can influence the +<a href="#fontmatching">font matching algorithm</a> by choosing a +particular <a href="#StyleHint-enum">QFont::StyleHint</a> and <a href="#StyleStrategy-enum">QFont::StyleStrategy</a> with +<a href="#setStyleHint">setStyleHint</a>(). The default family (corresponding to the current +style hint) is returned by <a href="#defaultFamily">defaultFamily</a>(). +<p> The font-matching algorithm has a <a href="#lastResortFamily">lastResortFamily</a>() and +<a href="#lastResortFont">lastResortFont</a>() in cases where a suitable match cannot be found. +You can provide substitutions for font family names using +<a href="#insertSubstitution">insertSubstitution</a>() and <a href="#insertSubstitutions">insertSubstitutions</a>(). Substitutions can +be removed with <a href="#removeSubstitution">removeSubstitution</a>(). Use <a href="#substitute">substitute</a>() to retrieve +a family's first substitute, or the family name itself if it has +no substitutes. Use <a href="#substitutes">substitutes</a>() to retrieve a list of a family's +substitutes (which may be empty). +<p> Every QFont has a <a href="#key">key</a>() which you can use, for example, as the key +in a cache or dictionary. If you want to store a user's font +preferences you could use <a href="qsettings.html">QSettings</a>, writing the font information +with <a href="#toString">toString</a>() and reading it back with <a href="#fromString">fromString</a>(). The +<a href="#operator-lt-lt">operator<<</a>() and <a href="#operator-gt-gt">operator>></a>() functions are also available, but +they work on a data stream. +<p> It is possible to set the height of characters shown on the screen +to a specified number of pixels with <a href="#setPixelSize">setPixelSize</a>(); however using +<a href="#setPointSize">setPointSize</a>() has a similar effect and provides device +independence. +<p> Under the X Window System you can set a font using its system +specific name with <a href="#setRawName">setRawName</a>(). +<p> Loading fonts can be expensive, especially on X11. QFont contains +extensive optimizations to make the copying of QFont objects fast, +and to cache the results of the slow window system functions it +depends upon. +<p> <a name="fontmatching"></a> +The font matching algorithm works as follows: +<ol type=1> +<li> The specified font family is searched for. +<li> If not found, the <a href="#styleHint">styleHint</a>() is used to select a replacement +family. +<li> Each replacement font family is searched for. +<li> If none of these are found or there was no styleHint(), "helvetica" +will be searched for. +<li> If "helvetica" isn't found Qt will try the <a href="#lastResortFamily">lastResortFamily</a>(). +<li> If the lastResortFamily() isn't found Qt will try the +<a href="#lastResortFont">lastResortFont</a>() which will always return a name of some kind. +</ol> +<p> Once a font is found, the remaining attributes are matched in order of +priority: +<ol type=1> +<li> <a href="#fixedPitch">fixedPitch</a>() +<li> <a href="#pointSize">pointSize</a>() (see below) +<li> <a href="#weight">weight</a>() +<li> <a href="#italic">italic</a>() +</ol> +<p> If you have a font which matches on family, even if none of the +other attributes match, this font will be chosen in preference to +a font which doesn't match on family but which does match on the +other attributes. This is because font family is the dominant +search criteria. +<p> The point size is defined to match if it is within 20% of the +requested point size. When several fonts match and are only +distinguished by point size, the font with the closest point size +to the one requested will be chosen. +<p> The actual family, font size, weight and other font attributes +used for drawing text will depend on what's available for the +chosen family under the window system. A <a href="qfontinfo.html">QFontInfo</a> object can be +used to determine the actual values used for drawing the text. +<p> Examples: +<p> <pre> + QFont f("Helvetica"); + </pre> + +If you had both an Adobe and a Cronyx Helvetica, you might get +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 window +system, 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> allocated +scripts. 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 are +supported: +<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 using +cyrillic alphabets. +<li><tt>QFont::Armenian</tt> - contains the Armenian alphabet used with the +Armenian 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 used +by 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 early +form of Irish. +<li><tt>QFont::SpacingModifiers</tt> - are small signs indicating modifications +to the preceeding letter. +<li><tt>QFont::CombiningMarks</tt> - 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. +</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 and +dialects of several Middle Eastern and Southeast Indian +communities. +<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 as +well as several other languages. +<li><tt>QFont::Bengali</tt> - is a relative to Devanagari employed to write the +Bengali language used in West Bengal/India and Bangladesh +as 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 write +the 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 some +minority languages. +<li><tt>QFont::Telugu</tt> - is used to write the Telugu language of Andhra +Pradesh state/India and some minority languages. +<li><tt>QFont::Kannada</tt> - is another South Indian script used to write the +Kannada language of Karnataka state/India and some minority +languages. +<li><tt>QFont::Malayalam</tt> - is used to write the Malayalam language of Kerala +state/India. +<li><tt>QFont::Sinhala</tt> - is used for Sri Lanka's majority language Sinhala +and 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 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. +<li><tt>QFont::Myanmar</tt> - is mainly used to write the Burmese language of +Myanmar (former Burma). +<li><tt>QFont::Khmer</tt> - is the official language of Kampuchea. +</ul><p> East Asian scripts (traditionally top-down, right to left, modern +often 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 phonetics +and pronounciation of Japanese words. +<li><tt>QFont::Katakana</tt> - is a non-cursive syllabic script used to write +Japanese words with visual emphasis and non-Japanese words +in 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 write +the 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 write +the Cherokee language. +<li><tt>QFont::CanadianAboriginal</tt> - consists of the syllabics used by some +Canadian 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 from +ordinary letters of an alphabetical script. +<li><tt>QFont::NumberForms</tt> - are provided for compatibility with other +existing 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 control +codes, the space symbol, APL symbols and other symbols +mainly 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 collection +of symbols that do not fit any other Unicode character +block, e.g. Dingbats. +<li><tt>QFont::EnclosedAndSquare</tt> - is provided for compatibility with some +East Asian standards. +<li><tt>QFont::Braille</tt> - 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. +<li><tt>QFont::Tagalog</tt> +<li><tt>QFont::Hanunoo</tt> +<li><tt>QFont::Buhid</tt> +<li><tt>QFont::Tagbanwa</tt> +<li><tt>QFont::KatakanaHalfWidth</tt> +<li><tt>QFont::Limbu</tt> - (Unicode 4.0) +<li><tt>QFont::TaiLe</tt> - (Unicode 4.0) +<li><tt>QFont::Unicode</tt> - includes all the above scripts. +</ul> +<h3 class=fn><a name="Stretch-enum"></a>QFont::Stretch</h3> + +<p> Predefined stretch values that follow the CSS naming convention. +<ul> +<li><tt>QFont::UltraCondensed</tt> - 50 +<li><tt>QFont::ExtraCondensed</tt> - 62 +<li><tt>QFont::Condensed</tt> - 75 +<li><tt>QFont::SemiCondensed</tt> - 87 +<li><tt>QFont::Unstretched</tt> - 100 +<li><tt>QFont::SemiExpanded</tt> - 112 +<li><tt>QFont::Expanded</tt> - 125 +<li><tt>QFont::ExtraExpanded</tt> - 150 +<li><tt>QFont::UltraExpanded</tt> - 200 +</ul><p> <p>See also <a href="#setStretch">setStretch</a>() and <a href="#stretch">stretch</a>(). + +<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 family +if a selected font family is not available. +<ul> +<li><tt>QFont::AnyStyle</tt> - leaves the font matching algorithm to choose the +family. 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 to +find an appropriate default family. +<p> The following strategies are available: +<ul> +<li><tt>QFont::PreferDefault</tt> - the default style strategy. It does not prefer +any type of font. +<li><tt>QFont::PreferBitmap</tt> - prefers bitmap fonts (as opposed to outline +fonts). +<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. +<li><tt>QFont::OpenGLCompatible</tt> - forces the use of OpenGL compatible +fonts. +</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 to +use the exact font size that has been specified. +<li><tt>QFont::PreferQuality</tt> - prefer the best quality font. The font matcher +will use the nearest standard point size that the font +supports. +</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 the +same as, the scales used in Windows or CSS. A weight of 0 is +ultralight, 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. +<p> <p>See also <a href="qapplication.html#setFont">QApplication::setFont</a>() and <a href="qapplication.html#font">QApplication::font</a>(). + +<h3 class=fn><a name="QFont-2"></a>QFont::QFont ( const <a href="qstring.html">QString</a> & family, int pointSize = 12, int weight = Normal, bool italic = FALSE ) +</h3> +Constructs a font object with the specified <em>family</em>, <em>pointSize</em>, <em>weight</em> and <em>italic</em> settings. +<p> If <em>pointSize</em> is <= 0 it is set to 1. +<p> The <em>family</em> 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 <em>family</em> 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 <a href="#fontmatching">font + matching</a> algorithm. +<p> <p>See also <a href="#Weight-enum">Weight</a>, <a href="#setFamily">setFamily</a>(), <a href="#setPointSize">setPointSize</a>(), <a href="#setWeight">setWeight</a>(), <a href="#setItalic">setItalic</a>(), <a href="#setStyleHint">setStyleHint</a>(), and <a href="qapplication.html#font">QApplication::font</a>(). + +<h3 class=fn><a name="QFont-3"></a>QFont::QFont ( const <a href="qfont.html">QFont</a> & font ) +</h3> +Constructs a font that is a copy of <em>font</em>. + +<h3 class=fn><a name="~QFont"></a>QFont::~QFont () +</h3> +Destroys the font object and frees all allocated resources. + +<h3 class=fn>bool <a name="bold"></a>QFont::bold () const +</h3> + +<p> Returns TRUE if <a href="#weight">weight</a>() is a value greater than <a href="#Weight-enum">QFont::Normal</a>; otherwise returns FALSE. +<p> <p>See also <a href="#weight">weight</a>(), <a href="#setBold">setBold</a>(), and <a href="qfontinfo.html#bold">QFontInfo::bold</a>(). + +<p>Example: <a href="tutorial2-09.html#x2634">chart/optionsform.cpp</a>. +<h3 class=fn>int <a name="deciPointSize"></a>QFont::deciPointSize () const<tt> [protected]</tt> +</h3> +Returns the point size in 1/10ths of a point. +<p> The returned value will be -1 if the font size has been specified +in pixels. +<p> <p>See also <a href="#pointSize">pointSize</a>() and <a href="#pointSizeFloat">pointSizeFloat</a>(). + +<h3 class=fn><a href="qstring.html">QString</a> <a name="defaultFamily"></a>QFont::defaultFamily () const +</h3> +Returns the family name that corresponds to the current style +hint. +<p> <p>See also <a href="#StyleHint-enum">StyleHint</a>, <a href="#styleHint">styleHint</a>(), and <a href="#setStyleHint">setStyleHint</a>(). + +<h3 class=fn><a href="qfont.html">QFont</a> <a name="defaultFont"></a>QFont::defaultFont ()<tt> [static]</tt> +</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> Please use <a href="qapplication.html#font">QApplication::font</a>() instead. + +<h3 class=fn>bool <a name="dirty"></a>QFont::dirty () const<tt> [protected]</tt> +</h3> +Returns TRUE if the font attributes have been changed and the font +has to be (re)loaded; otherwise returns FALSE. + +<h3 class=fn>bool <a name="exactMatch"></a>QFont::exactMatch () const +</h3> +Returns TRUE if a window system font exactly matching the settings +of this font is available. +<p> <p>See also <a href="qfontinfo.html">QFontInfo</a>. + +<h3 class=fn><a href="qstring.html">QString</a> <a name="family"></a>QFont::family () const +</h3> +Returns the requested font family name, i.e. the name set in the +constructor or the last setFont() call. +<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#substitutes">substitutes</a>(), and <a href="#substitute">substitute</a>(). + +<p>Examples: <a href="tutorial2-09.html#x2635">chart/optionsform.cpp</a> and <a href="simple-font-demo-example.html#x2838">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>bool <a name="fixedPitch"></a>QFont::fixedPitch () const +</h3> +Returns TRUE if fixed pitch has been set; otherwise returns FALSE. +<p> <p>See also <a href="#setFixedPitch">setFixedPitch</a>() and <a href="qfontinfo.html#fixedPitch">QFontInfo::fixedPitch</a>(). + +<h3 class=fn>bool <a name="fromString"></a>QFont::fromString ( const <a href="qstring.html">QString</a> & descrip ) +</h3> +Sets this font to match the description <em>descrip</em>. The description +is a comma-separated list of the font attributes, as returned by +<a href="#toString">toString</a>(). +<p> <p>See also <a href="#toString">toString</a>() and <a href="#operator-gt-gt">operator>></a>(). + +<h3 class=fn>HFONT <a name="handle"></a>QFont::handle () const +</h3> +Returns the window system handle to the font, for low-level +access. Using this function is <em>not</em> portable. + +<h3 class=fn>void <a name="insertSubstitution"></a>QFont::insertSubstitution ( const <a href="qstring.html">QString</a> & familyName, const <a href="qstring.html">QString</a> & substituteName )<tt> [static]</tt> +</h3> +Inserts the family name <em>substituteName</em> into the substitution +table for <em>familyName</em>. +<p> <p>See also <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#removeSubstitution">removeSubstitution</a>(), <a href="#substitutions">substitutions</a>(), <a href="#substitute">substitute</a>(), and <a href="#substitutes">substitutes</a>(). + +<p>Example: <a href="simple-font-demo-example.html#x2839">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>void <a name="insertSubstitutions"></a>QFont::insertSubstitutions ( const <a href="qstring.html">QString</a> & familyName, const <a href="qstringlist.html">QStringList</a> & substituteNames )<tt> [static]</tt> +</h3> +Inserts the list of families <em>substituteNames</em> into the +substitution list for <em>familyName</em>. +<p> <p>See also <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#removeSubstitution">removeSubstitution</a>(), <a href="#substitutions">substitutions</a>(), and <a href="#substitute">substitute</a>(). + +<p>Example: <a href="simple-font-demo-example.html#x2840">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>bool <a name="isCopyOf"></a>QFont::isCopyOf ( const <a href="qfont.html">QFont</a> & f ) const +</h3> +Returns TRUE if this font and <em>f</em> 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. +<p> <p>See also <a href="#operator-eq">operator=</a>() and <a href="#operator-eq-eq">operator==</a>(). + +<h3 class=fn>bool <a name="italic"></a>QFont::italic () const +</h3> +Returns TRUE if italic has been set; otherwise returns FALSE. +<p> <p>See also <a href="#setItalic">setItalic</a>(). + +<p>Example: <a href="tutorial2-09.html#x2636">chart/optionsform.cpp</a>. +<h3 class=fn><a href="qstring.html">QString</a> <a name="key"></a>QFont::key () const +</h3> +Returns the font's key, a textual representation of a font. It is +typically used as the key for a cache or dictionary of fonts. +<p> <p>See also <a href="qmap.html">QMap</a>. + +<h3 class=fn><a href="qstring.html">QString</a> <a name="lastResortFamily"></a>QFont::lastResortFamily () const +</h3> +Returns the "last resort" font family name. +<p> The current implementation tries a wide variety of common fonts, +returning the first one it finds. Is is possible that no family is +found in which case a null string is returned. +<p> <p>See also <a href="#lastResortFont">lastResortFont</a>(). + +<h3 class=fn><a href="qstring.html">QString</a> <a name="lastResortFont"></a>QFont::lastResortFont () const +</h3> +Returns a "last resort" font name for the font matching algorithm. +This is used if the last resort family is not available. It will +always return a name, if necessary returning something like +"fixed" or "system". +<p> The current implementation tries a wide variety of common fonts, +returning the first one it finds. The implementation may change +at any time, but this function will always return a string +containing something. +<p> It is theoretically possible that there really isn't a +<a href="#lastResortFont">lastResortFont</a>() in which case Qt will abort with an error +message. We have not been able to identify a case where this +happens. Please <a href="bughowto.html">report it as a bug</a> if +it does, preferably with a list of the fonts you have installed. +<p> <p>See also <a href="#lastResortFamily">lastResortFamily</a>() and <a href="#rawName">rawName</a>(). + +<h3 class=fn>bool <a name="operator!-eq"></a>QFont::operator!= ( const <a href="qfont.html">QFont</a> & f ) const +</h3> +Returns TRUE if this font is different from <em>f</em>; otherwise +returns FALSE. +<p> Two QFonts are considered to be different if their font attributes +are different. If <a href="#rawMode">rawMode</a>() is enabled for both fonts, only the +family fields are compared. +<p> <p>See also <a href="#operator-eq-eq">operator==</a>(). + +<h3 class=fn><a href="qfont.html">QFont</a> & <a name="operator-eq"></a>QFont::operator= ( const <a href="qfont.html">QFont</a> & font ) +</h3> +Assigns <em>font</em> to this font and returns a reference to it. + +<h3 class=fn>bool <a name="operator-eq-eq"></a>QFont::operator== ( const <a href="qfont.html">QFont</a> & f ) const +</h3> +Returns TRUE if this font is equal to <em>f</em>; otherwise returns +FALSE. +<p> Two QFonts are considered equal if their font attributes are +equal. If <a href="#rawMode">rawMode</a>() is enabled for both fonts, only the family +fields are compared. +<p> <p>See also <a href="#operator!-eq">operator!=</a>() and <a href="#isCopyOf">isCopyOf</a>(). + +<h3 class=fn>bool <a name="overline"></a>QFont::overline () const +</h3> +Returns TRUE if overline has been set; otherwise returns FALSE. +<p> <p>See also <a href="#setOverline">setOverline</a>(). + +<h3 class=fn>int <a name="pixelSize"></a>QFont::pixelSize () const +</h3> +Returns the pixel size of the font if it was set with +<a href="#setPixelSize">setPixelSize</a>(). Returns -1 if the size was set with <a href="#setPointSize">setPointSize</a>() +or <a href="#setPointSizeFloat">setPointSizeFloat</a>(). +<p> <p>See also <a href="#setPixelSize">setPixelSize</a>(), <a href="#pointSize">pointSize</a>(), <a href="qfontinfo.html#pointSize">QFontInfo::pointSize</a>(), and <a href="qfontinfo.html#pixelSize">QFontInfo::pixelSize</a>(). + +<h3 class=fn>int <a name="pointSize"></a>QFont::pointSize () const +</h3> +Returns the point size of the font. Returns -1 if the font size +was specified in pixels. +<p> <p>See also <a href="#setPointSize">setPointSize</a>(), <a href="#deciPointSize">deciPointSize</a>(), and <a href="#pointSizeFloat">pointSizeFloat</a>(). + +<p>Examples: <a href="tutorial2-09.html#x2637">chart/optionsform.cpp</a> and <a href="simple-font-demo-example.html#x2841">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>float <a name="pointSizeFloat"></a>QFont::pointSizeFloat () const +</h3> +Returns the point size of the font. Returns -1 if the font size was +specified in pixels. +<p> <p>See also <a href="#pointSize">pointSize</a>(), <a href="#setPointSizeFloat">setPointSizeFloat</a>(), <a href="#pixelSize">pixelSize</a>(), <a href="qfontinfo.html#pointSize">QFontInfo::pointSize</a>(), and <a href="qfontinfo.html#pixelSize">QFontInfo::pixelSize</a>(). + +<h3 class=fn>void <a name="qwsRenderToDisk"></a>QFont::qwsRenderToDisk ( bool all = TRUE ) +</h3> +Saves the glyphs in the font that have previously been accessed as +a QPF file. If <em>all</em> is TRUE (the default), then before saving, +all glyphs are marked as used. +<p> If the font is large and you are sure that only a subset of +characters will ever be required on the target device, passing +FALSE for the <em>all</em> parameter can save a significant amount of +disk space. +<p> Note that this function is only applicable on Qt/Embedded. + +<h3 class=fn>bool <a name="rawMode"></a>QFont::rawMode () const +</h3> +Returns TRUE if raw mode is used for font name matching; otherwise +returns FALSE. +<p> <p>See also <a href="#setRawMode">setRawMode</a>() and <a href="#rawName">rawName</a>(). + +<h3 class=fn><a href="qstring.html">QString</a> <a name="rawName"></a>QFont::rawName () const +</h3> +Returns the name of the font within the underlying window system. +<p> On Windows, this is usually just the family name of a TrueType +font. +<p> On X11, it is an XLFD (X Logical Font Description). When Qt is +build with Xft support on X11, the return value can be an Xft +pattern or an XLFD. +<p> Using the return value of this function is usually <em>not</em> <em>portable</em>. +<p> <p>See also <a href="#setRawName">setRawName</a>(). + +<h3 class=fn>void <a name="removeSubstitution"></a>QFont::removeSubstitution ( const <a href="qstring.html">QString</a> & familyName )<tt> [static]</tt> +</h3> +Removes all the substitutions for <em>familyName</em>. +<p> <p>See also <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#substitutions">substitutions</a>(), and <a href="#substitute">substitute</a>(). + +<h3 class=fn><a href="qfont.html">QFont</a> <a name="resolve"></a>QFont::resolve ( const <a href="qfont.html">QFont</a> & other ) const +</h3> +Returns a new QFont that has attributes copied from <em>other</em>. + +<h3 class=fn>void <a name="setBold"></a>QFont::setBold ( bool enable ) +</h3> + +<p> If <em>enable</em> is true sets the font's weight to <a href="#Weight-enum">QFont::Bold</a>; otherwise sets the weight to <a href="#Weight-enum">QFont::Normal</a>. +<p> For finer boldness control use <a href="#setWeight">setWeight</a>(). +<p> <p>See also <a href="#bold">bold</a>() and <a href="#setWeight">setWeight</a>(). + +<p>Examples: <a href="menu-example.html#x1860">menu/menu.cpp</a> and <a href="themes-example.html#x280">themes/metal.cpp</a>. +<h3 class=fn>void <a name="setDefaultFont"></a>QFont::setDefaultFont ( const <a href="qfont.html">QFont</a> & f )<tt> [static]</tt> +</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> Please use <a href="qapplication.html#setFont">QApplication::setFont</a>() instead. + +<h3 class=fn>void <a name="setFamily"></a>QFont::setFamily ( const <a href="qstring.html">QString</a> & family ) +</h3> +Sets the family name of the font. The name is case insensitive and +may include a foundry name. +<p> The <em>family</em> 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 <em>family</em> 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 <a href="#fontmatching">font + matching</a> algorithm. +<p> <p>See also <a href="#family">family</a>(), <a href="#setStyleHint">setStyleHint</a>(), and <a href="qfontinfo.html">QFontInfo</a>. + +<h3 class=fn>void <a name="setFixedPitch"></a>QFont::setFixedPitch ( bool enable ) +</h3> +If <em>enable</em> is TRUE, sets fixed pitch on; otherwise sets fixed +pitch off. +<p> <p>See also <a href="#fixedPitch">fixedPitch</a>() and <a href="qfontinfo.html">QFontInfo</a>. + +<h3 class=fn>void <a name="setItalic"></a>QFont::setItalic ( bool enable ) +</h3> +If <em>enable</em> is TRUE, italic is set on; otherwise italic is set +off. +<p> <p>See also <a href="#italic">italic</a>() and <a href="qfontinfo.html">QFontInfo</a>. + +<p>Examples: <a href="fileiconview-example.html#x828">fileiconview/qfileiconview.cpp</a>, <a href="simple-font-demo-example.html#x2842">fonts/simple-qfont-demo/viewer.cpp</a>, and <a href="themes-example.html#x281">themes/metal.cpp</a>. +<h3 class=fn>void <a name="setOverline"></a>QFont::setOverline ( bool enable ) +</h3> +If <em>enable</em> is TRUE, sets overline on; otherwise sets overline off. +<p> <p>See also <a href="#overline">overline</a>() and <a href="qfontinfo.html">QFontInfo</a>. + +<h3 class=fn>void <a name="setPixelSize"></a>QFont::setPixelSize ( int pixelSize ) +</h3> +Sets the font size to <em>pixelSize</em> pixels. +<p> Using this function makes the font device dependent. Use +<a href="#setPointSize">setPointSize</a>() or <a href="#setPointSizeFloat">setPointSizeFloat</a>() to set the size of the font +in a device independent manner. +<p> <p>See also <a href="#pixelSize">pixelSize</a>(). + +<p>Example: <a href="qwerty-example.html#x367">qwerty/qwerty.cpp</a>. +<h3 class=fn>void <a name="setPixelSizeFloat"></a>QFont::setPixelSizeFloat ( float pixelSize ) +</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> Sets the logical pixel height of font characters when shown on +the screen to <em>pixelSize</em>. + +<h3 class=fn>void <a name="setPointSize"></a>QFont::setPointSize ( int pointSize ) +</h3> +Sets the point size to <em>pointSize</em>. The point size must be +greater than zero. +<p> <p>See also <a href="#pointSize">pointSize</a>() and <a href="#setPointSizeFloat">setPointSizeFloat</a>(). + +<p>Example: <a href="simple-font-demo-example.html#x2843">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>void <a name="setPointSizeFloat"></a>QFont::setPointSizeFloat ( float pointSize ) +</h3> +Sets the point size to <em>pointSize</em>. The point size must be +greater than zero. The requested precision may not be achieved on +all platforms. +<p> <p>See also <a href="#pointSizeFloat">pointSizeFloat</a>(), <a href="#setPointSize">setPointSize</a>(), and <a href="#setPixelSize">setPixelSize</a>(). + +<h3 class=fn>void <a name="setRawMode"></a>QFont::setRawMode ( bool enable ) +</h3> +If <em>enable</em> is TRUE, turns raw mode on; otherwise turns raw mode +off. This function only has an effect under X11. +<p> 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. <a href="qfontinfo.html">QFontInfo</a> <em>cannot</em> 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). +<p> <b>Warning:</b> Do not use raw mode unless you really, really need it! In +most (if not all) cases, <a href="#setRawName">setRawName</a>() is a much better choice. +<p> <p>See also <a href="#rawMode">rawMode</a>() and <a href="#setRawName">setRawName</a>(). + +<h3 class=fn>void <a name="setRawName"></a>QFont::setRawName ( const <a href="qstring.html">QString</a> & name ) +</h3> +Sets a font by its system specific name. The function is +particularly useful under X, where system font settings (for +example X resources) are usually available in XLFD (X Logical Font +Description) form only. You can pass an XLFD as <em>name</em> to this +function. +<p> A font set with <a href="#setRawName">setRawName</a>() is still a full-featured QFont. It can +be queried (for example with <a href="#italic">italic</a>()) or modified (for example with +<a href="#setItalic">setItalic</a>()) and is therefore also suitable for rendering rich text. +<p> If Qt's internal font database cannot resolve the raw name, the +font becomes a raw font with <em>name</em> as its family. +<p> Note that the present implementation does not handle wildcards in +XLFDs well, and that font aliases (file <tt>fonts.alias</tt> in the font +directory on X11) are not supported. +<p> <p>See also <a href="#rawName">rawName</a>(), <a href="#setRawMode">setRawMode</a>(), and <a href="#setFamily">setFamily</a>(). + +<h3 class=fn>void <a name="setStretch"></a>QFont::setStretch ( int factor ) +</h3> +Sets the <a href="layout.html#stretch-factor">stretch factor</a> for the font. +<p> The stretch factor changes the width of all characters in the font +by <em>factor</em> percent. For example, setting <em>factor</em> 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. +<p> The stretch factor is only applied to outline fonts. The stretch +factor is ignored for bitmap fonts. +<p> 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. +<p> <p>See also <a href="#stretch">stretch</a>() and <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>. + +<h3 class=fn>void <a name="setStrikeOut"></a>QFont::setStrikeOut ( bool enable ) +</h3> +If <em>enable</em> is TRUE, sets strikeout on; otherwise sets strikeout +off. +<p> <p>See also <a href="#strikeOut">strikeOut</a>() and <a href="qfontinfo.html">QFontInfo</a>. + +<h3 class=fn>void <a name="setStyleHint"></a>QFont::setStyleHint ( <a href="qfont.html#StyleHint-enum">StyleHint</a> hint, <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a> strategy = PreferDefault ) +</h3> +Sets the style hint and strategy to <em>hint</em> and <em>strategy</em>, +respectively. +<p> If these aren't set explicitly the style hint will default to +<a href="#StyleHint-enum">AnyStyle</a> and the style strategy to <a href="#StyleStrategy-enum">PreferDefault</a>. +<p> Qt does not support style hints on X11 since this information +is not provided by the window system. +<p> <p>See also <a href="#StyleHint-enum">StyleHint</a>, <a href="#styleHint">styleHint</a>(), <a href="#StyleStrategy-enum">StyleStrategy</a>, <a href="#styleStrategy">styleStrategy</a>(), and <a href="qfontinfo.html">QFontInfo</a>. + +<p>Examples: <a href="desktop-example.html#x1728">desktop/desktop.cpp</a> and <a href="simple-font-demo-example.html#x2844">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>void <a name="setStyleStrategy"></a>QFont::setStyleStrategy ( <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a> s ) +</h3> +Sets the style strategy for the font to <em>s</em>. +<p> <p>See also <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>. + +<h3 class=fn>void <a name="setUnderline"></a>QFont::setUnderline ( bool enable ) +</h3> +If <em>enable</em> is TRUE, sets underline on; otherwise sets underline +off. +<p> <p>See also <a href="#underline">underline</a>() and <a href="qfontinfo.html">QFontInfo</a>. + +<p>Examples: <a href="simple-font-demo-example.html#x2845">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="menu-example.html#x1861">menu/menu.cpp</a>. +<h3 class=fn>void <a name="setWeight"></a>QFont::setWeight ( int weight ) +</h3> +Sets the weight the font to <em>weight</em>, which should be a value +from the <a href="#Weight-enum">QFont::Weight</a> enumeration. +<p> <p>See also <a href="#weight">weight</a>() and <a href="qfontinfo.html">QFontInfo</a>. + +<p>Example: <a href="simple-font-demo-example.html#x2846">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn>int <a name="stretch"></a>QFont::stretch () const +</h3> +Returns the <a href="layout.html#stretch-factor">stretch factor</a> for the font. +<p> <p>See also <a href="#setStretch">setStretch</a>(). + +<h3 class=fn>bool <a name="strikeOut"></a>QFont::strikeOut () const +</h3> +Returns TRUE if strikeout has been set; otherwise returns FALSE. +<p> <p>See also <a href="#setStrikeOut">setStrikeOut</a>(). + +<h3 class=fn><a href="qfont.html#StyleHint-enum">StyleHint</a> <a name="styleHint"></a>QFont::styleHint () const +</h3> +Returns the StyleHint. +<p> The style hint affects the <a href="#fontmatching">font + matching</a> algorithm. See <a href="#StyleHint-enum">QFont::StyleHint</a> for the list +of strategies. +<p> <p>See also <a href="#setStyleHint">setStyleHint</a>(), <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>, and <a href="qfontinfo.html#styleHint">QFontInfo::styleHint</a>(). + +<h3 class=fn><a href="qfont.html#StyleStrategy-enum">StyleStrategy</a> <a name="styleStrategy"></a>QFont::styleStrategy () const +</h3> +Returns the StyleStrategy. +<p> The style strategy affects the <a href="#fontmatching">font + matching</a> algorithm. See <a href="#StyleStrategy-enum">QFont::StyleStrategy</a> for the +list of strategies. +<p> <p>See also <a href="#setStyleHint">setStyleHint</a>() and <a href="#StyleHint-enum">QFont::StyleHint</a>. + +<h3 class=fn><a href="qstring.html">QString</a> <a name="substitute"></a>QFont::substitute ( const <a href="qstring.html">QString</a> & familyName )<tt> [static]</tt> +</h3> +Returns the first family name to be used whenever <em>familyName</em> is +specified. The lookup is case insensitive. +<p> If there is no substitution for <em>familyName</em>, <em>familyName</em> is +returned. +<p> To obtain a list of substitutions use <a href="#substitutes">substitutes</a>(). +<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>(), and <a href="#removeSubstitution">removeSubstitution</a>(). + +<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="substitutes"></a>QFont::substitutes ( const <a href="qstring.html">QString</a> & familyName )<tt> [static]</tt> +</h3> +Returns a list of family names to be used whenever <em>familyName</em> +is specified. The lookup is case insensitive. +<p> If there is no substitution for <em>familyName</em>, an empty list is +returned. +<p> <p>See also <a href="#substitute">substitute</a>(), <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>(), and <a href="#removeSubstitution">removeSubstitution</a>(). + +<p>Example: <a href="simple-font-demo-example.html#x2847">fonts/simple-qfont-demo/viewer.cpp</a>. +<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="substitutions"></a>QFont::substitutions ()<tt> [static]</tt> +</h3> +Returns a sorted list of substituted family names. +<p> <p>See also <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#removeSubstitution">removeSubstitution</a>(), and <a href="#substitute">substitute</a>(). + +<h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QFont::toString () const +</h3> +Returns a description of the font. The description is a +comma-separated list of the attributes, perfectly suited for use +in <a href="qsettings.html">QSettings</a>. +<p> <p>See also <a href="#fromString">fromString</a>() and <a href="#operator-lt-lt">operator<<</a>(). + +<h3 class=fn>bool <a name="underline"></a>QFont::underline () const +</h3> +Returns TRUE if underline has been set; otherwise returns FALSE. +<p> <p>See also <a href="#setUnderline">setUnderline</a>(). + +<h3 class=fn>int <a name="weight"></a>QFont::weight () const +</h3> +Returns the weight of the font which is one of the enumerated +values from <a href="#Weight-enum">QFont::Weight</a>. +<p> <p>See also <a href="#setWeight">setWeight</a>(), <a href="#Weight-enum">Weight</a>, and <a href="qfontinfo.html">QFontInfo</a>. + +<hr><h2>Related Functions</h2> +<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qfont.html">QFont</a> & font ) +</h3> + +<p> Writes the font <em>font</em> to the data stream <em>s</em>. (<a href="#toString">toString</a>() +writes to a text stream.) +<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>. + +<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qfont.html">QFont</a> & font ) +</h3> + +<p> Reads the font <em>font</em> from the data stream <em>s</em>. (<a href="#fromString">fromString</a>() +reads from a text stream.) +<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>. + +<!-- eof --> +<hr><p> +This file is part of the <a href="index.html">Qt toolkit</a>. +Copyright © 1995-2007 +<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> +<table width=100% cellspacing=0 border=0><tr> +<td>Copyright © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>Qt 3.3.8</div> +</table></div></address></body> +</html> |