Podobno konsol'nomu rezhimu, X Window takzhe trebuet nekotoroj nastrojki. Nastrojka vklyuchaet v sebya nastrojku vvoda i ustanovku shriftov dlya X Window. Dannye dejstviya obsuzhdayutsya nizhe.
Dlya specificheskoj informacii kasayushchejsya vashego distributiva vam sleduet obratit'sya v razdel Kirillizaciya distributivov.
Prezhde vsego, vy dolzhny dostat' shrifty, soderzhashchie izobrazheniya
kirillicheskih simvolov v sootvetstvuyushchih mestah. Sleduet otmetit',
chto vse sovremennye distributivy imeyut KOI8-R shrifty, bolee-menee
prigodnye dlya ispol'zovaniya, tak chto
esli xlsfonts ne pokazyvaet ih, to oni prosto ne installirovany ili ne
vklyucheny v X Font Path
.
X Window vklyuchila nabor KOI8-R shriftov razrabotannyh KOI8-R Cronyx, eshche v konce 1995 goda. |ti shrifty yavlyayutsya takzhe chast'yu XFree86.
Nekotorye distributivy (kak pravilo ochen' starye) mogut ne vklyuchat' kirillicheskie shrifty dlya X Window - v etom sluchae ih pridetsya ustanavlivat' samim.
Podrobnee o shriftah dlya X-window i o tom gde ih mozhno najti smotrite v razdele SHrifty dlya X-window.
Bolee sovremennuyu kollekciyu shriftov dlya X windows mozhno vzyat' u Dmitriya Bolhovityanova po adresu paket CYR_RFX.
Poetomu, vam sleduet proverit', ustanovleny li eti shrifty v vashej sisteme. Sprosite sistemnogo administratora ili, esli vy- eto on i est', prover'te vashu sistemu sami, a imenno:
xlsfonts | grep koi8
'. Esli v rezul'tate
vypolneniya komandy poyavitsya spisok shriftov, to vash X server uzhe znaet
ob ih sushchestvovanii.find / -name crox\*.pcf\*dlya togo, chtoby najti mestopolozhenie shriftov kirillicy v sisteme. Vy dolzhny budete sdelat' eti shrifty dostupnymi dlya X servera, kak - ya ob®yasnyu nizhe.
Esli vy ne nashli takih shriftov v vashej sisteme, to vy dolzhny ustanovit' ih sami:
/usr/lib/X11/fonts/cyrillic
dlya nastrojki vsej sistemy ili prosto
sozdajte katalog u sebya tol'ko dlya personal'nogo pol'zovaniya.
*.bdf
fajly),
to vy dolzhny skompilirovat' ih. Dlya kazhdogo shrifta vypolnite:
bdftopcf -o <font>.pcf <font>.bdfMozhete szhat' ih s pomoshch'yu programmy
gzip
(ochen' starye X servera ne podderzhivaet szhatye shrifty):
gzip *.pcfEsli zhe vy vse-taki hotite pomestit' novye shrifty v uzhe sushchestvuyushchij katalog shriftov, to vy dolzhny "srastit'" staryj i novye fajly s imenem
fonts.alias
v tom sluchae, estestvenno,
esli oni oba sushchestvuyut.
fonts.dir
.
Vy ne dolzhny sozdavat' etot spisok vruchnuyu. Vmesto etogo vypolnite:
cd "direktoriya gde lezhat shrifty" mkfontdir .
XF86Config
. CHtoby najti ego raspolozhenie, prosmotrite,
chto skazhet startx
pri zapuske (V Redhat etot fajl obychno nahoditsya
v /etc/X11). Bolee podrobno smotrite man XF86Config (4/5)
.
xinit
. Dobav'te novyj katalog k
fajlu zapuska xinit
. Bolee podrobno smotrite xinit(1x)
.
~/.xinitrc
(im takzhe mozhet byt' ~/.Xclients
ili
~/.xsession
, dlya pol'zovatelej
GNOME special'nym fajlom zapuska obychno yavlyaetsya ~/.gnomerc
).
Dobav'te sleduyushchie komandy v etot fajl:
xset +fp <novyj katalog shriftov> xset fp rehashObratite vnimanie na opciyu '
+fp
' - eto oznachaet, chto novye
shrifty budut dobavleny v nachale spiska direktorij so shriftami. To
est', esli prikladnaya programma zaprashivaet, skazhem, shrift fixed
, to
budet podstavlen fixed font s kirillicheskimi simvolami, chego my
i dobivalis'. Esli nuzhno ustanovit' shrifty v neskol'kih kodirovkah,
to komanda xset +fp
s predpochtitel'noj kodirovkoj dolzhna byt'
posle drugih.
xfontsel
(1x), chtoby udostoverit'sya v
vashej sposobny vybirat' shrifty kirillicy.CHtoby zastavit' X klienta ispol'zovat' shrifty kirillicy, vy
dolzhny ustanovit' sootvetstvuyushchie X resurs. Naprimer, ya delayu
kirillicheskij shrift zadannym po umolchaniyu v moem ~/.Xdefaults
:
*font: 6x13
Tak kak moi shrifty kirillicy pervye v spiske poiska shriftov (smotri
vyvod programmy 'xset q
'), to
oni i podstavlyayutsya, esli programma trebuet kakoj-libo shrift s
imenem, sovpadayushchem s kakim-libo iz shriftov, lezhashchih v kirillicheskoj
direktorii.
Vot prostye primery. Esli vy hotite nauchit' sootvetstvuyushchij X
klient pol'zovat'sya kirillicheskim shriftom, to vy dolzhny uznat'
tip resursa, kotoryj vam nado izmenit' (eto mozhno sdelat',
ispol'zuya editres
(1x)) i opredelit' ego ili v baze dannyh
resursov, ili v komandnoj stroke. Naprimer mozhno sdelat' tak:
$ xterm -font '-cronyx-*-bold-*-*-*-19-*-*-*-*-*-*-*'
...zapustit xterm s neskol'ko urodlivym shriftom;
$ xfontsel -xrm '*quitButton.font: -*-times-*-*-*-*-13-*-*-*-*-*-koi8-*'
...ustanovit Cyrillic Times shrift dlya knopki Quit
programmy
xfontsel
.
U tehnologii TrueType, vzyatoj na vooruzhenie operacionnymi sistemami serii Windows, net mnogih nedostatkov, kotorye prisutstvuyut pri rabote so shriftami standartnym obrazom u X. Krome togo, sushchestvuet mnozhestvo kirillicheskih TrueType shriftov.
Podrobnee o tom gde ih mozhno najti mozhno posmotret' v razdele SHrifty TrueType.
K schast'yu, eti shrifty mozhno ispol'zovat' i v X Window. Sushchestvuet TrueType server shriftov XFSFT dlya X. Podderzhka TrueType vstroena vo vse sovremennye distributivy XFree86.
Kommercheskie X servera uzhe dovol'no davno vklyuchili podderzhku TrueType v svoi distributivy (Acelerated X, Metro X).
Ustanovochnaya procedura server shriftov dovol'no prosta: delajte to, chto skazano v dokumentacii.
Dalee privoditsya primer togo, kak mozhno ustanovit' TrueType shrifty - o tom kak podsunut' ih X Window - smotrite razdel Ustanovka shriftov dlya X Window
Dlya togo, chtoby standartnye shrifty otobrazhalis' v nuzhnoj
nam kodirovke - v dannom sluchae dlya primera vzyata kodirovka cp1251,
v kataloge gde lezhat TrueType shrifty neobhodimo
sozdat' dva odinakovyh fajla - fonts.dir
i fonts.scale
-
sleduyushchego vida:
12 timesi.ttf -monotype-Times New Roman-medium-i-normal--0-0-0-0-p-0-microsoft-cp1251 timesbi.ttf -monotype-Times New Roman-bold-i-normal-0-0-0-0-p-0-microsoft-cp1251 timesbd.ttf -monotype-Times New Roman-bold-r-normal--0-0-0-0-p-0-microsoft-cp1251 times.ttf -monotype-Times New Roman-medium-r-normal--0-0-0-0-p-0-microsoft-cp1251 couri.ttf -monotype-Courier New-medium-i-normal--0-0-0-0-m-0-microsoft-cp1251 courbi.ttf -monotype-Courier New-bold-i-normal--0-0-0-0-m-0-microsoft-cp1251 courbd.ttf -monotype-Courier New-bold-r-normal--0-0-0-0-m-0-microsoft-cp1251 cour.ttf -monotype-Courier New-medium-r-normal--0-0-0-0-m-0-microsoft-cp1251 ariali.ttf -monotype-Arial-medium-i-normal--0-0-0-0-p-0-microsoft-cp1251 arialbi.ttf -monotype-Arial-bold-i-normal--0-0-0-0-p-0-microsoft-cp1251 arialbd.ttf -monotype-Arial-bold-r-normal--0-0-0-0-p-0-microsoft-cp1251 arial.ttf -monotype-Arial-medium-r-normal--0-0-0-0-p-0-microsoft-cp1251
Krome etogo, syuda zhe neobhodimo polozhit' fajl encodings.dir
, imeyushchij
vsego dve stroki:
1 microsoft-cp1251 /usr/X11R6/lib/X11/fonts/encodings/microsoft-cp1251.enc.gz
Esli vam nuzhny eti shrifty v kodirovke KOI8-R, to vmesto
microsoft-cp1251
sleduet propisat' koi8-r
.
Sleduet otmetit' odnu veshch', imeyushchuyu otnoshenie k kirillicheskoj nastrojke: vam sleduet ispol'zovat' opciyu perekodirovki:
xfstt ... --encoding koi8-r,windows-1251,iso8859-1
Posle etogo novye shrifty budut dostupny dlya X Window - etot fakt vy
mozhete proverit', zapustiv xfontsel
i poigrav s ttf semejstvom
shriftov.
V poslednih vypuskah X (X11R61 i vyshe) imeyutsya dva "standartnyh" sposoba vvoda s klaviatury: rodnoj sposob, rabotayushchij cherez utilitu xmodmap (sm. razdel xmodmap) (sejchas eto sposob stremitel'no ustarevaet, hotya yavlyaetsya nadezhnym i horosho izuchennym), i novyj - Xkb ili X KeyBoard (razdel Xkb).
Polnuyu i ischerpyvayushchuyu (dazhe slishkom ischerpyvayushchuyu) dokumentaciyu po nastrojke Xkb mozhno najti u Ivana Paskalya
Pri starte X-servera, modul' XKB zachityvaet vse neobhodimye dannye iz tekstovyh fajlov, kotorye obrazuyut "bazu dannyh" nastroek XKB.
Strogo govorya, bol'shinstvo iz etih fajlov sam modul' XKB ne chitaet. On vyzyvaet programmu xkbcomp, kotoraya perevodit soderzhimoe etih fajlov v dvoichnyj format, ponyatnyj neposredstvenno modulyu XKB.
No dlya nastrojki eto ne tak uzh vazhno, poskol'ku vyzov xkbcomp proishodit avtomaticheski, nezametno dlya pol'zovatelya.
Baza dannyh, neobhodimyh XKB, sostoit iz 5 komponentov
<TLDE>= 49; <AE01> = 10;
Vse eti komponenty razlozheny po odnoimennym direktoriyam v
direktorii {XROOT}/lib/X11/xkb
(v
dal'nejshem, ya budu oboznachat' ee {XKBROOT}
).
Ves' nabor komponentov, neobhodimyh dlya nastrojki XKB, opisyvaetsya v fajle konfiguracii X-servera v sekcii Keyboard.
CHtoby nastroit' XKB, v fajle konfiguracii X-servera, nado zadat' parametry XkbRules, XkbModel, XkbLayout i, esli vam nuzhno chto-to ne sovsem standartnoe - XkbVariant i XkbOptions.
Naprimer,
XkbRules "xfree86" XkbModel "pc104" XkbLayout "ru" XkbVariant "winkeys" XkbOptions "grp:shift_toggle"
oznachaet, chto XKB dolzhen v sootvetstvii s pravilami, opisannymi v
fajle {XKBROOT}/rules/xfree86
, vybrat' nastrojki dlya
klaviatury tipa "pc104" (104 knopki),
russkogo alfavita (anglijskij alfavit budet vklyuchen "po umolchaniyu"),
variant - "standartnyj" (to est', etot parametr mozhno bylo ne pisat').
Esli u vas "windows" klaviatura, to polezno ukazat' XkbVariant
kak "winkeys", v protivnom sluchae ostav'te etu opciyu pustoj - "".
V samom konce idut dopolnitel'nye opcii dlya vashej "raskladki klaviatury" -
"grp:shift_toggle".
Nebol'shoe otstuplenie - "o klavishe - pereklyuchatele rus/lat".
Drugie varianty smeny kodirovki:
Kogda byl napisan pervyj variant etih rekomendacij, sama raskladka "russkoj" klaviatury (symbols/ru) vklyuchala v sebya i "pereklyuchatel' grupp" - rus/lat, "podveshennyj" na klavishu CapsLock. S odnoj storony eto bylo udobno - v prostejshem sluchae dostatochno bylo vybrat' "russkuyu raskladku" i vy avtomaticheski poluchali i klavishu dlya pereklyucheniya "na russkij". No, s drugoj storony, eto bylo neudobno dlya teh, kto predpochitaet v kachestve pereklyuchatelya rus/lat druguyu klavishu (ili kombinaciyu klavish). Konechno, vybrat' drugoj pereklyuchatel' ne sostavlyalo truda, no pri etom ostavalsya i pereklyuchatel' na CapsLock, chto mnogim ne nravilos'. Dlya togo, chtoby ubrat' ego, nado bylo "zalezt'" v sootvetstvuyushchij fajl i vruchnuyu podpravlyat' sootvetstvuyushchuyu raskladku.
V konce koncov (nachinaya s versii 3.3.4) sami razrabotchiki XFree ubrali etot "pereklyuchatel'" iz "russkoj raskladki". No, v svyazi s etim poyavilis' i nekotorye problemy - teper' klavishu-pereklyuchatel' nado yavno "zakazyvat'" pri konfigurirovanii XKB.
Samyj prostoj sposob nastrojki - ispol'zovat' programmu dlya avtomaticheskoj nastrojki X-window.
V XFree86 takaya programma nazyvaetsya XF86Setup.
Pri etom "po umolchaniyu" ispol'zuyutsya "pravila" (XkbRules) - xfree86. Vam nuzhno budet tol'ko vybrat' "model'" (XkbModel), "shemu" (XkbLayout) i "sposob pereklyucheniya grupp" (pereklyuchatel' "RUS/LAT").
Krome togo, pri zhelanii vy mozhete izmenit' "polozhenie klavishi Ctrl". Estestvenno, v konfiguracii eto budet vyglyadet' kak sootvetstvuyushchie strochki XkbOptions.
Itak. Zapustite programmu XF86Setup
, vyberite razdel Keyboard.
V etom razdele vyberite iz menyu Model (tip
klaviatury) i Layout (yazyk). Ne zabud'te otmetit' v otdel'nyh
spiskah (v pravoj chasti) podhodyashchij
"pereklyuchatel' grupp" i, esli hotite - "raspolozhenie Ctrl".
Pri vyhode iz programmy ona zapishet sootvetstvuyushchie strochki v fajl konfiguracii XFree v sekcii Keyboard.
Dlya smeny kodirovki mozhno vospol'zovat'sya lyuboj iz mnogochislennyh programm pereklyucheniya kodovyh stranic cherez xkb - naprimer ya pol'zuyus' programmoj xxkb Ivana Paskalya.
Offtopic: Esli v fajle /usr/X11R6/lib/X11/xkb/compat/iso9995
pomenyat'
indicator "Group2" {
na
indicator "Scroll Lock" {
to v otvet na pereklyuchenie registra budet zagorat'sya lampochka Scroll Lock
na klaviature.
Opisannoe nizhe otnositsya k otnositel'no starym versiyam X-Window (kto by skazal k kakim - zavedomo k versiyam men'shim 3.3.3) v kotoryh sposob Xkb (razdel Xkb) ne rabotaet.
V sluchae rusifikacii cherez xmodmap pervoe, chto vy dolzhny sdelat', eto otklyuchit' Xkb!.
CHtoby otklyuchit' podderzhku Xkb, v
fajle XF86Config
izuchite razdel Keyboard
i zakommentirujte vse stroki,
nachinayushchiesya s Xkb (registr ne imeet znacheniya).
Vzamen dobav'te sleduyushchuyu stroku:
XkbDisable
Programma xmodmap
pozvolyaet nastroit' kody, sootvetstvuyushchie
razlichnymi simvolam i ih kombinaciyam. |ta nastrojka osnovana na
fajle, soderzhashchem tablicu perekodirovki.
YA nastoyatel'no sovetuyu vam samostoyatel'no ne razbirat'sya s xmodmap
,
po krajnej mere,
dlya nachala. Vy ne poluchite nichego, krome golovnoj boli i
razocharovaniya. Vmesto etogo ya rekomenduyu vam ustanovit' paket
xruskb,
kotoryj pozvolyaet vam skonfigurirovat' bol'shinstvo
vhodnyh parametrov perekodirovki bez neobhodimosti stalkivat'sya s
xmodmap
.
Vse opisannoe prilozhimo ne tol'ko dlya russkogo yazyka. Nado izmenit' tol'ko klaviaturnye raskladki, nu i shrifty, estestvenno, budut imet' druguyu kodirovku.
Vozmozhno, najdennye vami shrifty okazhutsya v otlichnoj ot nuzhnoj vam kodirovki. Dlya perekodirovki BDF-shriftov mozhno ispol'zovat' programmu trbdf iz paketa trscripts.
|ta programma podderzhivaet kodovye stranicy ibm855, ibm866, iso-8859-5, koi8-c, koi8-r, koi8-u, mac-cyrillic, mik, unicode i ecma-cyrillic. Simvoly, otsutstvuyushchie v ishodnoj kodirovke, approksimiruyutsya, tak chto ee mozhno ispol'zovat' naprimer dlya generacii KOI8-U shriftov iz KOI8-R.
Esli vam nuzhna podderzhka cp1251, to vy stolknetes' s tem, chto poka oficial'ny XFree ne podderzhivaet etu kodirovku. Imeyutsya tri resheniya:
locale.alias
(obychno on
nahoditsya v kataloge /usr/X11R6/lib/X11/locale
) stroku vida
be_BY.CP1251 en_US.ISO8859-1Konechno vmesto
be_BY.CP1251
Vy mozhete postavit' zdes' stroku dlya
ispol'zuemoj Vami lokali. (Odnako imejte vvidu, chto imeyushchayasya uzhe v
etom fajle stroka o Bolgarskoj lokali bg_BG
neverna i ee nuzhno
udalit'.)Esli dlya kirillizacii klaviatury ispol'zuete metod cherez utilitu
xmodmap
, to etim vse i konchitsya. Esli zhe vy zahotite
ispol'zovat' Xkb metod, to v klaviaturnoj raskladke vmesto
simvolicheskih imen nuzhno ispol'zovat' kody simvolov soglasno cp1251.
Naprimer dlya belorusskoj raskladki vmesto
key <AD01> { [ q, Q ], [ Cyrillic_shorti, Cyrillic_SHORTI ] };
nuzhno ispol'zovat'
key <AD01> { [ q, Q ], [ 0xe9, 0xc9 ] };
Zamechanie. Tol'ko versii XFree posle 4.0.0 podderzhivayut KOI8-U. Esli u vas otsutstvuet podderzhka KOI8-U, a vam nuzhna imenno eta kodirovka, to vy mozhete vospol'zovat'sya vsem vysheopisannom o cp1251.