[SOLVED] Variations of "fixed" font using Xlib?

Need help with C, C++, perl, python, etc?

[SOLVED] Variations of "fixed" font using Xlib?

Postby Zurg11 » 2019-06-05 07:52

Hello :) :) :) !

I have recently started programming using Xlib and C. As you probably already know, to specify that you want your application to use default font you set font to "fixed", like this
Code: Select all
font = XLoadQueryFont(display, "fixed");

But how can I get variations of that font, like bold, italic and bold italic?

I have tried specifying this string instead of "fixed".
Code: Select all
-*-*-*-*-normal-*-*-*-*-*-*-*-*-*

or
Code: Select all
-*-fixed-*-*-normal-*-*-*-*-*-*-*-*-*

(This is X logical font description.)
But it didn't work, text didn't show up. I thought that if I can specify "fixed" font like this that I can later change 3th field to "bold", 4th to "italic" and so on.
Last edited by Zurg11 on 2019-06-06 18:32, edited 1 time in total.
Zurg11
 
Posts: 7
Joined: 2019-03-21 07:21

Re: Variations of "fixed" font using Xlib?

Postby Head_on_a_Stick » 2019-06-05 15:36

Try using this to get a correct name:
Code: Select all
xfontsel

https://packages.debian.org/stretch/x11-utils

This seems to be valid (but with a limited size selection available):
Code: Select all
-*-fixed-bold-*-*-*-*-*-*-*-*-*-*-*
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Variations of "fixed" font using Xlib?

Postby Zurg11 » 2019-06-05 18:12

Head_on_a_Stick wrote:Try using this to get a correct name:
Code: Select all
xfontsel

https://packages.debian.org/stretch/x11-utils

This seems to be valid (but with a limited size selection available):
Code: Select all
-*-fixed-bold-*-*-*-*-*-*-*-*-*-*-*

Thanks for the help, that does work if I replace "bold" with "medium". But it doesn't work with "bold" because it seems that bold variation does not exist on this system ("bold" field is grayed out in xfontsel) for some reason. Is that normal? How can I install bold variation?
Zurg11
 
Posts: 7
Joined: 2019-03-21 07:21

Re: Variations of "fixed" font using Xlib?

Postby Zurg11 » 2019-06-06 18:32

Zurg11 wrote:
Head_on_a_Stick wrote:Try using this to get a correct name:
Code: Select all
xfontsel

https://packages.debian.org/stretch/x11-utils

This seems to be valid (but with a limited size selection available):
Code: Select all
-*-fixed-bold-*-*-*-*-*-*-*-*-*-*-*

Thanks for the help, that does work if I replace "bold" with "medium". But it doesn't work with "bold" because it seems that bold variation does not exist on this system ("bold" field is grayed out in xfontsel) for some reason. Is that normal? How can I install bold variation?

Nah it's okay, I was wrong :| :| :| .
Zurg11
 
Posts: 7
Joined: 2019-03-21 07:21


Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable