diff options
| author | Lars Muldjord <muldjordlars@gmail.com> | 2016-11-22 18:14:52 +0100 | 
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-12-02 16:59:34 +0100 | 
| commit | 13e0da6196547c6b408d56c469b93c026747bbcd (patch) | |
| tree | 5b47532338c4c1045e8cec77dab4ffe74698df6c /tools | |
| parent | 8c29d60059f63e8b90f853cecd41d06dc8879567 (diff) | |
Added define for alpha threshold
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/fontgen/generator.cc | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/tools/fontgen/generator.cc b/tools/fontgen/generator.cc index 89f0bc4..2ff0955 100644 --- a/tools/fontgen/generator.cc +++ b/tools/fontgen/generator.cc @@ -35,6 +35,8 @@  #include <QPen>  #include <QFont> +#define ALPHATHRES 100 +  Generator::Generator()  {    QLabel *fontLabel = new QLabel("Font family:"); @@ -42,7 +44,7 @@ Generator::Generator()    QLabel *sizeLabel = new QLabel("Font px size:");    sizeLineEdit = new QLineEdit("12");    QLabel *outputLabel = new QLabel("Output file:"); -  outputLineEdit = new QLineEdit("output"); +  outputLineEdit = new QLineEdit("../../plugingui/resources/font");    QVBoxLayout *layout = new QVBoxLayout();    QPushButton *renderButton = new QPushButton("Generate"); @@ -169,7 +171,7 @@ int Generator::getHorizOffset(const QImage &image)    for(int x = 0; x < maxSize; ++x) {      for(int y = 0; y < maxSize; ++y) {        // Check for alpha threshold to make sure we don't get too much space between chars -      if(image.pixelColor(x, y).alpha() > 30) { +      if(image.pixelColor(x, y).alpha() > ALPHATHRES) {          return x;        }      } @@ -182,7 +184,7 @@ int Generator::getFontWidth(const QImage &image, const int &horizOffset)    for(int x = maxSize - 1; x > horizOffset; --x) {      for(int y = 0; y < maxSize; ++y) {        // Check for alpha threshold to make sure we don't get too much space between chars -      if(image.pixelColor(x, y).alpha() > 30) { +      if(image.pixelColor(x, y).alpha() > ALPHATHRES) {          return x + 1 - horizOffset;        }      } | 
