It appears to me that kdialog is ignoring the '--font' option. (kdialog has a lot of "missing features", "misfeatures", etc. it's a shame)
However, Ref: https://nowardev.wordpress.com/2013/06/28/kdialog-set-fonts/ $ kdialog --geometry 1024x768 --msgbox "<FONT FACE="Monospace">$(cat /etc/motd)</FONT>" renders a monospace font, but in an unre-sizable fixed window :-( (i.e. --geometry is ignored) This seems to mostly work: $ cat /tmp/kdialog.txt <pre style="font-family: monospace; font-size:24pt">The programs included with the Debian GNU/Linux system are free software;</p> <pre style="font-family: monospace; font-size:24pt">the exact distribution terms for each program are described in the</p> <pre style="font-family: monospace; font-size:24pt">individual files in /usr/share/doc/*/copyright.</p> <pre style="font-family: monospace; font-size:6pt"> Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.</p> <p style="font-size:30px">This is a paragraph.</p> $kdialog --geometry 1024x768 --textbox /tmp/kdialog.txt The "HTML" parser seems to be very limited. It is line oriented (i.e. a <CR> terminates any current deviation from defaults, so you have to prefix every line with what you want). 'font-color' is not supported, i suppose many things aren't. So, this example works (IT WORKS FOR ME(TM)) $ lsblk | sed -e 's/^/<pre style="font-family: monospace; font-size:12pt">/;s/$/<\/pre>/' > /tmp/kdialog.txt $ kdialog --geometry 1024x768 --textbox /tmp/kdialog.txt --or-- kdialog --textinputbox "$(lsblk | sed -e 's/^/<pre style="font-family: monospace; font-size:12pt">/;s/$/<\/pre>/')" "" 1 1 but the following does not (using bash process substitution) $ kdialog --geometry 1024x768 --textbox <(lsblk | sed -e 's/^/<pre style="font-family: monospace; font-size:12pt">/;s/$/<\/pre>/') kdialog does funky things with file handles, so you might be able to mangle that up, but otherwise, probably easiest to make a temporary file, and use a shell trap to ensure it gets removed. As a REALLY Ugly hack, you can use the kdialogrc KDE config file: you could use maketemp to create a temporary hierarchy and populate: FAKE_KDE_HOME=/tmp/kdeFOO/ FAKE_KDE_CONFIG=/tmp/kdeFOO/share/config cat >> ${FAKE_KDE_CONFIG}/kdialogrc << "EOF" [General] font=Sans Serif,20,-1,5,50,0,0,0,0,0 EOF # NOTE: i do not know what format that font-spec is in, that's just an example from a distro (arch?) creating a /usr/share/kde4/config/kdialogrc # NOTE: it's up to you to figure out the correct specification. I *think* then: KDEHOME=${FAKE_KDE_HOME} kdialog ... That also changes the Button font to what you specify in the [General] group font key. --stephen On Tue, Oct 27, 2015 at 5:02 AM, ianseeks <ianse...@yahoo.co.uk> wrote: > On Tuesday 27 Oct 2015 10:03:06 Duncan wrote: > > 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. > > seemed the sensible thing to do at time. :o) > > > 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 ? . > > perhaps the qt/kde options should be listed at the same time something > along > the lines of "man rpm" i.e. get all the options into the open > > thanks for the enlightenment. > > > 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. > > > ___________________________________________________ > 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. > -- Stephen Dowdy - Systems Administrator - NCAR/RAL 303.497.2869 - sdo...@ucar.edu - http://www.ral.ucar.edu/~sdowdy/
___________________________________________________ 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.