Qt text windows
For Qt, always render text windows with fixed width font instead of switching from proportional to fixed when the text contains any line(s) with four consecutive spaces. That was really meant for menu lines without selector letters which want to be lined up under or over ones with such, and wasn't a very good heuristic for text windows. Most of the text files for the '?' command happen to have such lines so are already being shown with fixed-width font. data.base entries were hit or miss; most have attribution lines indented by four or more spaces but some don't, so display was inconsistent: some were shown with fixed-width font and some with proportional.
This commit is contained in:
@@ -1147,9 +1147,24 @@ void NetHackQtTextWindow::Display(bool block UNUSED)
|
||||
textsearching = false;
|
||||
}
|
||||
|
||||
// handle a line of text for a text window
|
||||
void NetHackQtTextWindow::PutStr(int attr UNUSED, const QString& text)
|
||||
{
|
||||
str_fixed=str_fixed || text.contains(" ");
|
||||
#if 1
|
||||
// 3.7: Always render text windows with fixed-width font. The majority
|
||||
// of text files we'll ever display including ('license' and 'history')
|
||||
// happen to have some lines with four spaces anyway and/or they have
|
||||
// been pre-formatted to fit within less than 80 columns. For data.base
|
||||
// entries, some do have four spaces (usually the final attribution)
|
||||
// and some don't, resulting in inconsistent display from one entry to
|
||||
// another if the default proportional font is ever used.
|
||||
str_fixed = true;
|
||||
#else
|
||||
// if any line contains four consecutive spaces, render this text window
|
||||
// using fixed-width font; skip substring lookup if flag is already set
|
||||
str_fixed = str_fixed || text.contains(" ");
|
||||
#endif
|
||||
// instead of outputting the line directly, save it for future rendering
|
||||
lines->addItem(text);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user