1QFont(3qt)                                                          QFont(3qt)
2
3
4

NAME

6       QFont - Font used for drawing text
7

SYNOPSIS

9       #include <qfont.h>
10
11   Public Members
12       enum StyleHint { Helvetica, SansSerif = Helvetica, Times, Serif =
13           Times, Courier, TypeWriter = Courier, OldEnglish, Decorative =
14           OldEnglish, System, AnyStyle }
15       enum StyleStrategy { PreferDefault = 0x0001, PreferBitmap = 0x0002,
16           PreferDevice = 0x0004, PreferOutline = 0x0008, ForceOutline =
17           0x0010, PreferMatch = 0x0020, PreferQuality = 0x0040,
18           PreferAntialias = 0x0080, NoAntialias = 0x0100, OpenGLCompatible =
19           0x0200 }
20       enum Weight { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black
21           = 87 }
22       enum Stretch { UltraCondensed = 50, ExtraCondensed = 62, Condensed =
23           75, SemiCondensed = 87, Unstretched = 100, SemiExpanded = 112,
24           Expanded = 125, ExtraExpanded = 150, UltraExpanded = 200 }
25       QFont ()
26       QFont ( const QString & family, int pointSize = 12, int weight =
27           Normal, bool italic = FALSE )
28       QFont ( const QFont & font )
29       ~QFont ()
30       QString family () const
31       void setFamily ( const QString & family )
32       int pointSize () const
33       float pointSizeFloat () const
34       void setPointSize ( int pointSize )
35       void setPointSizeFloat ( float pointSize )
36       int pixelSize () const
37       void setPixelSize ( int pixelSize )
38       void setPixelSizeFloat ( float pixelSize )  (obsolete)
39       int weight () const
40       void setWeight ( int weight )
41       bool bold () const
42       void setBold ( bool enable )
43       bool italic () const
44       void setItalic ( bool enable )
45       bool underline () const
46       void setUnderline ( bool enable )
47       bool overline () const
48       void setOverline ( bool enable )
49       bool strikeOut () const
50       void setStrikeOut ( bool enable )
51       bool fixedPitch () const
52       void setFixedPitch ( bool enable )
53       StyleHint styleHint () const
54       StyleStrategy styleStrategy () const
55       void setStyleHint ( StyleHint hint, StyleStrategy strategy =
56           PreferDefault )
57       void setStyleStrategy ( StyleStrategy s )
58       int stretch () const
59       void setStretch ( int factor )
60       bool rawMode () const
61       void setRawMode ( bool enable )
62       bool exactMatch () const
63       QFont & operator= ( const QFont & font )
64       bool operator== ( const QFont & f ) const
65       bool operator!= ( const QFont & f ) const
66       bool isCopyOf ( const QFont & f ) const
67       HFONT handle () const
68       void setRawName ( const QString & name )
69       QString rawName () const
70       QString key () const
71       QString toString () const
72       bool fromString ( const QString & descrip )
73       void qwsRenderToDisk ( bool all = TRUE )
74       enum Script { Latin, Greek, Cyrillic, Armenian, Georgian, Runic, Ogham,
75           SpacingModifiers, CombiningMarks, Hebrew, Arabic, Syriac, Thaana,
76           Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu,
77           Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar, Khmer,
78           Han, Hiragana, Katakana, Hangul, Bopomofo, Yi, Ethiopic, Cherokee,
79           CanadianAboriginal, Mongolian, CurrencySymbols, LetterlikeSymbols,
80           NumberForms, MathematicalOperators, TechnicalSymbols,
81           GeometricSymbols, MiscellaneousSymbols, EnclosedAndSquare, Braille,
82           Unicode, Tagalog, Hanunoo, Buhid, Tagbanwa, KatakanaHalfWidth,
83           Limbu, TaiLe }
84       QString defaultFamily () const
85       QString lastResortFamily () const
86       QString lastResortFont () const
87       QFont resolve ( const QFont & other ) const
88
89   Static Public Members
90       QString substitute ( const QString & familyName )
91       QStringList substitutes ( const QString & familyName )
92       QStringList substitutions ()
93       void insertSubstitution ( const QString & familyName, const QString &
94           substituteName )
95       void insertSubstitutions ( const QString & familyName, const
96           QStringList & substituteNames )
97       void removeSubstitution ( const QString & familyName )
98       QFont defaultFont ()  (obsolete)
99       void setDefaultFont ( const QFont & f )  (obsolete)
100
101   Protected Members
102       bool dirty () const
103       int deciPointSize () const
104
106       QDataStream & operator<< ( QDataStream & s, const QFont & font )
107       QDataStream & operator>> ( QDataStream & s, QFont & font )
108

DESCRIPTION

