-
Notifications
You must be signed in to change notification settings - Fork 36.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[qt] Use monospace font #6864
[qt] Use monospace font #6864
Conversation
@@ -463,13 +463,15 @@ void RPCConsole::clear() | |||
|
|||
// Set default style sheet | |||
ui->messagesWidget->document()->setDefaultStyleSheet( | |||
QString::fromStdString(strprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Qt's formatting, instead of strprintf. e.g.
QString("....\1...." ).arg(...)
cb42034
to
98c66cd
Compare
Binaries are here: https://bitcoin.jonasschnelli.ch/pulls/6864/ Would be good if we get some screenshot from HiDPI Ubuntu and retina OSX. |
"td.cmd-request { color: #006060; } " | ||
"td.cmd-error { color: red; } " | ||
"b { color: #006060; } " | ||
); | ||
|
||
).arg(QFont("Monospace").pointSize() * 4 / 5) // 0.8 em |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QFont("Monospace").pointSize() * 4 / 5
is a float, so should this also include a call to QString & QString::setNum(float n, char format = 'g', int precision = 6)
?
Also not sure if relevant, but as per the docs .pointSize()
:
Returns the point size of the font. Returns -1 if the font size was specified in pixels.
Perhaps you also could exchange Monospace
with QFont::Monospace
... I didn't try the code btw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have alrady replaced the code with a version that should work on all platforms (and maybe even HiDPI).
d0e4399
to
89a0bf8
Compare
Kicked the build server,... new builds should be available within the next 30mins: https://bitcoin.jonasschnelli.ch/pulls/6864/ |
53a9779
to
2cdd8a1
Compare
Supporting HiDPI is not a requirement for Qt4. All the distribution binaries are built with Qt5. We still support Qt4 in the same way as websites support IE6, e.g. bare-bones: functionality must work but it is allowed to be ugly. |
Uh, Qt4 should remain a fully-supported platform until KDE has finished switching away from it... (this case would be an exception IMO since Qt4 itself lacks HiDPI support.) |
@jonasschnelli Your OS X binaries are crashing for me, are you having any issue with them? |
@fanquake: the crash is related to the PR. Monospace is not available on Mac (or something similar). |
@fanquake: you probably picked an old build. Always check the git tip. Just re-started the build of the PR. |
1d15e0e
to
e969ffb
Compare
This is ready for review now. @fanquake and reviewers: Please use jonasschnelli's binaries for debug (send me stdout when no monospace font is found). The code in this PR has the debug to stdout removed in 1d15e0e762cdfa83d4f98d96e532e35c0f8f6cf4 , was squashed and force pushed. |
In this case I wouldn't further increase the size, because then it probably gets too big on the other OS, but I agree, it looks too small. While this doesn't seem to be an issue with fixed space font (especially since it's not available on OS X, as it seems), it may be worth to consider using a relative size based on a common, well sized font as reference, i.e. instead of using
|
e969ffb
to
0e0b8ba
Compare
@dexX7 If there was a "reference font", you could as well just not set the pt size at all, I guess. Let's try this? |
0e0b8ba
to
2fc054c
Compare
Still has a crazily big font on Ubuntu. Tending towards closing this, it's not worth the hassle. |
@laanwj Unfortunately I can not reproduce the issue you mentioned. I did a fresh install of Ubuntu 15.10 and got the results below. Also, @dexX7 could not find an issue for Ubuntu. Maybe you changed the default settings for the system fonts accidentally? $ gsettings list-recursively org.gnome.desktop.interface|egrep "(font|text-scaling)"
org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 13'
org.gnome.desktop.interface text-scaling-factor 1.0
org.gnome.desktop.interface font-name 'Ubuntu 11'
org.gnome.desktop.interface document-font-name 'Sans 11' Ubuntu
OSX(screenshots from @jonasschnelli)
|
Looks like it's the same:
Have tried it on two systems. I'm using Ubuntu 14.04 and Qt5. I compile using the system's Qt5 library and am not using depends. Edit: tried with Qt4, same problem. |
@laanwj Thank you for trying this. Would you mind to edit your posts to include the screenshots for the build without this PR? |
Added for the 15.10 VM above: for the others the effect is exactly the same, except for the code changes as they were at the beginning of this pull request, there the fixed and proportional font were almost the same size. |
Yes, it was "hard-coded" at 10pt but @jonasschnelli complained |
So it looks like Ubuntu consistently specifies a huge monospace default font. I guess that's simply the The only thing I don't understand is that you don't get the same. |
Maybe someone can test this over a Qt4 build? (@luke-jr)? |
I've already tested Qt4. Works OK. |
No, qt selects "DejaVu Sans Mono 12", and I set the size to
No, terminal chooses the default "Ubuntu Mono 13".
Maybe, there is a difference when you use the gitian builds by jonasschnelli ( @laanwj The monospace font appears larger than the non monospace font because it consumes way more horizontal space. The only thing I can do here is to scale the font's height by a hard coded factor (like ~95%). I have added a commit to do just that. If a constant factor can't fix your concern (exact value up for bike shedding), you are welcome to close this PR. |
Right - the gitian build by jonasschelli uses static qt from the depends system, I build against the system's Qt5 library (this is what the Ubuntu PPA does). |
As OS X was the only one getting it right, I expect the constant factor makes the font look smaller now on OS X. Hopefully such that it is still acceptable. |
I think this is a improvement over the current version and the PR is pretty clean. Minor font size differences are an upstream issue IMO and still result in a adequate quality. Also the indent formatting increase readability. |
@jonasschnelli So you are against 268b79e? |
ACK 268b79e |
@@ -462,13 +462,19 @@ void RPCConsole::clear() | |||
} | |||
|
|||
// Set default style sheet | |||
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont()); | |||
// Try to make fixed font adequately large on different OS | |||
QString ptSize = QString("%1pt").arg(QFontInfo(QFont()).pointSize() * 8.5 / 9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems weird. Why is this not simply using fixedFontInfo.pointSize()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also preferred to non-* 8.5 / 9
solution. But i have ACKed this solution because it might slightly reduce the size of mostly-oversized monospace fonts. But a *0.95
instead a * 8.5/9 would be cleaner, right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luke-jr fixedFontInfo.pointSize()
is 12
, so way too large. Also, people were requesting that the fixed pitch font is exactly the same size as the previous default font.
@jonasschnelli QFontInfo(QFont()).pointSize()
is 9
, often. So we get a 8.5pt
in this case instead of a longer float.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcoFalke If fixedFontInfo.pointSize() is wrong, then that should be fixed instead. If people merely don't have their systems configured correctly, that isn't a problem we should try to workaround in the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luke-jr Maybe you could do something like http://stackoverflow.com/a/12179548 to read the system default font. But I am not planning to do this within this PR, as this will likely change the text for the whole GUI.
I see only three options for this PR:
This is already bikeshedded to death, please let's not start another round. |
268b79e [qt] rpcconsole: Scale monospace font to 95% (MarcoFalke) 28313b8 [qt] Use fixed pitch font for the rpc console (MarcoFalke)
This uses #4228 to find a monospace font for the qt rpcconsole.
(This replaces, thus closes #6781.)