From 13e0da6196547c6b408d56c469b93c026747bbcd Mon Sep 17 00:00:00 2001 From: Lars Muldjord Date: Tue, 22 Nov 2016 18:14:52 +0100 Subject: Added define for alpha threshold --- tools/fontgen/generator.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tools') 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 #include +#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; } } -- cgit v1.2.3