mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-07 11:31:08 +02:00
WIP: new fixed font bitmaps - needs improvement
This commit is contained in:
+89340
-25065
File diff suppressed because it is too large
Load Diff
@@ -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];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 ()
|
||||
|
||||
Reference in New Issue
Block a user