110       The QFont class specifies a font used for drawing text.
111
112       When you create a QFont object you specify various attributes that you
113       want the font to have. Qt will use the font with the specified
114       attributes, or if no matching font exists, Qt will use the closest
115       matching installed font. The attributes of the font that is actually
116       used are retrievable from a QFontInfo object. If the window system
117       provides an exact match exactMatch() returns TRUE. Use QFontMetrics to
118       get measurements, e.g. the pixel length of a string using
119       QFontMetrics::width().
120
121       Use QApplication::setFont() to set the application's default font.
122
123       If a choosen X11 font does not include all the characters that need to
124       be displayed, QFont will try to find the characters in the nearest
125       equivalent fonts. When a QPainter draws a character from a font the
126       QFont will report whether or not it has the character; if it does not,
127       QPainter will draw an unfilled square.
128
129       Create QFonts like this:
130
131           QFont serifFont( "Times", 10, Bold );
132           QFont sansFont( "Helvetica [Cronyx]", 12 );
133
134       The attributes set in the constructor can also be set later, e.g.
135       setFamily(), setPointSize(), setPointSizeFloat(), setWeight() and
136       setItalic(). The remaining attributes must be set after contstruction,
137       e.g. setBold(), setUnderline(), setOverline(), setStrikeOut() and
138       setFixedPitch(). QFontInfo objects should be created after the font's
139       attributes have been set. A QFontInfo object will not change, even if
140       you change the font's attributes. The corresponding "get" functions,
141       e.g. family(), pointSize(), etc., return the values that were set, even
142       though the values used may differ. The actual values are available from
143       a QFontInfo object.
144
145       If the requested font family is unavailable you can influence the font
146       matching algorithm by choosing a particular QFont::StyleHint and
147       QFont::StyleStrategy with setStyleHint(). The default family
148       (corresponding to the current style hint) is returned by
149       defaultFamily().
150
151       The font-matching algorithm has a lastResortFamily() and
152       lastResortFont() in cases where a suitable match cannot be found. You
153       can provide substitutions for font family names using
154       insertSubstitution() and insertSubstitutions(). Substitutions can be
155       removed with removeSubstitution(). Use substitute() to retrieve a
156       family's first substitute, or the family name itself if it has no
157       substitutes. Use substitutes() to retrieve a list of a family's
158       substitutes (which may be empty).
159
160       Every QFont has a key() which you can use, for example, as the key in a
161       cache or dictionary. If you want to store a user's font preferences you
162       could use QSettings, writing the font information with toString() and
163       reading it back with fromString(). The operator<<() and operator>>()
164       functions are also available, but they work on a data stream.
165
166       It is possible to set the height of characters shown on the screen to a
167       specified number of pixels with setPixelSize(); however using
168       setPointSize() has a similar effect and provides device independence.
169
170       Under the X Window System you can set a font using its system specific
171       name with setRawName().
172
173       Loading fonts can be expensive, especially on X11. QFont contains
174       extensive optimizations to make the copying of QFont objects fast, and
175       to cache the results of the slow window system functions it depends
176       upon.
177
178       The font matching algorithm works as follows: <ol type=1>
179
180       1      The specified font family is searched for.
181
182       2      If not found, the styleHint() is used to select a replacement
183              family.
184
185       3      Each replacement font family is searched for.
186
187       4      If none of these are found or there was no styleHint(),
188              "helvetica" will be searched for.
189
190       5      If "helvetica" isn't found Qt will try the lastResortFamily().
191
192       6      If the lastResortFamily() isn't found Qt will try the
193              lastResortFont() which will always return a name of some kind.
194
195       Once a font is found, the remaining attributes are matched in order of
196       priority: <ol type=1>
197
198       7      fixedPitch()
199
200       8      pointSize() (see below)
201
202       9      weight()
203
204       10     italic()
205
206       If you have a font which matches on family, even if none of the other
207       attributes match, this font will be chosen in preference to a font
208       which doesn't match on family but which does match on the other
209       attributes. This is because font family is the dominant search
210       criteria.
211
212       The point size is defined to match if it is within 20% of the requested
213       point size. When several fonts match and are only distinguished by
214       point size, the font with the closest point size to the one requested
215       will be chosen.
216
217       The actual family, font size, weight and other font attributes used for
218       drawing text will depend on what's available for the chosen family
219       under the window system. A QFontInfo object can be used to determine
220       the actual values used for drawing the text.
221
222       Examples:
223
224           QFont f("Helvetica");
225       If you had both an Adobe and a Cronyx Helvetica, you might get either.
226
227           QFont f1( "Helvetica [Cronyx]" );  // Qt 3.x
228           QFont f2( "Cronyx-Helvetica" );    // Qt 2.x compatibility
229       You can specify the foundry you want in the family name. Both fonts, f1
230       and f2, in the above example will be set to "Helvetica [Cronyx]".
231
232       To determine the attributes of the font actually used in the window
233       system, use a QFontInfo object, e.g.
234
235           QFontInfo info( f1 );
236           QString family = info.family();
237
238       To find out font metrics use a QFontMetrics object, e.g.
239
240           QFontMetrics fm( f1 );
241           int pixelWidth = fm.width( "How many pixels wide is this text?" );
242           int pixelHeight = fm.height();
243
244       For more general information on fonts, see the comp.fonts FAQ.
245       Information on encodings can be found from Roman Czyborra's page.
246
247       See also QFontMetrics, QFontInfo, QFontDatabase,
248       QApplication::setFont(), QWidget::font, QPainter::setFont(),
249       QFont::StyleHint, QFont::Weight, Widget Appearance and Style, Graphics
250       Classes, and Implicitly and Explicitly Shared Classes.
251
252   Member Type Documentation

