#1866 XIM input box font size hard coded

obsolete: 8.4.9
Joe English
Larry W. Virden

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
> */
> char **missing_list;
> int missing_count;
> char *def_string;
> dispPtr->inputXfs =
> XCreateFontSet(dispPtr->display,
> &missing_list,
> &missing_count, &def_string);
> if (missing_count > 0) {
> }
> }
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
?-style style?
#choices: root, over

where the ones with comments are new. The argument
fontset to
-preeditfont would be any string that can be passed to

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()
A simpler mechanism, like a new resource, is probably
more feasible.


    • labels: 104343 --> 70. Event Loop
    • assigned_to: nobody --> hobbs
  • Joe English
    Joe English

    Logged In: YES

    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.

  • Joe English
    Joe English

    • assigned_to: hobbs --> jenglish
  • Joe English
    Joe English

    Logged In: YES

    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.