X11-big-cursor MINIHOWTO <subtitle>X WINDOW SYSTEM でマウスカーソルを大きくして使う方法 <author><url name="J&oe;rg Schneider" url="mailto:joerg.schneider@ira.uka.de"> <date>V2, 1997 年 8 月 11 日 <trans><url name="宮田 忍 (Shinobu MIYATA)" url="mailto:shinobu@emichan.rim.or.jp"> <tdate>1997 年 11 月 19 日 <abstract> <!-- This document describes how to use enlarged mouse cursors with the X window system. --> このドキュメントは X window system 上のマウスカーソルを拡大して 使う方法を記述しています。 <!-- <itemize> <item><htmlurl url="#intro" name="Introduction"> <item><htmlurl url="#howto" name="How to do it"> <item><htmlurl url="#notes" name="Notes and limitations"> <item><htmlurl url="#tech" name="Technical discussion"> <item><htmlurl url="#ideas" name="Other ideas how to make the mouse cursor more visible"> <item><htmlurl url="#info" name="Related info"> <itemize> <item><htmlurl url="#fontserver" name="How to use a fontserver"> <itemize> <item><htmlurl url="#fsconfig" name="Setting up a font server"> </itemize> <item><htmlurl url="#getbdf" name="How to get the bdf source for some font"> </itemize> </itemize> <itemize> <item><htmlurl url="#intro" name="導入"> <item><htmlurl url="#howto" name="方法"> <item><htmlurl url="#notes" name="注意と限界"> <item><htmlurl url="#tech" name="技術的議論"> <item><htmlurl url="#ideas" name="さらにマウスカーソルを見やすくする、その他のアイデア"> <item><htmlurl url="#info" name="関連した情報"> <itemize> <item><htmlurl url="#fontserver" name="フォントサーバの使い方"> <itemize> <item><htmlurl url="#fsconfig" name="フォントサーバのセットアップ"> </itemize> <item><htmlurl url="#getbdf" name="フォントの bdf ソースの入手法"> </itemize> </itemize> --> </abstract> <toc> <!-- <sect>Introduction<label id=top> <p>There are several reasons why the standard X mouse cursors are hard to track for some people: <itemize> <item> when running X on a notebook with low contrast LCD <item> on normal screens when using high resolution, 1600x1280 e. g. <item> for visually impaired persons even on normal hardware </itemize> In all cases it might help to use enlarged mouse cursors. Ideally this job should be done by a single X program that automatically enlarges every mouse cursor. To my knowledge there is no simple way to write a utility like this, because the X protocol has no provision to query mouse cursors. For more details see section <ref id="tech" name="Technical discussion"> below. If we aim for a less general goal, though, something can be done: There is a set of standard mouse cursors that can be found in the cursor font (try <TT>xfd -fn cursor</TT> to look at it). Most programs use these mouse cursors and the key idea is to replace the standard cursor font with an enlarged version. --> <sect>導入<label id=top> <p>普通の X マウスカーソルが追いづらい人々にはそれなりの理由があります: <itemize> <item>解像度の低い LCD のノート型パソコンで X を使う方 <item>普通のモニタで、例えば 1600x1280 のような高解像度を使う方 <item>普通のハードウェアですら視覚的に問題のある方 </itemize> どの場合に対してもマウスカーソルを拡大して使えると助かるでしょう。 理想としては、この作業はどのマウスカーソルも自動的に拡大する、一つの X のプログラムによってなされるべきでしょう。 私の知識においては、そのようなユーティリティは単純には書けません。 というのも、X のプロトコルにはマウスカーソルを追跡するような機能が 備わっていないからです。以下の <ref id="tech" name="技術的議論"> において 詳細を述べるとします。 しかしながら、もし、多少一般的でないゴール設定をするならば、 以下の方法が考えられます: カーソルフォントのなかに、普通のマウスカーソルのセットがあります (<tt>xfd -fn cursor</tt> とすることで、見ることが出来ます)。 ほとんどのプログラムはこれらを使いますので、拡大化したものを これらと置き換える、というのが基本的な考え方です。 <!-- <sect>About this document <p> The motivation for this MINIHOWTO was a visually impaired co-student who asked me how to enlarge the mouse cursor under X. After I found out how this can be done, I wrote an initial version of this document. The knowledge about the method described here does not seem to be common, so I decided to share it and submitted this document as a Linux MINIHOWTO, despite the fact that it is <em/not specific to Linux at all/. As all other MINIHOWTOs it can be found in the home of of the <url name="Linux Documentation Project (LDP)" url="http://sunsite.unc.edu/LDP/HOWTO/">. The <url name=master url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/master/"> of this document is maintained in the SGML/linuxdoc format. This makes it possible to automatically provide versions in the following formats (which can be found in the same place as the master): html, text, LaTeX, DVI, PostScript, GNU info. <url name="Shinobu Miyata" url="mailto:shinobu@emichan.rim.or.jp"> has done a Japanese translation of this MINIHOWTO. It can be found in <url url="http://i11www.ira.uka.de/˜schneid/jp/X11-big-cursor/">. --> <sect>この文章について <p>この MINIHOWTO は 私の、視覚的に問題のある同級生の一人に、 X 上のマウスカーソルの拡大化を尋ねられたことから書き始めたものです。 まず方法を見つけて、初版を仕上げました。ここに記述されている方法論は 良く知られてはいないようですので、<em/Linux に全く特化していませんが/ Linux MINIHOWTO という形でまとめ、公開しました。その他の MINIHOWTO は <url name="Linux Documentation Project (LDP)" url="http://sunsite.unc.edu/LDP/HOWTO/"> に見ることが出来ます。 この文章の<url name="マスター" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/master/"> は SGML/linuxdoc 形式で管理されています。このお蔭で、自動的に、html、text、 LaTeX、DVI、PostScript、GNU info の各形式に容易に変換されて提供されています (master とおなじディレクトリに置かれています)。 この文章の日本語訳は<url name="宮田 忍" url="mailto:shinobu@emichan.rim.or.jp"> が行ない、 <url url="http://i11www.ira.uka.de/˜schneid/jp/X11-big-cursor/"> に置かれています。 <!-- <sect>How to do it<label id=howto> <p> Follow the steps detailed below. If you don't want to get and compile the bdfresize package yourself, you can skip to step 3 and download a magnified font instead of creating it. <enum> <item> get cursor.bdf, the source of the cursor font, from some X distribution, e. g. from <url url="ftp://ftp.x.org/pub/R6.3/xc/fonts/bdf/misc/cursor.bdf"> (if you don't find it there try an archie search or get it from <url name="my copy" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/cursor.bdf">). <item> get, compile and install the bdfresize package from <url url="ftp://ftp.cs.titech.ac.jp/X11/contrib/Local/bdfresize-1.4.tar.Z"> (or from <url name="my copy" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/bdfresize-1.4.tar.gz">): <verb> zcat bdfresize-1.4.tar.Z | tar xf - cd bdfresize-1.4 xmkmf make </verb> On Linux you probably have to use: <verb> make CCOPTIONS='-include /usr/include/bsd/bsd.h' clean all </verb> <item> create a directory and install a magnified cursor font in it (magnification factor 2 in this example): <verb> mkdir $HOME/fonts bdfresize -f 2 cursor.bdf | bdftopcf >$HOME/fonts/cursor2.pcf mkfontdir $HOME/fonts </verb> I have prepared some <url name="cursor fonts" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/fonts/"> with the following magnification factors: 1.5, 2, 2.5, 3, 4, 5, 6, 7, 8 and 16. You can download one of them an copy it to <tt>$HOME/fonts</tt> if you don't want to use bdfresize. <item> modify your <TT>.xinitrc</TT> or <TT>.xsession</TT> file: before any X client (that uses cursors) is started the following commands must be executed: <verb> xset +fp $HOME/fonts xsetroot -cursor_name X_cursor </verb> <item> leave your X session and restart. </enum> That's it—now all mouse cursors should have doubled in size. --> <sect>方法<label id=howto> <p> 以下に詳細を示します。もし bdfresize パッケージをコンパイルするのを 避けたければ、Step 3 を飛ばし、拡大化したフォントを、作る代わりに the Net から入手することも出来ます。 <enum> <item>カーソルフォントのソース、cursor.bdf を例えば <url url="ftp://ftp.x.org/pub/R6.3/xc/fonts/bdf/misc/cursor.bdf"> のような X の配布先より入手する。(もしそこになければ archie で探すか、 <url name="my copy" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/cursor.bdf"> から入手可能です。) <item>bdfresize パッケージを、例えば、<url url="ftp://ftp.cs.titech.ac.jp/X11/contrib/bdfresize-1.4.tar.Z">(や <url name="my copy" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/bdfresize-1.4.tar.gz"> ) から入手しインストールする。 <verb> zcat bdfresize-1.4.tar.Z | tar xf - cd bdfresize-1.4 xmkmf make </verb> Linux 上ならば、 <verb> make CCOPTIONS='-include /usr/include/bsd/bsd.h' clean all </verb> とする必要があるかもしれません。 <item>拡大化したカーソルフォント用のディレクトリをつくり、インストールする。 (以下の例では拡大化ファクタを2として行ないます) <verb> mkdir $HOME/fonts bdfresize -f 2 cursor.bdf | bdftopcf >$HOME/fonts/cursor2.pcf mkfontdir $HOME/fonts </verb> 拡大化ファクタ 1.5、2、2.5、3、4、5、6、7、8、そして 16の <url name="カーソルフォント" url="http://i11www.ira.uka.de/˜schneid/X11-big-cursor/fonts/"> を作りましたので、bfdresize を使いたくない場合には ダウンロードして <tt>$HOME/fonts</tt>に置いて下さい。 <item>自分の .xinitrc もしくは .xsession ファイルの内容を変更する: (カーソルを使う) X クライアントすべてに先んじて以下の命令が 実行されるようにします。 <verb> xset +fp $HOME/fonts xsetroot -cursor_name X_cursor </verb> <item>X のセッションから抜け、X を再起動する。 </enum> 以上です。—これでマウスカーソルがすべて 2 倍になったはずです。 <!-- <sect>Notes and limitations<label id=notes> <p> <itemize> <item> X servers may have a limit for the maximum cursor size, especially if they use a hardware implementation for the mouse cursor. Others do not have such a limit. E. g. XF86_S3 3.3 works even with a 512x512 mouse cursor (rather slowly). <item> The magnified cursor font must have the same name as the original font (the <em/font name/ must be <TT>cursor</TT>, <em/file name/ does not matter)—that is no problem as <TT>bdfresize</TT> does not change the font name. <item> The directory with the new cursor font must be placed before the directory with the standard cursor font in the the font path—this is accomplished with <TT>xset +fp</TT> (as opposed to <TT>xset fp+</TT>). <item> Changes in <tt>$HOME/fonts/</tt> will be visible only after the command <TT>mkfontdir $HOME/fonts; xset fp rehash</TT> and only in newly started X clients (more exactly: for newly created cursors). <item> <TT>xset +fp path</TT> may not work on a X-Terminal. In this case a font server (see the section <ref id=fontserver name="How to use a fontserver">) can be used if supported by the X-Terminal or some other method to install the font on the X-Terminal (this can generally only be done by your system administrator). <item> The same approach can be used for <TT>olcursor</TT> and <tt>decw$cursor</tt> fonts and any other cursor font you may encounter. <item> Cursor fonts produced by bdfresize don't look smooth, especially at larger magnification factors. It would be nice if someone could create better looking handcrafted version at some common sizes. </itemize> --> <sect>注意と限界<label id=notes> <p> <itemize> <item>X サーバ、特にハードウェアにマウスカーソルを依存している場合には、 マウスカーソルを拡大化できる大きさに限度があるかも知れません。それら以外ならば そのような限界はありません。例えば、XF86_S3 3.3 ならば (遅いものの) 512x512 サイズのマウスカーソルが動きます。 <item>拡大化されたカーソルフォントの名前は、元のものと同じものでなければ なりません(<TT>cursor</TT> という<em/フォントの名前/のことで、 <em/ファイル名/は問題ではありません) — この点は、<TT>bdfresize</TT> が フォントの名前を変えないので問題ありません。 <item>新しいカーソルフォントのディレクトリは、フォントパスのなかでは 本来のものよりも前に来なくてはなりません — この点は <TT>xset +fp</TT> で 解決します(この動作の逆は <TT>xset fp+</TT> です)。 <item><tt>$HOME/fonts/</tt> の中身の変更は <TT>mkfontdir $HOME/fonts; xset fp rehash</TT> の実行後に 立ち上がる X のクライアントに (更に正確に述べるならば、 それも、新たに作られたカーソルに対して) のみ反映します。 <item><TT>xset +fp path</TT> は X-Terminal では作動しないかも知れません。 この場合、もし X-Terminal にサポートされているならばフォントサーバが使えますし、 (see the section <ref id=fontserver name="フォントサーバの使い方">)、 もしくは、(一般的にはあなたのシステム管理者のみが可能ですが) 他の方法で X-Terminalにフォントをインストールすることができます。 <item><TT>olcursor</TT> や <TT>decw$cursor</TT>、 そして、あなたが出会うだろう他のフォントに対しても今回と同じ手法が取れます。 <item> bcfresize で作られたカーソルフォントは、大きく拡大されると特に、 滑らかな形をしていません。誰かが、ある共通のサイズに関してもっと見ための良い 手作りのものを用意すれば良いのですが。。。 </itemize> <!-- <sect>Technical discussion<label id=tech> <p>Is it possible to write a X program that enlarges cursors automatically? <descrip> <tag/(Partial) solution 1/ Use the XTestCompareCursor from the XTEST extension. For all windows that the mouse pointer enters compare the cursor of this window with a set of `known' cursors (e. g. from the cursor font). If the cursor is found, replace it with an enlarged version, otherwise either leave it alone or substitute a standard cursor. This will only work where the XTest extension is available. <tag/Solution 2/ Write a proxy X server that relays all client requests unchanged to the real X server, except that it intercepts all requests corresponing to the <TT>XCreate*Cursor</TT> Xlib functions. <TT>XCreate*Cursor</TT> requests should be modified to use an enlarged cursor. This proxy server simulates a new display, e. g. <tt/:1/. All clients that connect to this display (e. g. <tt/xterm -display :1/) are displayed on the real server (normally <tt/:0/) and their mouse cursors are enlarged automatically. The mouse cursors of clients that connect to <tt/:0/ will remain <em/unchanged/. </descrip> --> <sect>技術的議論<label id=tech> <p>自動的にカーソルを拡大化する、X プログラムを書くことは可能でしょうか? <descrip> <tag/(部分)解 1/ XTEST 拡張から、XTestCompareCursor を使うのです。 どのウインドウに対して、マウスポインタは"既知の"カーソルセット (例えばカーソルフォント)とそのウインドウのカーソルの比較に入ります。 もしカーソルが見つかれば、それを拡大化したものに置き換え、見つからなければ そのままにするか、普通のカーソルに置き換えます。この方法は XTest 拡張の 有効なもののみで実現されます。 <tag/解 2/ <TT>XCreate*Cursor</TT> Xlib 関数に対するすべての要求を中断し、 その他の要求は変えずに本来の X サーバに中継する代理 X サーバを書くことです。 そこで、<TT>XCreate*Cursor</TT> の要求が拡大化されたカーソルを使うように 変更させるのです。 この代理サーバは、例えば<tt/:1/. のような新しいディスプレイをつくり出します。 このディスプレイに接続するすべてのクライアント、例えば <tt/xterm -display :1/ は本来のサーバ、通常 <tt/:0/、に表示され、そのマウスカーソルが自動的に 拡大されるのです。しかし、<tt/:0/ に接続したクライアントのマウスカーソルは <em/変わらない/のです。 </descrip> <!-- <sect>Other ideas how to make the mouse cursor more visible<label id=ideas> <p>Here are some ideas for rather simple X programs that might make mouse cursors easier to track. <itemize> <item> When a hot key is pressed display something (big cursor, small window, shaped window) at pointer position for 0.5s. <item> use XRecolorCursor to change the mouse cursor color every 0.1s </itemize> A more demanding project would be <bf/mouse trails/ à la windoze, i. e. when the mouse is moved and the mouse cursor needs to be drawn in a different position, then the old mouse cursor does not disappear at once, but after a short delay. Mouse trails would be probably best implemented in a X server, but it might be feasible to do it as a X client, or better as a proxy server (see section <ref id="tech" name="Technical discussion"> for details). --> <sect>さらにマウスカーソルを見やすくする、その他のアイデア<label id=ideas> <p>マウスカーソルを追いやすくする、もっと簡単な X プログラムのアイデアを 挙げるとします。 <itemize> <item>ホットキーが押された時、ポインタの位置に 0.5 秒間何か (大きなカーソルや 小さいウインドウ、形付けられたウインドウ)を表示する。 <item>XRecolorCursor を用いて 0.1 秒毎にマウスカーソルの色を変える。 </itemize> さらに苛酷なプロジェクトとしては <bf/mouse trails/ à la windoze、すなわち、 マウスが移動し、マウスカーソルが別の位置に示される必要がある場合、元の位置の マウスはすぐには消えず、少し遅れて消える、というものです。 マウストレイルは X サーバの中では多分よく実行されるものですが X のクライアントとしてこれを実現するのも可能でしょうし、 代理サーバとしてならばもっと良いかも知れません (<ref id="tech" name="技術的議論"> で詳細を御覧下さい)。 <!-- <sect>Related info<label id=info> <sect1>How to use a font server<label id=fontserver> <p>A font server is a net service that provides a set of X11 fonts with a simple protocol. It can be queried which fonts it provides and will supply the font bitmap data on request. You might want to use a font server to provide the X server with a modified cursor font, instead of telling it where to find the font on the file system. This method is especially handy if you use several machines that don't share a common file system or if you use X terminals that support the font server protocol. A font server program and associated tools comes with the X11R5+ distribution (AFAIK). --> <sect>関連した情報<label id=info> <sect1>フォントサーバの使い方<label id=fontserver> <p> フォントサーバとは、簡単なプロトコルで X11 のフォントセットを提供する ネットサービスです。どのフォントを提供しているのか、もしくは、要求に応じて どのフォントのビットマップデータを供給するかを調べることができます。 ファイルシステム上のフォントを探す代わりに、手の加えられたカーソルフォントを X サーバに提供するフォントサーバを使いたくなるかも知れません。 この方法は、共通のファイルシステムを共用していない数台のマシンを使っていたり、 フォントサーバのプロトコルを理解できる X ターミナルを使っているならば、特に 手頃でしょう。 フォントサーバのプログラムと関連したツールは X11R5 とその distribution (AFAIK) にあります。 <!-- <sect2>Setting up a font server<label id=fsconfig> <p>Read the manual pages <em>fs(1)</em>, <em>fslsfonts(1)</em> (or <em>xfs(1)</em>, <em>xfslsfonts(1)</em> under X11R6) and try it—it isn't hard. Say, you are running the server on host <TT>some.host.edu</TT> on port 7100. You can test the setup with the command <TT>fslsfonts -server some.host.edu:7100</TT> To actually use the server issue the command <TT>xset +fp tcp/some.host.edu:7100</TT> which should return without an error message. --> <sect2>フォントサーバのセットアップ <p><em>fs(1)</em> や <em>fslsfonts(1)</em> (もしくは X11R6 の <em>xfs(1)</em> や <em>xfslsfonts</em>) のマニュアルページを読んで、挑戦して下さい。難しくは ないでしょう。例えば、<TT>some.host.edu</TT> というホスト上の 7100 番ポートで サーバを動かすのであれば、 <TT>fslsfonts -server some.host.edu:7100</TT> というコマンドでセットアップを試みることができます。 実際にサーバを使う時は、 <TT> xset +fp tcp/some.host.edu:7100</TT> を発行し、エラーメッセージがなければ良いでしょう。 <!-- <sect1>How to get the bdf source for some font<label id=getbdf> <p>If you have set up a font server simply use <TT>fstobdf</TT> which comes with the font server. Alternatively you may try <TT>getbdf</TT> which can dump any installed X11 font to a bdf file. --> <sect1>フォントの bdf ソースの入手法<label id=getbdf> <p>もし、フォントサーバを立ち上げたのならば、フォントサーバについて来る <TT>fstobdf</TT> を使えばよいのです。 代わりに、<TT>getbdf</TT> を実行して、インストールされている X11 のフォントから bdf ファイルをダンプすることもできます。 </article> <!-- LocalWords: MINIHOWTO rg url mailto joerg schneider ira uka de LCD xfd --> <!-- LocalWords: fn co SGML linuxdoc html DVI PostScript bdf bdfresize mkdir --> <!-- LocalWords: bdftopcf pcf mkfontdir xset fp xsetroot olcursor decw XTest --> <!-- LocalWords: XCreate Xlib XRecolorCursor windoze AFAIK fs xfs edu archie --> <!-- LocalWords: fslsfonts xfslsfonts tcp fstobdf getbdf zcat xf cd xmkmf usr --> <!-- LocalWords: CCOPTIONS bsd -->