QFont::Script

254       This enum represents Unicode allocated scripts. For exhaustive coverage
255       see The Unicode Standard Version 3.0. The following scripts are
256       supported:
257
258       Modern European alphabetic scripts (left to right):
259
260       QFont::Latin - consists of most alphabets based on the original Latin
261       alphabet.
262
263       QFont::Greek - covers ancient and modern Greek and Coptic.
264
265       QFont::Cyrillic - covers the Slavic and non-Slavic languages using
266       cyrillic alphabets.
267
268       QFont::Armenian - contains the Armenian alphabet used with the Armenian
269       language.
270
271       QFont::Georgian - covers at least the language Georgian.
272
273       QFont::Runic - covers the known constituents of the Runic alphabets
274       used by the early and medieval societies in the Germanic, Scandinavian,
275       and Anglo-Saxon areas.
276
277       QFont::Ogham - is an alphabetical script used to write a very early
278       form of Irish.
279
280       QFont::SpacingModifiers - are small signs indicating modifications to
281       the preceeding letter.
282
283       QFont::CombiningMarks - consist of diacritical marks not specific to a
284       particular alphabet, diacritical marks used in combination with
285       mathematical and technical symbols, and glyph encodings applied to
286       multiple letterforms.
287
288       Middle Eastern scripts (right to left):
289
290       QFont::Hebrew - is used for writing Hebrew, Yiddish, and some other
291       languages.
292
293       QFont::Arabic - covers the Arabic language as well as Persian, Urdu,
294       Kurdish and some others.
295
296       QFont::Syriac - is used to write the active liturgical languages and
297       dialects of several Middle Eastern and Southeast Indian communities.
298
299       QFont::Thaana - is used to write the Maledivian Dhivehi language.
300
301       South and Southeast Asian scripts (left to right with few historical
302       exceptions):
303
304       QFont::Devanagari - covers classical Sanskrit and modern Hindi as well
305       as several other languages.
306
307       QFont::Bengali - is a relative to Devanagari employed to write the
308       Bengali language used in West Bengal/India and Bangladesh as well as
309       several minority languages.
310
311       QFont::Gurmukhi - is another Devanagari relative used to write Punjabi.
312
313       QFont::Gujarati - is closely related to Devanagari and used to write
314       the Gujarati language of the Gujarat state in India.
315
316       QFont::Oriya - is used to write the Oriya language of Orissa
317       state/India.
318
319       QFont::Tamil - is used to write the Tamil language of Tamil Nadu
320       state/India, Sri Lanka, Singapore and parts of Malaysia as well as some
321       minority languages.
322
323       QFont::Telugu - is used to write the Telugu language of Andhra Pradesh
324       state/India and some minority languages.
325
326       QFont::Kannada - is another South Indian script used to write the
327       Kannada language of Karnataka state/India and some minority languages.
328
329       QFont::Malayalam - is used to write the Malayalam language of Kerala
330       state/India.
331
332       QFont::Sinhala - is used for Sri Lanka's majority language Sinhala and
333       is also employed to write Pali, Sanskrit, and Tamil.
334
335       QFont::Thai - is used to write Thai and other Southeast Asian
336       languages.
337
338       QFont::Lao - is a language and script quite similar to Thai.
339
340       QFont::Tibetan - is the script used to write Tibetan in several
341       countries like Tibet, the bordering Indian regions and Nepal. It is
342       also used in the Buddist philosophy and liturgy of the Mongolian
343       cultural area.
344
345       QFont::Myanmar - is mainly used to write the Burmese language of
346       Myanmar (former Burma).
347
348       QFont::Khmer - is the official language of Kampuchea.
349
350       East Asian scripts (traditionally top-down, right to left, modern often
351       horizontal left to right):
352
353       QFont::Han - consists of the CJK (Chinese, Japanese, Korean)
354       idiographic characters.
355
356       QFont::Hiragana - is a cursive syllabary used to indicate phonetics and
357       pronounciation of Japanese words.
358
359       QFont::Katakana - is a non-cursive syllabic script used to write
360       Japanese words with visual emphasis and non-Japanese words in a
361       phonetical manner.
362
363       QFont::Hangul - is a Korean script consisting of alphabetic components.
364
365       QFont::Bopomofo - is a phonetic alphabet for Chinese (mainly Mandarin).
366
367       QFont::Yi - (also called Cuan or Wei) is a syllabary used to write the
368       Yi language of Southwestern China, Myanmar, Laos, and Vietnam.
369
370       Additional scripts that do not fit well into the script categories
371       above:
372
373       QFont::Ethiopic - is a syllabary used by several Central East African
374       languages.
375
376       QFont::Cherokee - is a left-to-right syllabic script used to write the
377       Cherokee language.
378
379       QFont::CanadianAboriginal - consists of the syllabics used by some
380       Canadian aboriginal societies.
381
382       QFont::Mongolian - is the traditional (and recently reintroduced)
383       script used to write Mongolian.
384
385       Symbols:
386
387       QFont::CurrencySymbols - contains currency symbols not encoded in other
388       scripts.
389
390       QFont::LetterlikeSymbols - consists of symbols derived from ordinary
391       letters of an alphabetical script.
392
393       QFont::NumberForms - are provided for compatibility with other existing
394       character sets.
395
396       QFont::MathematicalOperators - consists of encodings for operators,
397       relations and other symbols like arrows used in a mathematical context.
398
399       QFont::TechnicalSymbols - contains representations for control codes,
400       the space symbol, APL symbols and other symbols mainly used in the
401       context of electronic data processing.
402
403       QFont::GeometricSymbols - covers block elements and geometric shapes.
404
405       QFont::MiscellaneousSymbols - consists of a heterogeneous collection of
406       symbols that do not fit any other Unicode character block, e.g.
407       Dingbats.
408
409       QFont::EnclosedAndSquare - is provided for compatibility with some East
410       Asian standards.
411
412       QFont::Braille - is an international writing system used by blind
413       people. This script encodes the 256 eight-dot patterns with the 64 six-
414       dot patterns as a subset.
415
416       QFont::Tagalog
417
418       QFont::Hanunoo
419
420       QFont::Buhid
421
422       QFont::Tagbanwa
423
424       QFont::KatakanaHalfWidth
425
426       QFont::Limbu - (Unicode 4.0)
427
428       QFont::TaiLe - (Unicode 4.0)
429
430       QFont::Unicode - includes all the above scripts.
431

