diff options
author | dos-reis <gdr@axiomatics.org> | 2013-06-23 19:00:30 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-06-23 19:00:30 +0000 |
commit | 1363ab2f8f0bc56e8303f2a1673644404c41ef03 (patch) | |
tree | c118b5d7a1e3282bfd706a23ad396a416a1b715b /src | |
parent | d918d0a1f78696fec489c0ad7d581f9707b13df2 (diff) | |
download | open-axiom-1363ab2f8f0bc56e8303f2a1673644404c41ef03.tar.gz |
Fix font units. On Mac OS X, QT may return 0 for certain font metrics components.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/conversation.cc | 8 | ||||
-rw-r--r-- | src/gui/conversation.h | 3 | ||||
-rw-r--r-- | src/gui/debate.cc | 1 | ||||
-rw-r--r-- | src/gui/debate.h | 1 | ||||
-rw-r--r-- | src/gui/gui.pro.in | 2 | ||||
-rw-r--r-- | src/gui/main-window.cc | 1 | ||||
-rw-r--r-- | src/gui/main-window.h | 1 | ||||
-rw-r--r-- | src/gui/main.cc | 1 |
8 files changed, 14 insertions, 4 deletions
diff --git a/src/gui/conversation.cc b/src/gui/conversation.cc index 64308665..6a1ecb18 100644 --- a/src/gui/conversation.cc +++ b/src/gui/conversation.cc @@ -1,5 +1,6 @@ -// Copyright (C) 2011, Gabriel Dos Reis. +// Copyright (C) 2011-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -44,7 +45,10 @@ namespace OpenAxiom { // associated with `w'. static QSize font_units(const QWidget* w) { const QFontMetrics fm = w->fontMetrics(); - return QSize(fm.maxWidth(), fm.lineSpacing()); + const auto h = fm.lineSpacing(); + if (auto w = fm.maxWidth()) + return { w, h }; + return { fm.width('W'), h }; } // Return true if the QString `s' is morally an empty string. diff --git a/src/gui/conversation.h b/src/gui/conversation.h index 90f461a7..ff1a847d 100644 --- a/src/gui/conversation.h +++ b/src/gui/conversation.h @@ -1,5 +1,6 @@ -// Copyright (C) 2011, Gabriel Dos Reis. +// Copyright (C) 2011-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/src/gui/debate.cc b/src/gui/debate.cc index dbec1ae8..f96e5427 100644 --- a/src/gui/debate.cc +++ b/src/gui/debate.cc @@ -1,5 +1,6 @@ // Copyright (C) 2011-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/src/gui/debate.h b/src/gui/debate.h index 5e5356bb..1c5adf05 100644 --- a/src/gui/debate.h +++ b/src/gui/debate.h @@ -1,5 +1,6 @@ // Copyright (C) 2011-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/src/gui/gui.pro.in b/src/gui/gui.pro.in index 5dbc49bf..6969b454 100644 --- a/src/gui/gui.pro.in +++ b/src/gui/gui.pro.in @@ -1,4 +1,4 @@ -## Copyright (C) 2011 Gabriel Dos Reis. +## Copyright (C) 2011-2013 Gabriel Dos Reis. ## All rights reserved. ## Autoconf template file for the benefit of QMake ## Written by Gabriel Dos Reis. diff --git a/src/gui/main-window.cc b/src/gui/main-window.cc index caa6771c..6d3eb205 100644 --- a/src/gui/main-window.cc +++ b/src/gui/main-window.cc @@ -1,5 +1,6 @@ // Copyright (C) 2011-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/src/gui/main-window.h b/src/gui/main-window.h index 4b74828f..5e08067e 100644 --- a/src/gui/main-window.h +++ b/src/gui/main-window.h @@ -1,5 +1,6 @@ // Copyright (C) 2011, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/src/gui/main.cc b/src/gui/main.cc index e6db3db6..bbbdd852 100644 --- a/src/gui/main.cc +++ b/src/gui/main.cc @@ -1,5 +1,6 @@ // Copyright (C) 2011-2013, Gabriel Dos Reis. // All rights reserved. +// Written by Gabriel Dos Reis. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are |