Skip to content

Commit

Permalink
Enable setting a fixed font for 'wine' in test/handle_keys.cxx
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
Albrecht Schlosser committed Jul 31, 2024
1 parent 089f310 commit 5346903
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions test/handle_keys.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,21 @@ void close_cb(Fl_Widget *win, void *) {

int main(int argc, char **argv) {

// Set an appropriate font for Wine on Linux (test only).
// This is very likely not necessary on a real Windows system
// Set an appropriate font for Wine on Linux (test only).
// 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
// 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, " Liberation Mono"); // Liberation Mono
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, "BNimbus Mono PS"); // Nimbus Mono PS bold
Fl::set_font(FL_COURIER, " Liberation Mono"); // Liberation Mono
}
#endif
#endif // test

const int WW = 700, WH = 400;
app *win = new app(0, 0, WW, WH);
Expand Down

0 comments on commit 5346903

Please sign in to comment.