QFont::Stretch

433       Predefined stretch values that follow the CSS naming convention.
434
435       QFont::UltraCondensed - 50
436
437       QFont::ExtraCondensed - 62
438
439       QFont::Condensed - 75
440
441       QFont::SemiCondensed - 87
442
443       QFont::Unstretched - 100
444
445       QFont::SemiExpanded - 112
446
447       QFont::Expanded - 125
448
449       QFont::ExtraExpanded - 150
450
451       QFont::UltraExpanded - 200
452
453       See also setStretch() and stretch().
454

QFont::StyleHint

456       Style hints are used by the font matching algorithm to find an
457       appropriate default family if a selected font family is not available.
458
459       QFont::AnyStyle - leaves the font matching algorithm to choose the
460       family. This is the default.
461
462       QFont::SansSerif - the font matcher prefer sans serif fonts.
463
464       QFont::Helvetica - is a synonym for SansSerif.
465
466       QFont::Serif - the font matcher prefers serif fonts.
467
468       QFont::Times - is a synonym for Serif.
469
470       QFont::TypeWriter - the font matcher prefers fixed pitch fonts.
471
472       QFont::Courier - a synonym for TypeWriter.
473
474       QFont::OldEnglish - the font matcher prefers decorative fonts.
475
476       QFont::Decorative - is a synonym for OldEnglish.
477
478       QFont::System - the font matcher prefers system fonts.
479

QFont::StyleStrategy

481       The style strategy tells the font matching algorithm what type of fonts
482       should be used to find an appropriate default family.
483
484       The following strategies are available:
485
486       QFont::PreferDefault - the default style strategy. It does not prefer
487       any type of font.
488
489       QFont::PreferBitmap - prefers bitmap fonts (as opposed to outline
490       fonts).
491
492       QFont::PreferDevice - prefers device fonts.
493
494       QFont::PreferOutline - prefers outline fonts (as opposed to bitmap
495       fonts).
496
497       QFont::ForceOutline - forces the use of outline fonts.
498
499       QFont::NoAntialias - don't antialias the fonts.
500
501       QFont::PreferAntialias - antialias if possible.
502
503       QFont::OpenGLCompatible - forces the use of OpenGL compatible fonts.
504
505       Any of these may be OR-ed with one of these flags:
506
507       QFont::PreferMatch - prefer an exact match. The font matcher will try
508       to use the exact font size that has been specified.
509
510       QFont::PreferQuality - prefer the best quality font. The font matcher
511       will use the nearest standard point size that the font supports.
512

