~ubuntu-branches/ubuntu/karmic/emacs-snapshot/karmic

« back to all changes in this revision

Viewing changes to doc/emacs/mule.texi

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-04-05 09:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090405091430-nw07lynn2arotjbe
Tags: upstream-20090320
ImportĀ upstreamĀ versionĀ 20090320

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
@c This is part of the Emacs manual.
2
2
@c Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004,
3
 
@c   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
3
@c   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4
4
@c See file emacs.texi for copying conditions.
5
5
@node International, Major Modes, Frames, Top
6
6
@chapter International Character Set Support
103
103
* Fontsets::                Fontsets are collections of fonts
104
104
                              that cover the whole spectrum of characters.
105
105
* Defining Fontsets::       Defining a new fontset.
 
106
* Modifying Fontsets::      Modifying an existing fontset.
106
107
* Undisplayable Characters:: When characters don't display.
107
108
* Unibyte Mode::            You can pick one European character set
108
109
                              to use without multibyte characters.
1333
1334
  A font typically defines shapes for a single alphabet or script.
1334
1335
Therefore, displaying the entire range of scripts that Emacs supports
1335
1336
requires a collection of many fonts.  In Emacs, such a collection is
1336
 
called a @dfn{fontset}.  A fontset is defined by a list of fonts, each
1337
 
assigned to handle a range of character codes.
 
1337
called a @dfn{fontset}.  A fontset is defined by a list of font specs,
 
1338
each assigned to handle a range of character codes, and may fall back
 
1339
on another fontset for characters which are not covered by the fonts
 
1340
it specifies.
1338
1341
 
1339
1342
  Each fontset has a name, like a font.  However, while fonts are
1340
1343
stored in the system and the available font names are defined by the
1347
1350
installation instructions have information on additional font
1348
1351
support.}
1349
1352
 
1350
 
  Emacs creates two fontsets automatically: the @dfn{standard fontset}
1351
 
and the @dfn{startup fontset}.  The standard fontset is most likely to
1352
 
have fonts for a wide variety of non-@acronym{ASCII} characters;
1353
 
however, this is not the default for Emacs to use.  (By default, Emacs
1354
 
tries to find a font that has bold and italic variants.)  You can
1355
 
specify use of the standard fontset with the @samp{-fn} option.  For
1356
 
example,
 
1353
  Emacs creates three fontsets automatically: the @dfn{standard
 
1354
fontset}, the @dfn{startup fontset} and the @dfn{default fontset}.
 
1355
The default fontset is most likely to have fonts for a wide variety of
 
1356
non-@acronym{ASCII} characters and is the default fallback for the
 
1357
other two fontsets, and if you set a default font rather than fontset.
 
1358
However it does not specify font family names, so results can be
 
1359
somewhat random if you use it directly.  You can specify use of a
 
1360
specific fontset with the @samp{-fn} option.  For example,
1357
1361
 
1358
1362
@example
1359
1363
emacs -fn fontset-standard
1363
1367
You can also specify a fontset with the @samp{Font} resource (@pxref{X
1364
1368
Resources}).
1365
1369
 
 
1370
  If no fontset is specified for use, then Emacs uses an
 
1371
@acronym{ASCII} font, with @samp{fontset-default} as a fallback for
 
1372
characters the font does not cover.  The standard fontset is only used if
 
1373
explicitly requested, despite its name.
 
1374
 
1366
1375
  A fontset does not necessarily specify a font for every character
1367
1376
code.  If a fontset specifies no font for a certain character, or if it
1368
1377
specifies a font that does not exist on your system, then it cannot
1373
1382
@section Defining fontsets
1374
1383
 
1375
1384
@vindex standard-fontset-spec
 
1385
@vindex w32-standard-fontset-spec
 
1386
@vindex ns-standard-fontset-spec
1376
1387
@cindex standard fontset
1377
 
  Emacs creates a standard fontset automatically according to the value
 
1388
  When running on X, Emacs creates a standard fontset automatically according to the value
1378
1389
of @code{standard-fontset-spec}.  This fontset's name is
1379
1390
 
1380
1391
@example
1384
1395
@noindent
1385
1396
or just @samp{fontset-standard} for short.
1386
1397
 
 
1398
  On GNUstep and Mac, fontset-standard is created using the value of
 
1399
@code{ns-standard-fontset-spec}, and on Windows it is
 
