个人工具

“UbuntuHelp:ComposeKey”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/ComposeKey}} {{Languages|UbuntuHelp:ComposeKey}} == Introduction == An alternative to the Gnome CharacterMap application is to use Compose Key ...)
 
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/ComposeKey}}
 
{{From|https://help.ubuntu.com/community/ComposeKey}}
 
{{Languages|UbuntuHelp:ComposeKey}}
 
{{Languages|UbuntuHelp:ComposeKey}}
 
 
 
== Introduction ==
 
== Introduction ==
 
 
An alternative to the Gnome CharacterMap application is to use Compose Key sequences. This is much  faster for special characters which are often used once the required sequences have been learned.
 
An alternative to the Gnome CharacterMap application is to use Compose Key sequences. This is much  faster for special characters which are often used once the required sequences have been learned.
 
The instructions below have been tested with Ubuntu 7.04 and Gnome but should also be valid for others using Gnome.
 
The instructions below have been tested with Ubuntu 7.04 and Gnome but should also be valid for others using Gnome.
 
 
== Keyboard ==
 
== Keyboard ==
 
First check your keyboard layout options (System -> Keyboard: Layout Options).
 
First check your keyboard layout options (System -> Keyboard: Layout Options).
第13行: 第9行:
 
* Click on the triangle beside ''Third level choosers''. If no box is ticked then '''AltGr''' is the 'Third level chooser'.
 
* Click on the triangle beside ''Third level choosers''. If no box is ticked then '''AltGr''' is the 'Third level chooser'.
 
If a box is ticked then remember to use that key rather than '''AltGr''' and '''Shift+AltGr''' for the instructions on this page.
 
If a box is ticked then remember to use that key rather than '''AltGr''' and '''Shift+AltGr''' for the instructions on this page.
 
 
There are three methods of entering characters not displayed on keycaps by using combinations of keys.
 
There are three methods of entering characters not displayed on keycaps by using combinations of keys.
 
 
To discover which characters are mapped to a key combination it is best to experiment by opening a text editor and typing.
 
To discover which characters are mapped to a key combination it is best to experiment by opening a text editor and typing.
 
 
The examples below refer to a UK English keyboard, other keyboards and language choices will produce different results.
 
The examples below refer to a UK English keyboard, other keyboards and language choices will produce different results.
 
 
== Third level chooser ==
 
== Third level chooser ==
 
Holding down the '''AltGr''' key and pressing another key will produce a third level character.
 
Holding down the '''AltGr''' key and pressing another key will produce a third level character.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
keys:              +AltGr
 
keys:              +AltGr
第29行: 第20行:
 
asdfghjkl        æßðđŋħjĸł
 
asdfghjkl        æßðđŋħjĸł
 
\zxcvbnm .        |«»¢“”nµ ·
 
\zxcvbnm .        |«»¢“”nµ ·
 
 
</nowiki></pre>
 
</nowiki></pre>
 
 
== Compose key ==
 
== Compose key ==
 
Keying the combination '''Shift'''+'''AltGr''', releasing these keys, then entering two other keys will produce a special character. Many of these will be the reasonable result of overtyping the character keys, eg.
 
Keying the combination '''Shift'''+'''AltGr''', releasing these keys, then entering two other keys will produce a special character. Many of these will be the reasonable result of overtyping the character keys, eg.
第38行: 第27行:
 
Shift+AltGr  o  /  ø  (&oslash;)
 
Shift+AltGr  o  /  ø  (&oslash;)
 
</nowiki></pre>
 
</nowiki></pre>
 
 
There are also ''dead key'' sequences in which two keys, a 'dead' accent key then a letter key are used to produce an accented character.
 
There are also ''dead key'' sequences in which two keys, a 'dead' accent key then a letter key are used to produce an accented character.
 
 
=== Compose key sequences ===
 
=== Compose key sequences ===
 
To discover all the '''Compose key''' combinations possible and, if required set your own preferred combinations:
 
To discover all the '''Compose key''' combinations possible and, if required set your own preferred combinations:
 
 
==== Gnome ====
 
==== Gnome ====
 
The compose key sequences used by Gnome are derived from the X compose tables of XFree86 version 4.0 with further modifications to provide a Gnome standard for all locales. They are hard coded into the program in source file  <code><nowiki>gtk+-2.10.7/gtk/gtkimcontextsimple.c</nowiki></code>
 
The compose key sequences used by Gnome are derived from the X compose tables of XFree86 version 4.0 with further modifications to provide a Gnome standard for all locales. They are hard coded into the program in source file  <code><nowiki>gtk+-2.10.7/gtk/gtkimcontextsimple.c</nowiki></code>
 
 
 
* '''GtkComposeTable''' lists the ''Multi_key'' part of that table.
 
* '''GtkComposeTable''' lists the ''Multi_key'' part of that table.
 
 
* '''GtkDeadKeyTable''' lists the ''dead key'' combinations.
 
* '''GtkDeadKeyTable''' lists the ''dead key'' combinations.
 
 
==== XIM ====
 
==== XIM ====
 
The Gnome hard coding can be overruled in favour of the original Xwindow Input Method (XIM) by setting the environment variable GTK_IM_MODULE. This can be set in the <code><nowiki>/etc/environment</nowiki></code> file, but if the machine has more than one user then it is best set from the home directory on a per user basis by modifying <code><nowiki>~/.gnomerc</nowiki></code> or  <code><nowiki>~/.Xsession</nowiki></code>
 
The Gnome hard coding can be overruled in favour of the original Xwindow Input Method (XIM) by setting the environment variable GTK_IM_MODULE. This can be set in the <code><nowiki>/etc/environment</nowiki></code> file, but if the machine has more than one user then it is best set from the home directory on a per user basis by modifying <code><nowiki>~/.gnomerc</nowiki></code> or  <code><nowiki>~/.Xsession</nowiki></code>
 
 
<code><nowiki>export GTK_IM_MODULE = "xim"</nowiki></code>
 
<code><nowiki>export GTK_IM_MODULE = "xim"</nowiki></code>
 
 
Look at /usr/share/X11/locale/compose.dir to find the appropriate compose table for your locale, eg:
 
Look at /usr/share/X11/locale/compose.dir to find the appropriate compose table for your locale, eg:
 
<pre><nowiki>
 
<pre><nowiki>
第65行: 第45行:
 
en_US.UTF-8/Compose en_GB.UTF-8
 
en_US.UTF-8/Compose en_GB.UTF-8
 
</nowiki></pre>
 
</nowiki></pre>
 
 
then looking at /usr/share/X11/locale/en_US.UTF-8/Compose
 
then looking at /usr/share/X11/locale/en_US.UTF-8/Compose
 
<pre><nowiki>
 
<pre><nowiki>
第76行: 第55行:
 
<Multi_key> <minus> <d>          : "đ"  dstroke # LATIN SMALL LETTER D WITH STROKE
 
<Multi_key> <minus> <d>          : "đ"  dstroke # LATIN SMALL LETTER D WITH STROKE
 
</nowiki></pre>
 
</nowiki></pre>
 
 
<Multi_Key> is the Compose ('''Shift+AltGr''') key
 
<Multi_Key> is the Compose ('''Shift+AltGr''') key
 
 
To create your own set of compose keys copy the file /usr/share/X11/locale/en_US.UTF-8/Compose (or if you prefer the equivalent file for your locale) to your home directory as .XCompose
 
To create your own set of compose keys copy the file /usr/share/X11/locale/en_US.UTF-8/Compose (or if you prefer the equivalent file for your locale) to your home directory as .XCompose
 
<code><nowiki> # cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose </nowiki></code>
 
<code><nowiki> # cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose </nowiki></code>
 
and edit this file.
 
and edit this file.
 
 
== Unicode composition ==
 
== Unicode composition ==
 
Another means to enter non-keycap characters is to enter them as Unicode character number.
 
Another means to enter non-keycap characters is to enter them as Unicode character number.
 
 
key '''Shift'''+'''Ctrl'''+'''U''' then enter the hexadecimal (0123456789abcde) Unicode character code point.
 
key '''Shift'''+'''Ctrl'''+'''U''' then enter the hexadecimal (0123456789abcde) Unicode character code point.
 
'''Shift+Ctrl+U''' will  display an underlined u, release the keys, then type the unicode value (four hex digits), then space bar.
 
'''Shift+Ctrl+U''' will  display an underlined u, release the keys, then type the unicode value (four hex digits), then space bar.
第92行: 第67行:
 
Shift+Ctrl+U 2203  ∃  (&exist;)
 
Shift+Ctrl+U 2203  ∃  (&exist;)
 
</nowiki></pre>
 
</nowiki></pre>
 
 
== References ==
 
== References ==
 
[http://www.unicode.org/charts/charindex.html] the authority for ''unicode'' matters
 
[http://www.unicode.org/charts/charindex.html] the authority for ''unicode'' matters
 
 
[http://www.haypocalc.com/wiki/Touche_compose] (en française)
 
[http://www.haypocalc.com/wiki/Touche_compose] (en française)
 
 
----
 
----
 
[[category:CategoryDocumentation]]
 
[[category:CategoryDocumentation]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 16:32的版本

Introduction

An alternative to the Gnome CharacterMap application is to use Compose Key sequences. This is much faster for special characters which are often used once the required sequences have been learned. The instructions below have been tested with Ubuntu 7.04 and Gnome but should also be valid for others using Gnome.

Keyboard

First check your keyboard layout options (System -> Keyboard: Layout Options).

  • Click on the triangle beside Compose key position to display a list of options; if no box is ticked then the Shift+AltGr (Right Alt Key) is the Compose key (also called the Multi_Key in Xwindow documentation).
  • Click on the triangle beside Third level choosers. If no box is ticked then AltGr is the 'Third level chooser'.

If a box is ticked then remember to use that key rather than AltGr and Shift+AltGr for the instructions on this page. There are three methods of entering characters not displayed on keycaps by using combinations of keys. To discover which characters are mapped to a key combination it is best to experiment by opening a text editor and typing. The examples below refer to a UK English keyboard, other keyboards and language choices will produce different results.

Third level chooser

Holding down the AltGr key and pressing another key will produce a third level character.

keys:              +AltGr
`1234567890-      |¹²³€½¾{[]}\
qwertyuiop        @ł€¶ŧ←↓→øþ
asdfghjkl         æßðđŋħjĸł
\zxcvbnm .        |«»¢“”nµ ·

Compose key

Keying the combination Shift+AltGr, releasing these keys, then entering two other keys will produce a special character. Many of these will be the reasonable result of overtyping the character keys, eg.

Shift+AltGr  a  ~   ã  (ã)
Shift+AltGr  o  /   ø  (ø)

There are also dead key sequences in which two keys, a 'dead' accent key then a letter key are used to produce an accented character.

Compose key sequences

To discover all the Compose key combinations possible and, if required set your own preferred combinations:

Gnome

The compose key sequences used by Gnome are derived from the X compose tables of XFree86 version 4.0 with further modifications to provide a Gnome standard for all locales. They are hard coded into the program in source file gtk+-2.10.7/gtk/gtkimcontextsimple.c

  • GtkComposeTable lists the Multi_key part of that table.
  • GtkDeadKeyTable lists the dead key combinations.

XIM

The Gnome hard coding can be overruled in favour of the original Xwindow Input Method (XIM) by setting the environment variable GTK_IM_MODULE. This can be set in the /etc/environment file, but if the machine has more than one user then it is best set from the home directory on a per user basis by modifying ~/.gnomerc or ~/.Xsession export GTK_IM_MODULE = "xim" Look at /usr/share/X11/locale/compose.dir to find the appropriate compose table for your locale, eg:

#	This file contains compose table file names.  The first word is the
#	compose table file name and the second word is the full locale
#	name.
#...
en_US.UTF-8/Compose		en_GB.UTF-8

then looking at /usr/share/X11/locale/en_US.UTF-8/Compose

# UTF-8 (Unicode) compose sequence
#...
<Multi_key> <p> <exclam>          : "¶"   paragraph # PILCROW SIGN
<Multi_key> <P> <exclam>          : "¶"   paragraph # PILCROW SIGN
<Multi_key> <plus> <minus>        : "±"   plusminus # PLUS-MINUS SIGN
<Multi_key> <question> <question> : "¿"   questiondown # INVERTED QUESTION MARK
<Multi_key> <minus> <d>           : "đ"   dstroke # LATIN SMALL LETTER D WITH STROKE

<Multi_Key> is the Compose (Shift+AltGr) key To create your own set of compose keys copy the file /usr/share/X11/locale/en_US.UTF-8/Compose (or if you prefer the equivalent file for your locale) to your home directory as .XCompose # cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose and edit this file.

Unicode composition

Another means to enter non-keycap characters is to enter them as Unicode character number. key Shift+Ctrl+U then enter the hexadecimal (0123456789abcde) Unicode character code point. Shift+Ctrl+U will display an underlined u, release the keys, then type the unicode value (four hex digits), then space bar.

Shift+Ctrl+U 00f4   ô   (ô)
Shift+Ctrl+U 2203   ∃  (∃)

References

[1] the authority for unicode matters [2] (en française)