QFont::Weight

514       Qt uses a weighting scale from 0 to 99 similar to, but not the same as,
515       the scales used in Windows or CSS. A weight of 0 is ultralight, whilst
516       99 will be an extremely black.
517
518       This enum contains the predefined font weights:
519
520       QFont::Light - 25
521
522       QFont::Normal - 50
523
524       QFont::DemiBold - 63
525
526       QFont::Bold - 75
527
528       QFont::Black - 87
529

MEMBER FUNCTION DOCUMENTATION

QFont::QFont ()

532       Constructs a font object that uses the application's default font.
533
534       See also QApplication::setFont() and QApplication::font().
535

QFont::QFont ( const QString & family, int pointSize = 12, int weight =

537       Normal, bool italic = FALSE )
538       Constructs a font object with the specified family, pointSize, weight
539       and italic settings.
540
541       If pointSize is <= 0 it is set to 1.
542
543       The family name may optionally also include a foundry name, e.g.
544       "Helvetica [Cronyx]". (The Qt 2.x syntax, i.e." Cronyx-Helvetica", is
545       also supported.) If the family is available from more than one foundry
546       and the foundry isn't specified, an arbitrary foundry is chosen. If the
547       family isn't available a family will be set using the font matching
548       algorithm.
549
550       See also Weight, setFamily(), setPointSize(), setWeight(), setItalic(),
551       setStyleHint(), and QApplication::font().
552

QFont::QFont ( const QFont & font )

554       Constructs a font that is a copy of font.
555

QFont::~QFont ()

557       Destroys the font object and frees all allocated resources.
558

bool QFont::bold () const

560       Returns TRUE if weight() is a value greater than QFont::Normal;
561       otherwise returns FALSE.
562
563       See also weight(), setBold(), and QFontInfo::bold().
564
565       Example: chart/optionsform.cpp.
566

int QFont::deciPointSize () const [protected]

568       Returns the point size in 1/10ths of a point.
569
570       The returned value will be -1 if the font size has been specified in
571       pixels.
572
573       See also pointSize() and pointSizeFloat().
574

QString QFont::defaultFamily () const

576       Returns the family name that corresponds to the current style hint.
577
578       See also StyleHint, styleHint(), and setStyleHint().
579

QFont QFont::defaultFont () [static]

581       This function is obsolete. It is provided to keep old source working.
582       We strongly advise against using it in new code.
583
584       Please use QApplication::font() instead.
585

bool QFont::dirty () const [protected]

587       Returns TRUE if the font attributes have been changed and the font has
588       to be (re)loaded; otherwise returns FALSE.
589

bool QFont::exactMatch () const

591       Returns TRUE if a window system font exactly matching the settings of
592       this font is available.
593
594       See also QFontInfo.
595

QString QFont::family () const

597       Returns the requested font family name, i.e. the name set in the
598       constructor or the last setFont() call.
599
600       See also setFamily(), substitutes(), and substitute().
601
602       Examples:
603

bool QFont::fixedPitch () const

605       Returns TRUE if fixed pitch has been set; otherwise returns FALSE.
606
607       See also setFixedPitch() and QFontInfo::fixedPitch().
608

bool QFont::fromString ( const QString & descrip )

610       Sets this font to match the description descrip. The description is a
611       comma-separated list of the font attributes, as returned by toString().
612
613       See also toString() and operator>>().
614

HFONT QFont::handle () const

616       Returns the window system handle to the font, for low-level access.
617       Using this function is not portable.
618

void QFont::insertSubstitution ( const QString & familyName, const QString &

620       substituteName ) [static]
621       Inserts the family name substituteName into the substitution table for
622       familyName.
623
624       See also insertSubstitutions(), removeSubstitution(), substitutions(),
625       substitute(), and substitutes().
626
627       Example: fonts/simple-qfont-demo/viewer.cpp.
628

void QFont::insertSubstitutions ( const QString & familyName, const

630       QStringList & substituteNames ) [static]
631       Inserts the list of families substituteNames into the substitution list
632       for familyName.
633
634       See also insertSubstitution(), removeSubstitution(), substitutions(),
635       and substitute().
636
637       Example: fonts/simple-qfont-demo/viewer.cpp.
638

bool QFont::isCopyOf ( const QFont & f ) const

640       Returns TRUE if this font and f are copies of each other, i.e. one of
641       them was created as a copy of the other and neither has been modified
642       since. This is much stricter than equality.
643
644       See also operator=() and operator==().
645

