Enable setting a fixed font for 'wine' in test/handle_keys.cxx

... w/o editing a file. The default font is "Liberation Mono".

Just set environment variable FLTK_USING_WINE=1 to enable this feature.

Rationale: on /my/ current test system the font chosen by `wine` for
FL_COURIER is a proportional font whereas the display in Fl_Terminal
requires a fixed font for correct output. Font "Liberation Mono"
solves this long standing issue for me w/o having to change source code
but other Linux systems may require a different font.
This commit is contained in:
Albrecht Schlosser 2024-07-31 17:04:34 +02:00
parent 089f31018b
commit 53469038ce
1 changed files with 12 additions and 7 deletions

View File

@ -335,16 +335,21 @@ void close_cb(Fl_Widget *win, void *) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
// Set an appropriate font for Wine on Linux (test only). // Set an appropriate font for Wine on Linux (test only).
// This is very likely not necessary on a real Windows system // This is very likely not necessary on a real Windows system.
// Set environment variable FLTK_USING_WINE to a non-empty string
// to enable this feature, e.g. (in bash) `export FLTK_USING_WINE=1`.
#if (0) // test/experimental for wine on Linux (maybe missing fonts)
#ifdef _WIN32 #ifdef _WIN32
const char *using_wine = fl_getenv("FLTK_USING_WINE");
printf("FLTK_USING_WINE = %s\n", using_wine ? using_wine : "");
if (using_wine && *using_wine) {
// set an alternate fixed font for the terminal widget
// Fl::set_font(FL_COURIER, " DejaVu Sans Mono"); // DejaVu Mono // Fl::set_font(FL_COURIER, " DejaVu Sans Mono"); // DejaVu Mono
// Fl::set_font(FL_COURIER, "BNimbus Mono PS"); // Nimbus Mono PS bold // Fl::set_font(FL_COURIER, "BNimbus Mono PS"); // Nimbus Mono PS bold
Fl::set_font(FL_COURIER, " Liberation Mono"); // Liberation Mono Fl::set_font(FL_COURIER, " Liberation Mono"); // Liberation Mono
}
#endif #endif
#endif // test
const int WW = 700, WH = 400; const int WW = 700, WH = 400;
app *win = new app(0, 0, WW, WH); app *win = new app(0, 0, WW, WH);