Selecting font in Geyser

Geyser is an object oriented framework for creating, updating and organizing GUI elements within Mudlet.
Post Reply
treimor
Posts: 3
Joined: Wed Oct 22, 2014 7:37 am

Selecting font in Geyser

Post by treimor » Wed Oct 22, 2014 7:39 am

Is it possible to select a font for the various elements in Geyser?

xabre
Posts: 39
Joined: Thu Mar 08, 2012 7:19 pm

Re: Selecting font in Geyser

Post by xabre » Wed Oct 22, 2014 8:43 am

You can do it in labels and gauges, sadly, it won't work for miniconsoles. API refference has the info how to do it for first two.

User avatar
SlySven
Posts: 889
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Selecting font in Geyser

Post by SlySven » Wed Oct 22, 2014 11:44 pm

The awkward thing with fonts is that sharing them (in packages) is not (yet) implemented and can have licensing issues on some platforms (MacOs / Windows) - I'm hacking away at extending the "letters" that can be used for room markers on the 2D mapper but it won't be complete until I nail down some of this.

(A prototype I've munged together has the possibility to force the use of a specified font and only use "glyphs" {what most people would call "characters"} from that font of this mapper case but it has been pointed out to me that we need a way to include fonts with packages and that was why it is not currently possible to control the fonts used for miniconsoles...)

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Selecting font in Geyser

Post by Akaya » Thu Oct 23, 2014 8:33 pm

You can specify fonts in the stylesheet. Miniconsole's don't use stylesheets so they won't apply to this.
Code: [show] | [select all] lua
mylabel:setStyleSheet([[
  font-family: Arial;
]])

User avatar
SlySven
Posts: 889
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Selecting font in Geyser

Post by SlySven » Thu Oct 23, 2014 10:28 pm

Humm, and how does Mudlet, or the Qt libraries that it uses, know what "Arial" is unless the font is already known to the O/S or has been loaded into the "font database" {as the (Free) Bitstream Vera Sans/Serif/Mono that we package with Mudlet, are} at start up? For instance one of my PC's a Linux only server does NOT have the Arial font and, as the font is covered by a MS Proprietary license, it would not available to that computer if I was running Mudlet there {or more strictly running my X Display server (the bit of the system that shows the pictures) rather than the Mudlet executable but that's an unnecessary complication that most people don't even have to worry about} :geek:.

Nevertheless, if someone is building packages for others to use they ought to take care that the recipients have all the bits - or can get them - that are needed... :smile:

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Selecting font in Geyser

Post by Akaya » Fri Oct 24, 2014 12:38 am

I put Arial as its a default Windows font. Change it as needed.

Addressing your issue, Slysven... Seeing as how font names aren't cross-platform, you'll need a way to grab the fonts from the OS. Vadi was working on this idea when I was attempting the GUI Creator. I can't remember where it was left off.

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Selecting font in Geyser

Post by Akaya » Fri Oct 24, 2014 12:42 am

I'd imagine, if you could find the OS-specific directory to the font names, you could place them in a lua table for use in Mudlet, though I doubt its that simple.

User avatar
Vadi
Posts: 4601
Joined: Sat Mar 14, 2009 3:13 pm

Re: Selecting font in Geyser

Post by Vadi » Fri Oct 24, 2014 8:22 am

My attempt was to use Lua to detect which fonts are available, but implementing it in C++ using QFontInfo would be far easier.

User avatar
SlySven
Posts: 889
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Selecting font in Geyser

Post by SlySven » Mon Oct 27, 2014 9:54 pm

On *nixs with the required by Qt fontconfig the fonts already on the system are automagically available for the Qt Libraries to use - a C++ QFont without a family name specified there (or by an application previously setting something) will use the system/user specified default but we often override that with a font family name so Mudlet does not blend into the same style as far as fonts are concerned as the user's other applications in some areas but does in others. I recently set my default to a slightly odd one and it was interesting to see which bits of Mudlet changed and which didn't - because I had set an italic default the splash screen looked quite pleasing but some other things that used italics for emphasis (some tool-tips IIRC) on some words lost that emphasis...

More importantly, provided the QFont::setStyleStrategy is NOT set to the enum QFont::StyleStrategy value of QFont::NoFontMerging the user should get something to show for a glyph. N.B. The Qt "QFont class" Documentation for this enum is just not right when it talks about OR-ing a value from the first list with one from the three values in the second list - and the first list is such that you'd possibly want to have more than one of the options from that list anyhow. :sad:

It is proving to be an interesting area of study. :geek:

P.S. I'm not sure that the local.conf file that gets copied to the root of the mudlet-data directory tree with the Bitstream Vera fonts each time Mudlet started (until a recent development commit that now only copies as needed) has much effect - though those fonts ARE made available to Mudlet by the FontManager.cpp class to supplement whatever the system tells Qt is available.

I'm looking to extend the FontManager class to scan a ./font subdirectory and register on profile loading (and un-register on closure of that profile in a multi-profile Mudlet execution environment) with something similar for packages/modules(?) - I'm just not that clear yet on how package builders can specify/include a font in their products.

Johndic
Posts: 1
Joined: Wed Sep 26, 2018 11:03 am

Selecting font in Geyser

Post by Johndic » Mon Oct 08, 2018 12:51 pm

Hi

Have you tried selecting Courier New or another monospaced font in the Options/Notes list window?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest