[SOLVED] Getting the right font size in a trditional X application (Xman)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Getting the right font size in a trditional X application (Xman)
I use Xman as a simple man page reader but, when launched from my desktop, it uses too big a font and pages run over the edge even when I make it fullscreen. So I added a couple of lines to my .Xresources file as follows:
userresources=$HOME/.Xresources
...
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
So as I understand it, those fonts should override the larger default fonts. They do if I launch Xman from a terminal but not when I launch it from my buttonbar app.
the usual answer is because it is overridden. I don't know your button bar, but probably that sets those resources somehow. Or your font specification is invalid and therefore some other font has been selected (which is different in the mentioned two cases).
The buttonbar (which I wrote myself) simply forks off graphical apps without arguments. It doesn't specify anything beyond that. The default resources for Xman are in /etc/X11/app-defaults.
I used those lines as a model for my version, just using a smaller font, as you will see if you compare the default with what I put in my .Xresources file. But what actually does xrdb -merge do when your local .Xresources and the default version clash?
I have experienced similar problems when I ampersand too many apps in my .xinitrc, and/or put them in the wrong order.
In other words, make sure the xrdb command is near the top, and has completed, before you start barbarella?
Also, a -merge is not always sufficient as pan64 pointed out.
You can check your actually valid Xresources with
$ xman
Warning: Cannot convert string "-*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*" to type FontStruct
Warning: Cannot convert string "-*-courier-medium-r-*-*-*-120-*-*-*-*-*-*" to type FontStruct
Warning: Cannot convert string "-*-courier-bold-r-*-*-*-120-*-*-*-*-*-*" to type FontStruct
Warning: Cannot convert string "-*-courier-medium-o-*-*-*-120-*-*-*-*-*-*" to type FontStruct
Warning: Cannot convert string "-*-symbol-*-*-*-*-*-120-*-*-*-*-*-*" to type FontStruct
I don't get those warnings, but that's probably irrelevant.
As to the fonts, my guess is that the ones I have without the Xman prefix are the defaults from /etc/X11/app-defaults/Xman. In other words I have both the default and the prescribed versions in my merged resources database, and graphical launches continue to use the default ones. I suppose the solution is to change the defaults rather than fiddling around with a personal file and a merger. After all, a program like Xman is hardly likely to be upgraded within the lifetime of this release!
The warning means the font does not exist, another one will be used instead.
Xman version 1.1.5, from somewhere 1989, 1990.
By the way probably this helps (man page):
Code:
XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the
RESOURCE_MANAGER property.
XAPPLRESDIR A string that will have ``Xman'' appended to it. This string will be the full path name of a
user app-defaults file to be merged into the resource database after the system app-defaults
file, and before the resources that are attached to the display.
See X(7) for a full statement of rights and permissions.
I fiddled about a bit with Xman's default resources file and found that a font size of 100 is best overall. It requires a maximised window to display a readable man page (a smaller one will do for a contents list), but using a smaller font makes the page more difficult to read. The program now launches from the buttonbar in a satisfactory manner.
AFAIU Xresources are applied by specificity, i.e. more specific settings override less specific settings.
That way you can define your font for almost everything with '*font: ...', but can still override it for specific applications: 'Xman*font: ...'.
The logic is simple for anyone who understands shell globbing.
In your example above, 'Xman.font.something' is very specific and should win - in case the resource is actually called Xman.font.something, and not e.g. 'Xman.manualFontNormal'?
As I've said, it does override for instances launched from the shell. But not for instances launched graphically. Maybe window managers have shell scripts to handle the resources for programs launched from their menus, but obviously I didn't put anything of the kind into barbarella. It's just a simple fork and exec. Anyway, I've changed the default resources now and that solves the problem.
^ So you edited /etc/X11/app-defaults/Xman? Not very elegant. These old X apps do get updated sometimes.
If you're happy with your solution feel free to ignore me, but:
Quote:
Originally Posted by ondoho
I have experienced similar problems when I ampersand too many apps in my .xinitrc, and/or put them in the wrong order.
In other words, make sure the xrdb command is near the top, and has completed, before you start barbarella?
Good question. Barbarella isn't launched by .xinitrc but by fluxbox. There's a directory called .fluxbox/apps where you can put stuff you want to auto-launch. It allows you to specify the desktop you want the app to run on which is essential for barbarella; I want different buttonbars on different desktops because of the way I like to work.
The xrdb merge is done by .xinitrc before startfluxbox is executed. So the merge is certainly complete by then. Incidently, I have no idea where that .xinitrc file originally comes from. I copied it over from my earlier Slackware installation but I certainly didn't write it myself.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.