diff options
author | Lars Muldjord <muldjordlars@gmail.com> | 2016-11-22 21:54:12 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-12-02 16:59:35 +0100 |
commit | 270b89ad4f1f21dd7fe6a00d601e670c7c62e24d (patch) | |
tree | 8a3b4427f872a646ee2c4e809aece183395b412a /tools | |
parent | 780d76fec7ead8d757f3dab718ed63e964cabdf1 (diff) |
Now renders '+' for all noncharacter characters
Diffstat (limited to 'tools')
-rw-r--r-- | tools/fontgen/generator.cc | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/tools/fontgen/generator.cc b/tools/fontgen/generator.cc index 61f87c7..f4714e5 100644 --- a/tools/fontgen/generator.cc +++ b/tools/fontgen/generator.cc @@ -96,12 +96,16 @@ void Generator::initGenerate() int charWidth = 0; QImage image(maxSize, maxSize, QImage::Format_ARGB32); image.fill(Qt::transparent); + /* if(a < 32 || (a > 126 && a < 160)) { horizOffset = 0; charWidth = 0; } else { - setHorizLimits(horizOffset, charWidth, a, image); + */ + setHorizLimits(horizOffset, charWidth, a, image); + /* } + */ if(a == 32) { horizOffset = 0; charWidth = sizeLineEdit->text().toInt() / 8; @@ -146,16 +150,27 @@ void Generator::setHorizLimits(int &horizOffset, int &charWidth, p.setPen(QPen(QColor(0, 0, 0, 255))); p.setFont(font); - if(embossEnabled->isChecked()) { - p.setPen(QPen(QColor(255, 255, 255, EMBOSSALPHA))); - p.drawText(maxSize / 2, maxSize / 2 + 1, QChar(curChar)); - p.setPen(QPen(QColor(0, 0, 0, 255))); + if(curChar < 32 || (curChar > 126 && curChar < 160)) { + if(embossEnabled->isChecked()) { + p.setPen(QPen(QColor(255, 255, 255, EMBOSSALPHA))); + p.drawText(maxSize / 2, maxSize / 2 + 1, "+"); + p.setPen(QPen(QColor(0, 0, 0, 255))); + } + // Draw twice to make it clearer + p.drawText(maxSize / 2, maxSize / 2, "+"); + p.setPen(QPen(QColor(0, 0, 0, FONTALPHA))); + p.drawText(maxSize / 2, maxSize / 2, "+"); + } else { + if(embossEnabled->isChecked()) { + p.setPen(QPen(QColor(255, 255, 255, EMBOSSALPHA))); + p.drawText(maxSize / 2, maxSize / 2 + 1, QChar(curChar)); + p.setPen(QPen(QColor(0, 0, 0, 255))); + } + // Draw twice to make it clearer + p.drawText(maxSize / 2, maxSize / 2, QChar(curChar)); + p.setPen(QPen(QColor(0, 0, 0, FONTALPHA))); + p.drawText(maxSize / 2, maxSize / 2, QChar(curChar)); } - // Draw twice to make it clearer - p.drawText(maxSize / 2, maxSize / 2, QChar(curChar)); - p.setPen(QPen(QColor(0, 0, 0, FONTALPHA))); - p.drawText(maxSize / 2, maxSize / 2, QChar(curChar)); - horizOffset = getHorizOffset(image); charWidth = getFontWidth(image, horizOffset); } |