WIP: new fixed font bitmaps - needs improvement

This commit is contained in:
Matthias Koefferlein
2019-11-03 17:22:57 +01:00
parent 861a6fdfcc
commit 37e402e9bd
5 changed files with 89395 additions and 25073 deletions
File diff suppressed because it is too large Load Diff
+15 -3
View File
@@ -37,18 +37,30 @@ FixedFont::FixedFont (unsigned int h, unsigned int lh, unsigned int w, unsigned
// .. nothing yet ..
}
int
FixedFont::font_sizes ()
{
return ff_sizes;
}
const char *
FixedFont::font_size_name (int sz)
{
return ff_size_name (sz);
}
void
FixedFont::set_default_font_size (int fs)
{
ms_default_font_size = std::min (2, std::max (0, fs));
ms_default_font_size = std::min (ff_sizes - 1, std::max (0, fs));
}
const FixedFont &
FixedFont::get_font (double resolution)
{
int fs = ms_default_font_size;
int od = std::max (1, std::min (int (sizeof (fonts) / sizeof (fonts [0])) / 3, int (1.0 / resolution + 0.5))) - 1;
return fonts [od * 3 + fs];
int od = std::max (1, std::min (ff_resolutions, int (1.0 / resolution + 0.5))) - 1;
return fonts [od * ff_sizes + fs];
}
}
+11 -1
View File
@@ -27,10 +27,20 @@ public:
*/
static const FixedFont &get_font (double resolution);
/**
* @brief Gets the number of font sizes available
*/
static int font_sizes ();
/**
* @brief Gets the size description ("small", "large", ...)
*/
static const char *font_size_name (int sz);
/**
* @brief Set the default font size
*
* Allowed values are 0 (small), 1 (medium) or 2 (large)
* Allowed values are 0 (small), 1 (medium) or 2 (large) etc.
*/
static void set_default_font_size (int fs);
@@ -45,6 +45,8 @@
#include "layWidgets.h"
#include "layFileDialog.h"
#include "layFixedFont.h"
#include "dbHershey.h"
#include <QColorDialog>
@@ -1424,6 +1426,11 @@ LayoutViewConfigPage7::LayoutViewConfigPage7 (QWidget *parent)
{
mp_ui = new Ui::LayoutViewConfigPage7 ();
mp_ui->setupUi (this);
mp_ui->default_font_size->clear ();
for (int i = 0; i < lay::FixedFont::font_sizes (); ++i) {
mp_ui->default_font_size->addItem (QString::fromUtf8 (lay::FixedFont::font_size_name (i)));
}
}
LayoutViewConfigPage7::~LayoutViewConfigPage7 ()