bool QFont::italic () const

647       Returns TRUE if italic has been set; otherwise returns FALSE.
648
649       See also setItalic().
650
651       Example: chart/optionsform.cpp.
652

QString QFont::key () const

654       Returns the font's key, a textual representation of a font. It is
655       typically used as the key for a cache or dictionary of fonts.
656
657       See also QMap.
658

QString QFont::lastResortFamily () const

660       Returns the "last resort" font family name.
661
662       The current implementation tries a wide variety of common fonts,
663       returning the first one it finds. Is is possible that no family is
664       found in which case a null string is returned.
665
666       See also lastResortFont().
667

QString QFont::lastResortFont () const

669       Returns a "last resort" font name for the font matching algorithm. This
670       is used if the last resort family is not available. It will always
671       return a name, if necessary returning something like" fixed" or
672       "system".
673
674       The current implementation tries a wide variety of common fonts,
675       returning the first one it finds. The implementation may change at any
676       time, but this function will always return a string containing
677       something.
678
679       It is theoretically possible that there really isn't a lastResortFont()
680       in which case Qt will abort with an error message. We have not been
681       able to identify a case where this happens. Please report it as a bug
682       if it does, preferably with a list of the fonts you have installed.
683
684       See also lastResortFamily() and rawName().
685

bool QFont::operator!= ( const QFont & f ) const

687       Returns TRUE if this font is different from f; otherwise returns FALSE.
688
689       Two QFonts are considered to be different if their font attributes are
690       different. If rawMode() is enabled for both fonts, only the family
691       fields are compared.
692
693       See also operator==().
694

QFont & QFont::operator= ( const QFont & font )

696       Assigns font to this font and returns a reference to it.
697

bool QFont::operator== ( const QFont & f ) const

699       Returns TRUE if this font is equal to f; otherwise returns FALSE.
700
701       Two QFonts are considered equal if their font attributes are equal. If
702       rawMode() is enabled for both fonts, only the family fields are
703       compared.
704
705       See also operator!=() and isCopyOf().
706

bool QFont::overline () const

708       Returns TRUE if overline has been set; otherwise returns FALSE.
709
710       See also setOverline().
711

int QFont::pixelSize () const

713       Returns the pixel size of the font if it was set with setPixelSize().
714       Returns -1 if the size was set with setPointSize() or
715       setPointSizeFloat().
716
717       See also setPixelSize(), pointSize(), QFontInfo::pointSize(), and
718       QFontInfo::pixelSize().
719

int QFont::pointSize () const

721       Returns the point size of the font. Returns -1 if the font size was
722       specified in pixels.
723
724       See also setPointSize(), deciPointSize(), and pointSizeFloat().
725
726       Examples:
727

float QFont::pointSizeFloat () const

729       Returns the point size of the font. Returns -1 if the font size was
730       specified in pixels.
731
732       See also pointSize(), setPointSizeFloat(), pixelSize(),
733       QFontInfo::pointSize(), and QFontInfo::pixelSize().
734

void QFont::qwsRenderToDisk ( bool all = TRUE )

736       Saves the glyphs in the font that have previously been accessed as a
737       QPF file. If all is TRUE (the default), then before saving, all glyphs
738       are marked as used.
739
740       If the font is large and you are sure that only a subset of characters
741       will ever be required on the target device, passing FALSE for the all
742       parameter can save a significant amount of disk space.
743
744       Note that this function is only applicable on Qt/Embedded.
745

bool QFont::rawMode () const

747       Returns TRUE if raw mode is used for font name matching; otherwise
748       returns FALSE.
749
750       See also setRawMode() and rawName().
751

QString QFont::rawName () const

753       Returns the name of the font within the underlying window system.
754
755       On Windows, this is usually just the family name of a TrueType font.
756
757       On X11, it is an XLFD (X Logical Font Description). When Qt is build
758       with Xft support on X11, the return value can be an Xft pattern or an
759       XLFD.
760
761       Using the return value of this function is usually not portable.
762
763       See also setRawName().
764

void QFont::removeSubstitution ( const QString & familyName ) [static]

766       Removes all the substitutions for familyName.
767
768       See also insertSubstitutions(), insertSubstitution(), substitutions(),
769       and substitute().
770

QFont QFont::resolve ( const QFont & other ) const

772       Returns a new QFont that has attributes copied from other.
773

void QFont::setBold ( bool enable )

775       If enable is true sets the font's weight to QFont::Bold; otherwise sets
776       the weight to QFont::Normal.
777
778       For finer boldness control use setWeight().
779
780       See also bold() and setWeight().
781
782       Examples:
783

void QFont::setDefaultFont ( const QFont & f ) [static]

