summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wildemann <gta04@metalstrolche.de>2019-07-19 14:03:31 +0200
committerStefan Wildemann <gta04@metalstrolche.de>2019-07-19 14:03:31 +0200
commit6464249dc80ec5d3deb65f661395e1fda064442e (patch)
tree665f768f44726602da6841528e461f62fad1ae2b
parent0f08c04dd9816533ffbaa2b684b8b0d57f0da9a5 (diff)
downloadnavit-6464249dc80ec5d3deb65f661395e1fda064442e.tar.gz
fix qt5 font handling
-rw-r--r--navit/graphics/qt5/graphics_qt5.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp
index e7b31c605..99600e8b5 100644
--- a/navit/graphics/qt5/graphics_qt5.cpp
+++ b/navit/graphics/qt5/graphics_qt5.cpp
@@ -172,7 +172,10 @@ static const char* fontfamilies[] = {
* @param gr own private context
* @param meth fill this structure with correct functions to be called with handle as interface to font
* @param font font family e.g. "Arial"
- * @param size Font size in ???
+ * @param size Font size in 16.6 fractional points @ 300dpi. This is bullsh***. The encoding is freetypes
+ * 16.6 fixed point format usually giving points. One point is usually 72th part of an inch. But
+ * navit does not honor dpi correct. It's traditionally used freetype backend is fixed to 300 dpi.
+ * So this value is (300/72) pixels
* @param flags Font flags (currently 1 if bold and 0 if not)
*
* @return font handle
@@ -205,8 +208,9 @@ static struct graphics_font_priv* font_new(struct graphics_priv* gr, struct grap
dbg(lvl_debug, "No matching font. Resort to: %s", font_priv->font->family().toUtf8().data());
}
- /* No clue why factor 20. Found this by comparing to Freetype rendering. */
- font_priv->font->setPointSize(size / 20);
+ /* Convert silly font size to pixels. by 64 is to convert fixpoint to int. */
+ dbg(lvl_error, "(font %s, %d=%f, %d)", font, size,((float)size)/64.0, ((size * 300) / 72) / 64);
+ font_priv->font->setPixelSize(((size * 300) / 72) / 64);
//font_priv->font->setStyleStrategy(QFont::NoSubpixelAntialias);
/* Check for bold font */
if (flags) {