Web lists-archives.com

Re: [kde] how to use kdialog --font ?




ianseeks posted on Tue, 27 Oct 2015 08:05:49 +0000 as excerpted:

> On Monday 26 Oct 2015 20:31:48 J. Leslie Turriff wrote:
>> I want to use kdialog to display a table of values, and to make 
>> the output columns line up, the simplest way is to display the data
>> with a monospace font, e.g. DejaVu Sans Mono.  kdialog --help-qt
>> shows option -fn <name> or --font <name>, but does not describe the
>> format of the <name> string.

[snip the details as not relevant to this particular subthread]

> I've just done a "kdialog ?" and there is no reference to a "--font"
> and thats using this version
> Qt: 4.8.7
> KDE Development Platform: 4.14.12
> KDialog: 1.0

The two of you are using two different sets of help output.

For most kde executables, <command> --help (or <command> ?, which was new 
to me) will output help text in two sections.  The first section is 
generic parameters such as --help itself, the section is command-specific 
options, followed by command specific arguments.

You (ianseeks) were looking at the ?/--help output and apparently focused 
on the (command specific) Options section, which, you correctly noted, 
contains no --font or similar option.

However, the OP (J Leslie Turrif) specifically mentioned help output 
found under --help-qt, which is qt-specific help that generally applies 
to all qt-based programs, pretty much regardless of what they actually 
are.  Similarly, --help-kde is kde-specific help that generally applies 
to all kde-based programs, pretty much regardless of what they are.
--help-all should list all the above, the generic options, followed by 
the command specific options, followed by the qt options, then the kde 
options, and finally the command arguments.

And it can be observed that --help-qt (as well as --help-kde and
--help-all) is indeed listed under the generic options (at least for my 
kdialog 1.0, on kde 4.14.13, on qt 4.8.7) section when invoking
kdialog --help or kdialog ? .

And, --help-qt (and the qt section under --help-all) does indeed list 
both --fn and --font, as synonyms for each other.


So... the --fn/--font option is a generic qt option, that should work 
with most qt-based apps, and is actually a generic option included due to 
the app being qt-based, even if in some cases --fn/--font won't apply, or 
will be overridden by something else.


So far so good.  But I don't have an answer to the original question, 
because while I've occasionally used some other qt option and had it 
work, I've never needed to use that one.  Also, kdialog is a rather 
unusual application, and I'm not /entirely/ sure it honors that 
particular qt option at all.

What I could suggest as the way I'd try figuring it out here is this.

Try using the --fn/--font option with other more traditional qt apps.  In 
particular, if you have any non-kde qt-based apps (based on the same qt 
major version, right now qt4 and qt5 based apps are out, and a test on a 
qt5 app while kdialog is based on qt4, or the reverse, a qt5 based kdialog 
with a test on a qt4 app, won't be particularly helpful), try using the --
font option on them, and see if you can get it to work there, where it's 
much more likely not to be overridden.

Once you get it working there, you'll know the font name pattern to use, 
and can try the same thing on kdialog.

It may also be that in the kde environment, kde overrides the normal qt 
font options, and may override it here, as well.  So it may also be worth 
trying that qt-based non-kde app in a non-kde desktop environment, 
perhaps failsafe, if your distro provides such a login option, or gnome 
or one of the gtk-based desktop environments.  Again, if you get it 
working there, you can try the font name pattern that worked there under 
kde to see if it works under kde as well.


Meanwhile, my google-foo might be a bit better than yours.  Searching 
on...

qt command line option "--font"

... (the quotes around font being critical), the first hit is to a page 
of qt 4.8 embedded documentation, with command-line-options down the 
page.  Here's a direct link:

http://doc.qt.io/qt-4.8/qt-embedded-running.html#command-line-options

The first option listed there is -fn <font>.  It says "The font should be 
specified using an X logical font description."  However, that doesn't 
tell me a whole lot.  The example isn't a whole lot better in that it 
doesn't show size or weight or anything, but here it is:

<command> -fn helvetica

Two things to note about that:

1) -fn not --fn.  So try it with just one -.  It might just work, or 
again, it may be that kde adapted that and it really is two -- under kde.  
Trying it both ways is the only way to know for sure.

2) If you have the helvetica font installed, you can try the example 
verbatim, and if it works, go from there.  If it doesn't, again, try a 
different qt-based app, to be sure that kdialog isn't overriding it for 
some reason.


Another hit, this one in the documentation for pyqt, adds an interesting 
caveat:

-fn or -font font, defines the application font. The font should be 
specified using an X logical font description. Note that this option is 
ignored when Qt is built with fontconfig support enabled.

It may be that your qt and/or kde is built with fontconfig support, and 
that's what's overriding the option.  I believe you'd need to check your 
distro information and/or package deps to be sure.

There's likely more examples and information using the google above...


That is of course assuming nobody else posts with more helpful 
information that can shortcut the process.  I'd give it a few days before 
giving up on that, as sometimes, people don't get to the list every day, 
but will reply in 2-3 or sometimes within the week, if that's the 
frequency at which they check it.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.