Discussion:
Need monospace font for zenity
Todd And Margo Chester
2011-12-31 05:14:13 UTC
Permalink
Hi All,

I am using Scientific Linux 6.2 x64 (RHEL clone):

$ zenity --info --title="abc" --font "monospace 9" --text "abcdefg"
This option is not available. Please see --help for all possible usages.

$ zenity --help-all | grep -i font
<nothing>

$ rpm -qa \*zenity\*
zenity-2.28.0-1.el6.x86_64


I really need a monospaced font. I am drawing a blank on Google.
Any one know how to do this?

Many thanks,
-T
Keith Chadwick
2011-12-31 05:22:04 UTC
Permalink
courier is a monospaced font.

-Keith.
Post by Todd And Margo Chester
Hi All,
$ zenity --info --title="abc" --font "monospace 9" --text "abcdefg"
This option is not available. Please see --help for all possible usages.
$ zenity --help-all | grep -i font
<nothing>
$ rpm -qa \*zenity\*
zenity-2.28.0-1.el6.x86_64
I really need a monospaced font. I am drawing a blank on Google.
Any one know how to do this?
Many thanks,
-T
Todd And Margo Chester
2011-12-31 05:39:46 UTC
Permalink
Post by Keith Chadwick
Post by Todd And Margo Chester
Hi All,
$ zenity --info --title="abc" --font "monospace 9" --text "abcdefg"
This option is not available. Please see --help for all possible usages.
$ zenity --help-all | grep -i font
<nothing>
$ rpm -qa \*zenity\*
zenity-2.28.0-1.el6.x86_64
I really need a monospaced font. I am drawing a blank on Google.
Any one know how to do this?
Many thanks,
-T
courier is a monospaced font.
-Keith.
How do I use Courier in my command line? Where and how do
I put it?

$ zenity --info --title="abc" --font "courier" --text "abcdefg"
This option is not available. Please see --help for all possible usages.

Many thanks,
-T
Phong Nguyen
2011-12-31 05:52:39 UTC
Permalink
It looks like zenity uses the global font settings and does not have an option to override it.

Why do you need to change it?
Post by Todd And Margo Chester
Hi All,
$ zenity --info --title="abc" --font "monospace 9" --text "abcdefg"
This option is not available. Please see --help for all possible usages.
$ zenity --help-all | grep -i font
<nothing>
$ rpm -qa \*zenity\*
zenity-2.28.0-1.el6.x86_64
I really need a monospaced font. I am drawing a blank on Google.
Any one know how to do this?
Many thanks,
-T
Todd And Margo Chester
2012-01-01 04:57:07 UTC
Permalink
Post by Phong Nguyen
Post by Todd And Margo Chester
Hi All,
$ zenity --info --title="abc" --font "monospace 9" --text "abcdefg"
This option is not available. Please see --help for all possible usages.
$ zenity --help-all | grep -i font
<nothing>
$ rpm -qa \*zenity\*
zenity-2.28.0-1.el6.x86_64
I really need a monospaced font. I am drawing a blank on Google.
Any one know how to do this?
Many thanks,
-T
It looks like zenity uses the global font settings and does not have
an option to override it.
Why do you need to change it?
I need to change it for text alignment purposes. Without a monospaced
font, when displaying the following through zenity,

# virsh list --all
Id Name State
----------------------------------
- KVM-FC16-LiveCD shut off
- KVM-ReactOS shut off
- KVM-W7 shut off
- KVM-WinXP shut off


looks like


Id Name State
-------------------------
- KVM-FC16-LiveCD shut off
- KVM-ReactOS shut off
- KVM-W7 shut off
- KVM-WinXP shut off
Jason Bronner
2012-01-01 06:02:13 UTC
Permalink
i'd probably round up any one of 100 repacked Windows Fonts (msttcorefonts)
.RPMs, force it to courier new, and forget about it. there's scads of
how-tos running around for Fedora and Red Hat based systems.
Todd And Margo Chester
2012-01-01 21:51:07 UTC
Permalink
Post by Jason Bronner
i'd probably round up any one of 100 repacked Windows Fonts
(msttcorefonts) .RPMs, force it to courier new, and forget about it.
there's scads of how-tos running around for Fedora and Red Hat based
systems.
I like the fonts otherwise. I just what to change zenity's fonts.
Phong Nguyen
2012-01-01 16:43:38 UTC
Permalink
Why not parse the output and put it into a formatted list dialogue?
Post by Todd And Margo Chester
I need to change it for text alignment purposes. Without a monospaced
font, when displaying the following through zenity,
# virsh list --all
Id Name State
----------------------------------
- KVM-FC16-LiveCD shut off
- KVM-ReactOS shut off
- KVM-W7 shut off
- KVM-WinXP shut off
looks like
Id Name State
-------------------------
- KVM-FC16-LiveCD shut off
- KVM-ReactOS shut off
- KVM-W7 shut off
- KVM-WinXP shut off
Todd And Margo Chester
2012-01-01 21:50:28 UTC
Permalink
Post by Phong Nguyen
Post by Todd And Margo Chester
I need to change it for text alignment purposes. Without a monospaced
font, when displaying the following through zenity,
# virsh list --all
Id Name State
----------------------------------
- KVM-FC16-LiveCD shut off
- KVM-ReactOS shut off
- KVM-W7 shut off
- KVM-WinXP shut off
looks like
Id Name State
-------------------------
- KVM-FC16-LiveCD shut off
- KVM-ReactOS shut off
- KVM-W7 shut off
- KVM-WinXP shut off
Why not parse the output and put it into a formatted list dialogue?
What do you mean?
Brett Viren
2012-01-03 19:25:31 UTC
Permalink
Post by Todd And Margo Chester
Post by Phong Nguyen
Why not parse the output and put it into a formatted list dialogue?
What do you mean?
zenity --list --column "Id Name" --column "State" "KVM-FC16-LiveCD" "shut off" "KVM-ReactOS" "shut off"

(etc for all your rows)

-Brett.

Todd And Margo Chester
2012-01-01 22:35:54 UTC
Permalink
Post by Todd And Margo Chester
Hi All,
$ zenity --info --title="abc" --font "monospace 9" --text "abcdefg"
This option is not available. Please see --help for all possible usages.
$ zenity --help-all | grep -i font
<nothing>
$ rpm -qa \*zenity\*
zenity-2.28.0-1.el6.x86_64
I really need a monospaced font. I am drawing a blank on Google.
Any one know how to do this?
Many thanks,
-T
Hi All,

Krzysztof over on comp.os.linux.misc showed me what to
do. The solution is to use a custom .gtkrc.

Thank you all for the tips and help!

-T

My notes on the subject:

How to set up a custom (in this case a "monospace") font in zenity:

A helpful reference:

http://urukrama.wordpress.com/2008/07/13/setting-a-custom-gtk-theme-for-specific-applications


Use a "custom" gtkrc. Start you zenity command with:

GTK2_RC_FILES=/path/to/your/theme/gtkrc zenity ....


For example:

$ xx="`su root -c "virsh list --all"`"


Show the bad spacing:
$ zenity --info --title="abc" --text "$xx"


$ cp .gtkrc .gtkrc.monospace.12


Add the customer font:
$ vi .gtkrc.monospace.12
style "font" {
font_name="monospace 12"
}
widget_class "*" style "font"
gtk-font-name = "monospace 12"


Show the good spacing:
$ GTK2_RC_FILES=/home/todd/.gtkrc.monospace.12 \
zenity --info --title="Status" --text "$xx"
Loading...