In using XIM on SPARC Solaris, with kinput2, it was
discovered that kinput2's font size is based on the
font of the top level used to contain the input entry
box. The Tk code affected is in tkEvent.c:
>
> if (dispPtr->inputXfs == NULL) {
> /*
> * We only need to create one
XFontSet
> */
> char **missing_list;
> int missing_count;
> char *def_string;
>
> dispPtr->inputXfs =
> XCreateFontSet(dispPtr->display,
>
"-*-*-*-R-Normal--14-130-75-75-*-*",
> &missing_list,
> &missing_count, &def_string);
> if (missing_count > 0) {
>
XFreeStringList(missing_list);
> }
> }
>
where the fontset is hard coded.
So for a user to change the font size, they have to
rebuild Tk!
The developer who researched this wrote:
>
> My thoughts on this would be to extend the tk
> useinputmethods command > (<http://wiki.tcl.tk/8695>,
>
<http://www.tcl.tk/man/tcl8.4/TkCmd/tk.htm>) to
something like this:
tk useinputmethods ?-displayof window?
?-preeditfont fontset?
#example -preeditfont
'-*-*-*-R-Normal--24-230-75-75-*-*'
?-style style?
#choices: root, over
?boolean?
where the ones with comments are new. The argument
fontset to
-preeditfont would be any string that can be passed to
XCreateFontSet()
(<http://www.xfree86.org/4.1.0/XCreateFontSet.3.html>).
I was thinking about a sample implementation, but I
haven't had a chance to do more than think. In
particular, I haven't checked whether the fontset can
be changed dynamically with XSetICValues()
(<http://www.xfree86.org/current/XSetICValues.3.html>).
A simpler mechanism, like a new resource, is probably
more feasible.
Logged In: YES
user_id=68433
According to the Xlib programmer's manual, XIM clients don't
need to set XNFontSet at all; if one isn't provided, the IM
server will use a suitable default.
This might be a better approach; the IM server will probably
have a much better idea of what font(s) to use than Tk or
the application programmer will.
Logged In: YES
user_id=68433
I wrote:
> XIM clients don't need to set XNFontSet at all [...]
Apparently not true: kinput2 (at least) needs this to be set
if XIMPreeditPosition is selected, otherwise XCreateIC
returns NULL.
Nevermind.