785       This function is obsolete. It is provided to keep old source working.
786       We strongly advise against using it in new code.
787
788       Please use QApplication::setFont() instead.
789

void QFont::setFamily ( const QString & family )

791       Sets the family name of the font. The name is case insensitive and may
792       include a foundry name.
793
794       The family name may optionally also include a foundry name, e.g.
795       "Helvetica [Cronyx]". (The Qt 2.x syntax, i.e." Cronyx-Helvetica", is
796       also supported.) If the family is available from more than one foundry
797       and the foundry isn't specified, an arbitrary foundry is chosen. If the
798       family isn't available a family will be set using the font matching
799       algorithm.
800
801       See also family(), setStyleHint(), and QFontInfo.
802

void QFont::setFixedPitch ( bool enable )

804       If enable is TRUE, sets fixed pitch on; otherwise sets fixed pitch off.
805
806       See also fixedPitch() and QFontInfo.
807

void QFont::setItalic ( bool enable )

809       If enable is TRUE, italic is set on; otherwise italic is set off.
810
811       See also italic() and QFontInfo.
812
813       Examples:
814

void QFont::setOverline ( bool enable )

816       If enable is TRUE, sets overline on; otherwise sets overline off.
817
818       See also overline() and QFontInfo.
819

void QFont::setPixelSize ( int pixelSize )

821       Sets the font size to pixelSize pixels.
822
823       Using this function makes the font device dependent. Use setPointSize()
824       or setPointSizeFloat() to set the size of the font in a device
825       independent manner.
826
827       See also pixelSize().
828
829       Example: qwerty/qwerty.cpp.
830

void QFont::setPixelSizeFloat ( float pixelSize )

832       This function is obsolete. It is provided to keep old source working.
833       We strongly advise against using it in new code.
834
835       Sets the logical pixel height of font characters when shown on the
836       screen to pixelSize.
837

void QFont::setPointSize ( int pointSize )

839       Sets the point size to pointSize. The point size must be greater than
840       zero.
841
842       See also pointSize() and setPointSizeFloat().
843
844       Example: fonts/simple-qfont-demo/viewer.cpp.
845

void QFont::setPointSizeFloat ( float pointSize )

847       Sets the point size to pointSize. The point size must be greater than
848       zero. The requested precision may not be achieved on all platforms.
849
850       See also pointSizeFloat(), setPointSize(), and setPixelSize().
851

void QFont::setRawMode ( bool enable )

853       If enable is TRUE, turns raw mode on; otherwise turns raw mode off.
854       This function only has an effect under X11.
855
856       If raw mode is enabled, Qt will search for an X font with a complete
857       font name matching the family name, ignoring all other values set for
858       the QFont. If the font name matches several fonts, Qt will use the
859       first font returned by X. QFontInfo cannot be used to fetch information
860       about a QFont using raw mode (it will return the values set in the
861       QFont for all parameters, including the family name).
862
863       Warning: Do not use raw mode unless you really, really need it! In most
864       (if not all) cases, setRawName() is a much better choice.
865
866       See also rawMode() and setRawName().
867

void QFont::setRawName ( const QString & name )

869       Sets a font by its system specific name. The function is particularly
870       useful under X, where system font settings (for example X resources)
871       are usually available in XLFD (X Logical Font Description) form only.
872       You can pass an XLFD as name to this function.
873
874       A font set with setRawName() is still a full-featured QFont. It can be
875       queried (for example with italic()) or modified (for example with
876       setItalic()) and is therefore also suitable for rendering rich text.
877
878       If Qt's internal font database cannot resolve the raw name, the font
879       becomes a raw font with name as its family.
880
881       Note that the present implementation does not handle wildcards in XLFDs
882       well, and that font aliases (file fonts.alias in the font directory on
883       X11) are not supported.
884
885       See also rawName(), setRawMode(), and setFamily().
886

void QFont::setStretch ( int factor )

888       Sets the stretch factor for the font.
889
890       The stretch factor changes the width of all characters in the font by
891       factor percent. For example, setting factor to 150 results in all
892       characters in the font being 1.5 times ( ie. 150% ) wider. The default
893       stretch factor is 100. The minimum stretch factor is 1, and the maximum
894       stretch factor is 4000.
895
896       The stretch factor is only applied to outline fonts. The stretch factor
897       is ignored for bitmap fonts.
898
899       NOTE: QFont cannot stretch XLFD fonts. When loading XLFD fonts on X11,
900       the stretch factor is matched against a predefined set of values for
901       the SETWIDTH_NAME field of the XLFD.
902
903       See also stretch() and QFont::StyleStrategy.
904

void QFont::setStrikeOut ( bool enable )

906       If enable is TRUE, sets strikeout on; otherwise sets strikeout off.
907
908       See also strikeOut() and QFontInfo.
909