1400
created using the value of @code{w32-standard-fontset-spec}.
 
1401
 
1387
1402
  Bold, italic, and bold-italic variants of the standard fontset are
1388
1403
created automatically.  Their names have @samp{bold} instead of
1389
1404
@samp{medium}, or @samp{i} instead of @samp{r}, or both.
1390
1405
 
1391
1406
@cindex startup fontset
1392
 
  If you specify a default @acronym{ASCII} font with the @samp{Font} resource or
1393
 
the @samp{-fn} argument, Emacs generates a fontset from it
1394
 
automatically.  This is the @dfn{startup fontset} and its name is
1395
 
@code{fontset-startup}.  It does this by replacing the @var{foundry},
1396
 
@var{family}, @var{add_style}, and @var{average_width} fields of the
1397
 
font name with @samp{*}, replacing @var{charset_registry} field with
1398
 
@samp{fontset}, and replacing @var{charset_encoding} field with
1399
 
@samp{startup}, then using the resulting string to specify a fontset.
 
1407
  Emacs generates a fontset automatically, based on any default
 
1408
@acronym{ASCII} font that you specify with the @samp{Font} resource or
 
1409
the @samp{-fn} argument, or the default font that Emacs found when it
 
1410
started.  This is the @dfn{startup fontset} and its name is
 
1411
@code{fontset-startup}.  It does this by replacing the
 
1412
@var{charset_registry} field with @samp{fontset}, and replacing
 
1413
@var{charset_encoding} field with @samp{startup}, then using the
 
1414
resulting string to specify a fontset.
1400
1415
 
1401
1416
  For instance, if you start Emacs this way,
1402
1417
 
1409
1424
window frame:
1410
1425
 
1411
1426
@example
1412
 
-*-*-medium-r-normal-*-14-140-*-*-*-*-fontset-startup
 
1427
-*-courier-medium-r-normal-*-14-140-*-*-*-*-fontset-startup
1413
1428
@end example
1414
1429
 
 
1430
  The startup fontset will use the font that you specify or a variant
 
1431
with a different registry and encoding for all the characters which
 
1432
are supported by that font, and fallback on @samp{fontset-default} for
 
1433
other characters.
 
1434
 
1415
1435
  With the X resource @samp{Emacs.Font}, you can specify a fontset name
1416
1436
just like an actual font name.  But be careful not to specify a fontset
1417
1437
name in a wildcard resource like @samp{Emacs*Font}---that wildcard
1496
1516
 
1497
1517
  @xref{Font X}, for more information about font naming in X.
1498
1518
 
 
1519
@node Modifying Fontsets
 
1520
@section Modifying Fontsets
 
1521
@cindex fontsets, modifying
 
1522
@findex set-fontset-font
 
1523
 
 
1524
  Fontsets do not always have to be created from scratch.  If only
 
1525
minor changes are required it may be easier to modify an existing
 
1526
fontset.  Modifying @samp{fontset-default} will also affect other
 
1527
fontsets that use it as a fallback, so can be an effective way of
 
1528
fixing problems with the fonts that Emacs chooses for a particular
 
1529
script.
 
1530
 
 
1531
Fontsets can be modified using the function @code{set-fontset-font},
 
1532
specifying a character, a charset, a script, or a range of characters
 
1533
to modify the font for, and a font-spec for the font to be used. Some
 
1534
examples are:
 
1535
 
 
1536
@example
 
1537
;; Use Liberation Mono for latin-3 charset.
 
1538
(set-fontset-font "fontset-default" 'iso-8859-3 "Liberation Mono")
 
1539
 
 
1540
;; Prefer a big5 font for han characters
 
1541
(set-fontset-font "fontset-default" 'han (font-spec :registry "big5")
 
1542
                  nil 'prepend)
 
1543
 
 
1544
;; Use DejaVu Sans Mono as a fallback in fontset-startup before
 
1545
;; resorting to fontset-default.
 
1546
(set-fontset-font "fontset-startup" nil "DejaVu Sans Mono" nil 'append)
 
1547
 
 
1548
;; Use MyPrivateFont for the Unicode private use area.
 
1549
(set-fontset-font "fontset-default"  '(#xe000 . #xf8ff) "MyPrivateFont")
 
1550
 
 
1551
@end example
 
1552
 
 
1553
 
1499
1554
@node Undisplayable Characters
1500
1555
@section Undisplayable Characters
1501
1556