void QFont::setStyleHint ( StyleHint hint, StyleStrategy strategy =

911       PreferDefault )
912       Sets the style hint and strategy to hint and strategy, respectively.
913
914       If these aren't set explicitly the style hint will default to AnyStyle
915       and the style strategy to PreferDefault.
916
917       Qt does not support style hints on X11 since this information is not
918       provided by the window system.
919
920       See also StyleHint, styleHint(), StyleStrategy, styleStrategy(), and
921       QFontInfo.
922
923       Examples:
924

void QFont::setStyleStrategy ( StyleStrategy s )

926       Sets the style strategy for the font to s.
927
928       See also QFont::StyleStrategy.
929

void QFont::setUnderline ( bool enable )

931       If enable is TRUE, sets underline on; otherwise sets underline off.
932
933       See also underline() and QFontInfo.
934
935       Examples:
936

void QFont::setWeight ( int weight )

938       Sets the weight the font to weight, which should be a value from the
939       QFont::Weight enumeration.
940
941       See also weight() and QFontInfo.
942
943       Example: fonts/simple-qfont-demo/viewer.cpp.
944

int QFont::stretch () const

946       Returns the stretch factor for the font.
947
948       See also setStretch().
949

bool QFont::strikeOut () const

951       Returns TRUE if strikeout has been set; otherwise returns FALSE.
952
953       See also setStrikeOut().
954

StyleHint QFont::styleHint () const

956       Returns the StyleHint.
957
958       The style hint affects the font matching algorithm. See
959       QFont::StyleHint for the list of strategies.
960
961       See also setStyleHint(), QFont::StyleStrategy, and
962       QFontInfo::styleHint().
963

StyleStrategy QFont::styleStrategy () const

965       Returns the StyleStrategy.
966
967       The style strategy affects the font matching algorithm. See
968       QFont::StyleStrategy for the list of strategies.
969
970       See also setStyleHint() and QFont::StyleHint.
971

QString QFont::substitute ( const QString & familyName ) [static]

973       Returns the first family name to be used whenever familyName is
974       specified. The lookup is case insensitive.
975
976       If there is no substitution for familyName, familyName is returned.
977
978       To obtain a list of substitutions use substitutes().
979
980       See also setFamily(), insertSubstitutions(), insertSubstitution(), and
981       removeSubstitution().
982

QStringList QFont::substitutes ( const QString & familyName ) [static]

984       Returns a list of family names to be used whenever familyName is
985       specified. The lookup is case insensitive.
986
987       If there is no substitution for familyName, an empty list is returned.
988
989       See also substitute(), insertSubstitutions(), insertSubstitution(), and
990       removeSubstitution().
991
992       Example: fonts/simple-qfont-demo/viewer.cpp.
993

QStringList QFont::substitutions () [static]

995       Returns a sorted list of substituted family names.
996
997       See also insertSubstitution(), removeSubstitution(), and substitute().
998

QString QFont::toString () const

1000       Returns a description of the font. The description is a comma-separated
1001       list of the attributes, perfectly suited for use in QSettings.
1002
1003       See also fromString() and operator<<().
1004

bool QFont::underline () const

1006       Returns TRUE if underline has been set; otherwise returns FALSE.
1007
1008       See also setUnderline().
1009

int QFont::weight () const

1011       Returns the weight of the font which is one of the enumerated values
1012       from QFont::Weight.
1013
1014       See also setWeight(), Weight, and QFontInfo.
1015

QDataStream & operator<< ( QDataStream & s, const QFont & font )

1018       Writes the font font to the data stream s. (toString() writes to a text
1019       stream.)
1020
1021       See also Format of the QDataStream operators.
1022

QDataStream & operator>> ( QDataStream & s, QFont & font )

1024       Reads the font font from the data stream s. (fromString() reads from a
1025       text stream.)
1026
1027       See also Format of the QDataStream operators.
1028
1029

SEE ALSO

1031       http://doc.trolltech.com/qfont.html
1032       http://www.trolltech.com/faq/tech.html
1033
1035       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
1036       license file included in the distribution for a complete license
1037       statement.
1038

AUTHOR

1040       Generated automatically from the source code.
1041

BUGS

1043       If you find a bug in Qt, please report it as described in
1044       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
1045       help you. Thank you.
1046
1047       The definitive Qt documentation is provided in HTML format; it is
1048       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
1049       web browser. This man page is provided as a convenience for those users
1050       who prefer man pages, although this format is not officially supported
1051       by Trolltech.
1052
1053       If you find errors in this manual page, please report them to qt-
1054       bugs@trolltech.com.  Please include the name of the manual page
1055       (qfont.3qt) and the Qt version (3.3.8).
1056
1057
1058
1059Trolltech AS                    2 February 2007                     QFont(3qt)
Impressum