[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 6e71c99 38/41: [ftinspect] Format `src/ftinspec
From: |
Werner Lemberg |
Subject: |
[freetype2-demos] master 6e71c99 38/41: [ftinspect] Format `src/ftinspect/panels/*`. |
Date: |
Mon, 3 Oct 2022 11:27:04 -0400 (EDT) |
branch: master
commit 6e71c9969aced97292e33a8f33c845c36567f7f7
Author: Werner Lemberg <wl@gnu.org>
Commit: Werner Lemberg <wl@gnu.org>
[ftinspect] Format `src/ftinspect/panels/*`.
---
src/ftinspect/panels/abstracttab.hpp | 9 +-
src/ftinspect/panels/comparator.cpp | 64 +--
src/ftinspect/panels/comparator.hpp | 23 +-
src/ftinspect/panels/continuous.cpp | 156 +++----
src/ftinspect/panels/continuous.hpp | 55 +--
src/ftinspect/panels/glyphdetails.cpp | 68 ++--
src/ftinspect/panels/glyphdetails.hpp | 16 +-
src/ftinspect/panels/info.cpp | 652 +++++++++++++++---------------
src/ftinspect/panels/info.hpp | 160 ++++----
src/ftinspect/panels/settingpanel.cpp | 108 ++---
src/ftinspect/panels/settingpanel.hpp | 46 +--
src/ftinspect/panels/settingpanelmmgx.cpp | 17 +-
src/ftinspect/panels/settingpanelmmgx.hpp | 22 +-
src/ftinspect/panels/singular.cpp | 69 ++--
src/ftinspect/panels/singular.hpp | 49 ++-
15 files changed, 806 insertions(+), 708 deletions(-)
diff --git a/src/ftinspect/panels/abstracttab.hpp
b/src/ftinspect/panels/abstracttab.hpp
index bd27f8d..be900d2 100644
--- a/src/ftinspect/panels/abstracttab.hpp
+++ b/src/ftinspect/panels/abstracttab.hpp
@@ -4,14 +4,15 @@
#pragma once
-// This is an pure abstract interface for a ftinspect "tab".
-// The interface itself does not inherit from `QWidget`, but should be used as
+
+// This is a pure, abstract interface for a 'tab' used within `ftinspect`.
+// The interface itself does not inherit from `QWidget` but should be used as
// the second base class.
class AbstractTab
{
public:
- virtual ~AbstractTab() = default; // must be `virtual` for `dynamic_cast`
-
+ virtual ~AbstractTab() = default; // Must be `virtual` for `dynamic_cast`.
+
virtual void repaintGlyph() = 0;
virtual void reloadFont() = 0;
};
diff --git a/src/ftinspect/panels/comparator.cpp
b/src/ftinspect/panels/comparator.cpp
index f1fae90..665b586 100644
--- a/src/ftinspect/panels/comparator.cpp
+++ b/src/ftinspect/panels/comparator.cpp
@@ -6,12 +6,15 @@
#include <QScrollBar>
+
namespace
{
extern const char* ComparatorDefaultText;
}
-ComparatorTab::ComparatorTab(QWidget* parent, Engine* engine)
+
+ComparatorTab::ComparatorTab(QWidget* parent,
+ Engine* engine)
: QWidget(parent),
engine_(engine)
{
@@ -35,8 +38,8 @@ ComparatorTab::repaintGlyph()
for (auto canvas : canvas_)
{
applySettings(i);
- // No cache here, because when switching between columns, the hinting
- // mode or enabling of embedded bitmaps may differ
+ // No cache here, because when switching between columns the hinting
+ // mode or enabling of embedded bitmaps may differ.
canvas->stringRenderer().reloadGlyphs();
canvas->purgeCache();
canvas->repaint();
@@ -50,8 +53,9 @@ ComparatorTab::reloadFont()
{
{
QSignalBlocker blocker(sizeSelector_);
- sizeSelector_->reloadFromFont(engine_);
+ sizeSelector_->reloadFromFont(engine_);
}
+
charMapSelector_->repopulate();
for (auto panel : settingPanels_)
panel->onFontChanged();
@@ -160,8 +164,8 @@ ComparatorTab::createConnections()
for (auto panel : settingPanels_)
{
- // We're treating the two events identically, because we need to do a
- // complete flush anyway
+ // We're treating the two events identically because we need to do a
+ // complete flush anyway.
connect(panel, &SettingPanel::repaintNeeded,
this, &ComparatorTab::repaintGlyph);
connect(panel, &SettingPanel::fontReloadNeeded,
@@ -200,11 +204,11 @@ ComparatorTab::forceEqualWidths()
if (canvas_.empty())
return;
- // We need to keep the columns strictly equally wide, so we need to
compensate
- // the remainders when the tab width can't be evenly divided.
- // Since the canvases are contained within QFrames, we can safely set fixed
- // widths to them without messying up with the QGridLayout layouting.
- // Using the first canvas as the reference width.
+ // We need to keep the columns strictly equally wide, so we need to
+ // compensate the remainders when the tab width can't be evenly divided.
+ // Since the canvases are contained within `QFrame`s, we can safely set
+ // fixed widths to them without messing up with the `QGridLayout`
+ // layouting. Using the first canvas as the reference width.
auto w = canvas_[0]->size().width();
for (int i = 1; static_cast<unsigned>(i) < canvas_.size(); ++i)
canvas_[i]->setFixedWidth(w);
@@ -288,25 +292,25 @@ ComparatorTab::wheelZoom(int steps)
namespace
{
const char* ComparatorDefaultText
- = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet"
- " dui. Nam sapien. Fusce vestibulum ornare metus. Maecenas ligula orci,"
- " consequat vitae, dictum nec, lacinia non, elit. Aliquam iaculis"
- " molestie neque. Maecenas suscipit felis ut pede convallis malesuada."
- " Aliquam erat volutpat. Nunc pulvinar condimentum nunc. Donec ac sem
vel"
- " leo bibendum aliquam. Pellentesque habitant morbi tristique senectus
et"
- " netus et malesuada fames ac turpis egestas.\n"
- "\n"
- "Sed commodo. Nulla ut libero sit amet justo varius blandit. Mauris
vitae"
- " nulla eget lorem pretium ornare. Proin vulputate erat porta risus."
- " Vestibulum malesuada, odio at vehicula lobortis, nisi metus hendrerit"
- " est, vitae feugiat quam massa a ligula. Aenean in tellus. Praesent"
- " convallis. Nullam vel lacus. Aliquam congue erat non urna mollis"
- " faucibus. Morbi vitae mauris faucibus quam condimentum ornare. Quisque"
- " sit amet augue. Morbi ullamcorper mattis enim. Aliquam erat volutpat."
- " Morbi nec felis non enim pulvinar lobortis. Ut libero. Nullam id orci"
- " quis nisl dapibus rutrum. Suspendisse consequat vulputate leo. Aenean"
- " non orci non tellus iaculis vestibulum. Sed neque.\n"
- "\n";
+ = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet"
+ " dui. Nam sapien. Fusce vestibulum ornare metus. Maecenas ligula orci,"
+ " consequat vitae, dictum nec, lacinia non, elit. Aliquam iaculis"
+ " molestie neque. Maecenas suscipit felis ut pede convallis malesuada."
+ " Aliquam erat volutpat. Nunc pulvinar condimentum nunc. Donec ac sem vel"
+ " leo bibendum aliquam. Pellentesque habitant morbi tristique senectus et"
+ " netus et malesuada fames ac turpis egestas.\n"
+ "\n"
+ "Sed commodo. Nulla ut libero sit amet justo varius blandit. Mauris vitae"
+ " nulla eget lorem pretium ornare. Proin vulputate erat porta risus."
+ " Vestibulum malesuada, odio at vehicula lobortis, nisi metus hendrerit"
+ " est, vitae feugiat quam massa a ligula. Aenean in tellus. Praesent"
+ " convallis. Nullam vel lacus. Aliquam congue erat non urna mollis"
+ " faucibus. Morbi vitae mauris faucibus quam condimentum ornare. Quisque"
+ " sit amet augue. Morbi ullamcorper mattis enim. Aliquam erat volutpat."
+ " Morbi nec felis non enim pulvinar lobortis. Ut libero. Nullam id orci"
+ " quis nisl dapibus rutrum. Suspendisse consequat vulputate leo. Aenean"
+ " non orci non tellus iaculis vestibulum. Sed neque.\n"
+ "\n";
}
diff --git a/src/ftinspect/panels/comparator.hpp
b/src/ftinspect/panels/comparator.hpp
index e3ab7fc..86302fa 100644
--- a/src/ftinspect/panels/comparator.hpp
+++ b/src/ftinspect/panels/comparator.hpp
@@ -6,34 +6,39 @@
#include "abstracttab.hpp"
#include "../engine/engine.hpp"
-#include "../widgets/customwidgets.hpp"
+#include "../glyphcomponents/glyphcontinuous.hpp"
+#include "../panels/settingpanel.hpp"
#include "../widgets/charmapcombobox.hpp"
+#include "../widgets/customwidgets.hpp"
#include "../widgets/fontsizeselector.hpp"
-#include "../panels/settingpanel.hpp"
-#include "../glyphcomponents/glyphcontinuous.hpp"
#include <vector>
-#include <QWidget>
+#include <QBoxLayout>
#include <QFrame>
-#include <QLabel>
#include <QGridLayout>
-#include <QBoxLayout>
+#include <QLabel>
#include <QPlainTextEdit>
+#include <QWidget>
+
class ComparatorTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- ComparatorTab(QWidget* parent, Engine* engine);
+ ComparatorTab(QWidget* parent,
+ Engine* engine);
~ComparatorTab() override;
void repaintGlyph() override;
void reloadFont() override;
protected:
- bool eventFilter(QObject* watched, QEvent* event) override;
+ bool eventFilter(QObject* watched,
+ QEvent* event) override;
void resizeEvent(QResizeEvent* event) override;
private:
diff --git a/src/ftinspect/panels/continuous.cpp
b/src/ftinspect/panels/continuous.cpp
index ef52034..51f9a3c 100644
--- a/src/ftinspect/panels/continuous.cpp
+++ b/src/ftinspect/panels/continuous.cpp
@@ -3,11 +3,11 @@
// Copyright (C) 2022 by Charlie Jiang.
#include "continuous.hpp"
-
#include "glyphdetails.hpp"
#include "../uihelper.hpp"
#include <climits>
+
#include <QToolTip>
#include <QVariant>
@@ -24,7 +24,7 @@ ContinuousTab::ContinuousTab(QWidget* parent,
createLayout();
std::vector<CharMapInfo> tempCharMaps;
- charMapSelector_->repopulate(tempCharMaps); // pass in an empty one
+ charMapSelector_->repopulate(tempCharMaps); // Pass in an empty one.
checkModeSource();
setDefaults();
@@ -37,7 +37,7 @@ void
ContinuousTab::repaintGlyph()
{
sizeSelector_->applyToEngine(engine_);
-
+
applySettings();
canvas_->stopFlashing();
canvas_->purgeCache();
@@ -67,7 +67,8 @@ ContinuousTab::reloadFont()
void
ContinuousTab::applySettings()
{
- auto mode =
static_cast<GlyphContinuous::Mode>(modeSelector_->currentIndex());
+ auto mode
+ = static_cast<GlyphContinuous::Mode>(modeSelector_->currentIndex());
auto src
= static_cast<GlyphContinuous::Source>(sourceSelector_->currentIndex());
canvas_->setMode(mode);
@@ -80,8 +81,9 @@ ContinuousTab::applySettings()
sr.setKerning(kerningCheckBox_->isChecked());
sr.setRotation(rotationSpinBox_->value());
- // -1: Glyph order, otherwise the char map index in the original list
- sr.setCharMapIndex(charMapSelector_->currentCharMapIndex(),
glyphLimitIndex_);
+ // -1: Glyph order, otherwise the char map index in the original list.
+ sr.setCharMapIndex(charMapSelector_->currentCharMapIndex(),
+ glyphLimitIndex_);
if (sr.isWaterfall())
sr.setWaterfallParameters(wfConfigDialog_->startSize(),
@@ -131,15 +133,17 @@ ContinuousTab::updateLimitIndex()
void
ContinuousTab::checkModeSource()
{
- auto isFancy = modeSelector_->currentIndex() == GlyphContinuous::M_Fancy;
- auto isStroked = modeSelector_->currentIndex() == GlyphContinuous::M_Stroked;
+ auto isFancy
+ = modeSelector_->currentIndex() == GlyphContinuous::M_Fancy;
+ auto isStroked
+ = modeSelector_->currentIndex() == GlyphContinuous::M_Stroked;
xEmboldeningSpinBox_->setEnabled(isFancy);
yEmboldeningSpinBox_->setEnabled(isFancy);
slantSpinBox_->setEnabled(isFancy);
strokeRadiusSpinBox_->setEnabled(isStroked);
auto src
- = static_cast<GlyphContinuous::Source>(sourceSelector_->currentIndex());
+ = static_cast<GlyphContinuous::Source>(sourceSelector_->currentIndex());
auto isTextStrict = src == GlyphContinuous::SRC_TextString;
auto isText = src == GlyphContinuous::SRC_TextString
|| src == GlyphContinuous::SRC_TextStringRepeated;
@@ -153,7 +157,7 @@ ContinuousTab::checkModeSource()
if (!isText)
kerningCheckBox_->setChecked(false);
}
-
+
canvas_->setSource(src);
{
@@ -250,7 +254,7 @@ ContinuousTab::updateGlyphDetails(GlyphCacheEntry* ctxt,
void
ContinuousTab::openWaterfallConfig()
{
- wfConfigDialog_->setVisible(true); // no `exec`: modalless
+ wfConfigDialog_->setVisible(true); // No `exec`: not modal.
}
@@ -324,7 +328,7 @@ ContinuousTab::createLayout()
indexSelector_->setNumberRenderer([this](int index)
{ return formatIndex(index); });
sourceTextEdit_ = new QPlainTextEdit(
- tr("The quick brown fox jumps over the lazy dog."), this);
+ tr("The quick brown fox jumps over the lazy dog."), this);
modeSelector_ = new QComboBox(this);
charMapSelector_ = new CharMapComboBox(this, engine_);
@@ -333,16 +337,16 @@ ContinuousTab::createLayout()
charMapSelector_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
- // Note: in sync with the enum!!
+ // Note: must be in sync with the enum!
modeSelector_->insertItem(GlyphContinuous::M_Normal, tr("Normal"));
modeSelector_->insertItem(GlyphContinuous::M_Fancy, tr("Fancy"));
modeSelector_->insertItem(GlyphContinuous::M_Stroked, tr("Stroked"));
modeSelector_->setCurrentIndex(GlyphContinuous::M_Normal);
- // Note: in sync with the enum!!
+ // Note: must be in sync with the enum!
sourceSelector_->insertItem(GlyphContinuous::SRC_AllGlyphs,
tr("All Glyphs"));
- sourceSelector_->insertItem(GlyphContinuous::SRC_TextString,
+ sourceSelector_->insertItem(GlyphContinuous::SRC_TextString,
tr("Text String"));
sourceSelector_->insertItem(GlyphContinuous::SRC_TextStringRepeated,
tr("Text String (Repeated)"));
@@ -390,35 +394,38 @@ ContinuousTab::createLayout()
wfConfigDialog_ = new WaterfallConfigDialog(this);
// Tooltips
- sourceSelector_->setToolTip(tr("Choose what to display as the text
source."));
- modeSelector_->setToolTip(
- tr("Choose the special effect in which the text is displayed."));
- strokeRadiusSpinBox_->setToolTip(
- tr("Stroke corner radius (only available when mode set to Stroked)"));
+ sourceSelector_->setToolTip(tr(
+ "Choose what to display as the text source."));
+ modeSelector_->setToolTip(tr(
+ "Choose the special effect in which the text is displayed."));
+ strokeRadiusSpinBox_->setToolTip(tr(
+ "Stroke corner radius (only available when mode set to Stroked)"));
rotationSpinBox_->setToolTip(tr("Rotation, in degrees"));
- xEmboldeningSpinBox_->setToolTip(
- tr("Horizontal Emboldening (only available when mode set to Fancy)"));
- yEmboldeningSpinBox_->setToolTip(
- tr("Vertical Emboldening (only available when mode set to Fancy)"));
- slantSpinBox_->setToolTip(
- tr("Slanting (only available when mode set to Fancy)"));
- sourceTextEdit_->setToolTip(
- tr("Source string (only available when source set to Text String)"));
+ xEmboldeningSpinBox_->setToolTip(tr(
+ "Horizontal Emboldening (only available when mode set to Fancy)"));
+ yEmboldeningSpinBox_->setToolTip(tr(
+ "Vertical Emboldening (only available when mode set to Fancy)"));
+ slantSpinBox_->setToolTip(tr(
+ "Slanting (only available when mode set to Fancy)"));
+ sourceTextEdit_->setToolTip(tr(
+ "Source string (only available when source set to Text String)"));
waterfallConfigButton_->setToolTip(tr(
"Set waterfall start and end size. Not available when the font is not\n"
"scalable because in such case all available sizes would be displayed."));
- sampleStringSelector_->setToolTip(
- tr("Select preset sample strings (only available when source set to\nText "
- "String)"));
- resetPositionButton_->setToolTip(tr("Reset the position to the center (only "
- "available when source set to\nText "
- "String)"));
+ sampleStringSelector_->setToolTip(tr(
+ "Select preset sample strings (only available when source set to\n"
+ "Text String)"));
+ resetPositionButton_->setToolTip(tr(
+ "Reset the position to the center (only available when source set to\n"
+ "Text String)"));
waterfallCheckBox_->setToolTip(tr(
- "Enable waterfall mode: show the font output in different sizes.\nWill "
- "show all available sizes when the font is not scalable."));
- verticalCheckBox_->setToolTip(tr("Enable vertical rendering (only
available\n"
- "when source set to Text String)"));
- kerningCheckBox_->setToolTip(tr("Enable kerning (GPOS table unsupported)"));
+ "Enable waterfall mode: show the font output in different sizes.\n"
+ "Will show all available sizes when the font is not scalable."));
+ verticalCheckBox_->setToolTip(tr(
+ "Enable vertical rendering (only available\n"
+ "when source set to Text String)"));
+ kerningCheckBox_->setToolTip(tr(
+ "Enable kerning (GPOS table unsupported)"));
helpButton_->setToolTip(tr("Get mouse helps"));
// Layouting
@@ -478,19 +485,19 @@ ContinuousTab::createConnections()
connect(sizeSelector_, &FontSizeSelector::valueChanged,
this, &ContinuousTab::reloadGlyphsAndRepaint);
- connect(canvas_, &GlyphContinuous::wheelResize,
+ connect(canvas_, &GlyphContinuous::wheelResize,
this, &ContinuousTab::wheelResize);
- connect(canvas_, &GlyphContinuous::wheelNavigate,
+ connect(canvas_, &GlyphContinuous::wheelNavigate,
this, &ContinuousTab::wheelNavigate);
- connect(canvas_, &GlyphContinuous::wheelZoom,
+ connect(canvas_, &GlyphContinuous::wheelZoom,
this, &ContinuousTab::wheelZoom);
- connect(canvas_, &GlyphContinuous::displayingCountUpdated,
+ connect(canvas_, &GlyphContinuous::displayingCountUpdated,
indexSelector_, &GlyphIndexSelector::setShowingCount);
- connect(canvas_, &GlyphContinuous::rightClickGlyph,
+ connect(canvas_, &GlyphContinuous::rightClickGlyph,
this, &ContinuousTab::switchToSingular);
- connect(canvas_, &GlyphContinuous::beginIndexChangeRequest,
+ connect(canvas_, &GlyphContinuous::beginIndexChangeRequest,
this, &ContinuousTab::setGlyphBeginindex);
- connect(canvas_, &GlyphContinuous::updateGlyphDetails,
+ connect(canvas_, &GlyphContinuous::updateGlyphDetails,
this, &ContinuousTab::updateGlyphDetails);
connect(indexSelector_, &GlyphIndexSelector::currentIndexChanged,
@@ -514,19 +521,19 @@ ContinuousTab::createConnections()
connect(wfConfigDialog_, &WaterfallConfigDialog::sizeUpdated,
this, &ContinuousTab::repaintGlyph);
- connect(xEmboldeningSpinBox_,
+ connect(xEmboldeningSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &ContinuousTab::repaintGlyph);
- connect(yEmboldeningSpinBox_,
+ connect(yEmboldeningSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &ContinuousTab::repaintGlyph);
- connect(slantSpinBox_,
+ connect(slantSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &ContinuousTab::repaintGlyph);
- connect(strokeRadiusSpinBox_,
+ connect(strokeRadiusSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &ContinuousTab::repaintGlyph);
- connect(rotationSpinBox_,
+ connect(rotationSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &ContinuousTab::repaintGlyph);
@@ -538,7 +545,7 @@ ContinuousTab::createConnections()
this, &ContinuousTab::reloadGlyphsAndRepaint);
connect(sourceTextEdit_, &QPlainTextEdit::textChanged,
this, &ContinuousTab::sourceTextChanged);
- connect(sampleStringSelector_,
+ connect(sampleStringSelector_,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &ContinuousTab::presetStringSelected);
@@ -562,13 +569,20 @@ ContinuousTab::setDefaults()
canvas_->setSource(GlyphContinuous::SRC_AllGlyphs);
sampleStringSelector_->addItem(tr("<Sample>"));
- sampleStringSelector_->addItem(tr("English"), QString(StringSamples[0]));
- sampleStringSelector_->addItem(tr("Latin"), QString(StringSamples[1]));
- sampleStringSelector_->addItem(tr("Greek"), QString(StringSamples[2]));
- sampleStringSelector_->addItem(tr("Cyrillic"), QString(StringSamples[3]));
- sampleStringSelector_->addItem(tr("Chinese"), QString(StringSamples[4]));
- sampleStringSelector_->addItem(tr("Japanese"), QString(StringSamples[5]));
- sampleStringSelector_->addItem(tr("Korean"), QString(StringSamples[6]));
+ sampleStringSelector_->addItem(tr("English"),
+ QString(StringSamples[0]));
+ sampleStringSelector_->addItem(tr("Latin"),
+ QString(StringSamples[1]));
+ sampleStringSelector_->addItem(tr("Greek"),
+ QString(StringSamples[2]));
+ sampleStringSelector_->addItem(tr("Cyrillic"),
+ QString(StringSamples[3]));
+ sampleStringSelector_->addItem(tr("Chinese"),
+ QString(StringSamples[4]));
+ sampleStringSelector_->addItem(tr("Japanese"),
+ QString(StringSamples[5]));
+ sampleStringSelector_->addItem(tr("Korean"),
+ QString(StringSamples[6]));
}
@@ -576,7 +590,7 @@ QString
ContinuousTab::formatIndex(int index)
{
auto idx = charMapSelector_->currentCharMapIndex();
- if (idx < 0) // glyph order
+ if (idx < 0) // Glyph order.
return QString::number(index);
return charMapSelector_->charMaps()[idx].stringifyIndexShort(index);
}
@@ -635,8 +649,8 @@ WaterfallConfigDialog::createLayout()
// Tooltips
autoBox_->setToolTip(tr(
- "Use the default value which will try to start from near zero and place "
- "in the middle of the screen the size selected in the selector."));
+ "Use the default value which will try to start from near zero and place"
+ " in the middle of the screen the size selected in the selector."));
startSpinBox_->setToolTip(tr("Start size, will be always guaranteed."));
endSpinBox_->setToolTip(tr(
"End size, may not be guaranteed due to rounding and precision issues."));
@@ -656,10 +670,10 @@ WaterfallConfigDialog::createConnections()
{
connect(autoBox_, &QCheckBox::clicked,
this, &WaterfallConfigDialog::checkAutoStatus);
- connect(startSpinBox_,
+ connect(startSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &WaterfallConfigDialog::sizeUpdated);
- connect(endSpinBox_,
+ connect(endSpinBox_,
QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &WaterfallConfigDialog::sizeUpdated);
}
@@ -680,15 +694,15 @@ const char* StringSamples[] = {
/* Luís argüia à Júlia que «brações, fé, chá, óxido, pôr, zângão» */
/* eram palavras do português */
- "Lu\u00EDs arg\u00FCia \u00E0 J\u00FAlia que \u00ABbra\u00E7\u00F5es, "
- "f\u00E9, ch\u00E1, \u00F3xido, p\u00F4r, z\u00E2ng\u00E3o\u00BB eram "
- "palavras do portugu\u00EAs",
+ "Lu\u00EDs arg\u00FCia \u00E0 J\u00FAlia que \u00ABbra\u00E7\u00F5es,"
+ " f\u00E9, ch\u00E1, \u00F3xido, p\u00F4r, z\u00E2ng\u00E3o\u00BB eram"
+ " palavras do portugu\u00EAs",
/* Ο καλύμνιος σφουγγαράς ψιθύρισε πως θα βουτήξει χωρίς να διστάζει */
"\u039F \u03BA\u03B1\u03BB\u03CD\u03BC\u03BD\u03B9\u03BF\u03C2 \u03C3"
"\u03C6\u03BF\u03C5\u03B3\u03B3\u03B1\u03C1\u03AC\u03C2 \u03C8\u03B9"
- "\u03B8\u03CD\u03C1\u03B9\u03C3\u03B5 \u03C0\u03C9\u03C2 \u03B8\u03B1 "
- "\u03B2\u03BF\u03C5\u03C4\u03AE\u03BE\u03B5\u03B9 \u03C7\u03C9\u03C1"
+ "\u03B8\u03CD\u03C1\u03B9\u03C3\u03B5 \u03C0\u03C9\u03C2 \u03B8\u03B1"
+ " \u03B2\u03BF\u03C5\u03C4\u03AE\u03BE\u03B5\u03B9 \u03C7\u03C9\u03C1"
"\u03AF\u03C2 \u03BD\u03B1 \u03B4\u03B9\u03C3\u03C4\u03AC\u03B6\u03B5"
"\u03B9",
@@ -696,8 +710,8 @@ const char* StringSamples[] = {
"\u0421\u044A\u0435\u0448\u044C \u0435\u0449\u0451 \u044D\u0442\u0438"
"\u0445 \u043C\u044F\u0433\u043A\u0438\u0445 \u0444\u0440\u0430\u043D"
"\u0446\u0443\u0437\u0441\u043A\u0438\u0445 \u0431\u0443\u043B\u043E"
- "\u043A \u0434\u0430 \u0432\u044B\u043F\u0435\u0439 \u0436\u0435 "
- "\u0447\u0430\u044E",
+ "\u043A \u0434\u0430 \u0432\u044B\u043F\u0435\u0439 \u0436\u0435"
+ " \u0447\u0430\u044E",
/* 天地玄黃,宇宙洪荒。日月盈昃,辰宿列張。寒來暑往,秋收冬藏。*/
"\u5929\u5730\u7384\u9EC3\uFF0C\u5B87\u5B99\u6D2A\u8352\u3002\u65E5"
diff --git a/src/ftinspect/panels/continuous.hpp
b/src/ftinspect/panels/continuous.hpp
index 2daaa9f..5fd43d9 100644
--- a/src/ftinspect/panels/continuous.hpp
+++ b/src/ftinspect/panels/continuous.hpp
@@ -5,35 +5,42 @@
#pragma once
#include "abstracttab.hpp"
+#include "../engine/engine.hpp"
+#include "../glyphcomponents/glyphcontinuous.hpp"
+#include "../glyphcomponents/graphicsdefault.hpp"
+#include "../widgets/charmapcombobox.hpp"
#include "../widgets/customwidgets.hpp"
-#include "../widgets/glyphindexselector.hpp"
#include "../widgets/fontsizeselector.hpp"
-#include "../widgets/charmapcombobox.hpp"
-#include "../glyphcomponents/graphicsdefault.hpp"
-#include "../glyphcomponents/glyphcontinuous.hpp"
-#include "../engine/engine.hpp"
+#include "../widgets/glyphindexselector.hpp"
#include <vector>
-#include <QWidget>
+
+#include <QBoxLayout>
+#include <QCheckBox>
+#include <QComboBox>
#include <QDialog>
+#include <QDockWidget>
#include <QFrame>
-#include <QLabel>
-#include <QComboBox>
#include <QGridLayout>
-#include <QBoxLayout>
+#include <QLabel>
#include <QPlainTextEdit>
-#include <QDockWidget>
-#include <QCheckBox>
+#include <QWidget>
+
class GlyphDetails;
class WaterfallConfigDialog;
+
class ContinuousTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- ContinuousTab(QWidget* parent, Engine* engine,
- QDockWidget* gdWidget, GlyphDetails* glyphDetails);
+ ContinuousTab(QWidget* parent,
+ Engine* engine,
+ QDockWidget* gdWidget,
+ GlyphDetails* glyphDetails);
~ContinuousTab() override = default;
void repaintGlyph() override;
@@ -42,12 +49,14 @@ public:
void applySettings();
signals:
- // if sizePoint <= 0, then don't change size.
- void switchToSingular(int glyphIndex, double sizePoint);
+ // Don't change size if `sizePoint` <= 0.
+ void switchToSingular(int glyphIndex,
+ double sizePoint);
protected:
- bool eventFilter(QObject* watched, QEvent* event) override;
-
+ bool eventFilter(QObject* watched,
+ QEvent* event) override;
+
private:
Engine* engine_;
@@ -89,7 +98,7 @@ private:
GlyphIndexSelector* indexSelector_;
QPlainTextEdit* sourceTextEdit_;
-
+
QHBoxLayout* canvasFrameLayout_;
QHBoxLayout* sizeHelpLayout_;
QGridLayout* bottomLayout_;
@@ -106,18 +115,18 @@ private:
void updateLimitIndex();
void checkModeSource();
- // This doesn't trigger immediate repaint
+ // This doesn't trigger immediate repaint...
void setGlyphCount(int count);
- // But they do
+ // ... but these do.
void setGlyphBeginindex(int index);
void checkModeSourceAndRepaint();
void charMapChanged();
void sourceTextChanged();
void presetStringSelected();
void reloadGlyphsAndRepaint();
- void updateGlyphDetails(GlyphCacheEntry* ctxt,
- int charMapIndex,
+ void updateGlyphDetails(GlyphCacheEntry* ctxt,
+ int charMapIndex,
bool open);
void openWaterfallConfig();
void showToolTip();
diff --git a/src/ftinspect/panels/glyphdetails.cpp
b/src/ftinspect/panels/glyphdetails.cpp
index fa595ee..2d82f62 100644
--- a/src/ftinspect/panels/glyphdetails.cpp
+++ b/src/ftinspect/panels/glyphdetails.cpp
@@ -3,11 +3,10 @@
// Copyright (C) 2022 by Charlie Jiang.
#include "glyphdetails.hpp"
-
+#include "../engine/engine.hpp"
#include "../engine/stringrenderer.hpp"
#include "../glyphcomponents/glyphcontinuous.hpp"
#include "../uihelper.hpp"
-#include "../engine/engine.hpp"
GlyphDetails::GlyphDetails(QWidget* parent,
@@ -26,14 +25,16 @@ GlyphDetails::~GlyphDetails()
void
-GlyphDetails::updateGlyph(GlyphCacheEntry& ctxt, int charMapIndex)
+GlyphDetails::updateGlyph(GlyphCacheEntry& ctxt,
+ int charMapIndex)
{
auto metrics = engine_->currentFontMetrics();
auto& cMaps = engine_->currentFontCharMaps();
glyphIndex_ = ctxt.glyphIndex;
glyphIndexLabel_->setText(QString::number(ctxt.glyphIndex));
- if (charMapIndex < 0 || static_cast<unsigned>(charMapIndex) >= cMaps.size())
+ if (charMapIndex < 0
+ || static_cast<unsigned>(charMapIndex) >= cMaps.size())
{
charCodePromptLabel_->setVisible(false);
charCodeLabel_->setVisible(false);
@@ -43,21 +44,24 @@ GlyphDetails::updateGlyph(GlyphCacheEntry& ctxt, int
charMapIndex)
charCodePromptLabel_->setVisible(true);
charCodeLabel_->setVisible(true);
charCodeLabel_->setText(
- cMaps[charMapIndex].stringifyIndexShort(ctxt.charCode));
+ cMaps[charMapIndex].stringifyIndexShort(ctxt.charCode));
}
auto glyphName = engine_->glyphName(ctxt.glyphIndex);
if (glyphName.isEmpty())
glyphName = "(none)";
glyphNameLabel_->setText(glyphName);
-
+
auto rect = ctxt.basePosition.translated(-(ctxt.penPos.x()),
-(ctxt.penPos.y()));
- bitmapWidget_->updateImage(
- ctxt.image, rect,
- QRect(0, -metrics.y_ppem, metrics.y_ppem, metrics.y_ppem));
-
- // load glyphs in all units
+ bitmapWidget_->updateImage(ctxt.image,
+ rect,
+ QRect(0,
+ -metrics.y_ppem,
+ metrics.y_ppem,
+ metrics.y_ppem));
+
+ // Load glyphs in all units.
dpi_ = engine_->dpi();
engine_->reloadFont();
@@ -140,22 +144,22 @@ GlyphDetails::createLayout()
// Tooltips
fontUnitButton_->setToolTip(tr("Unit for most metrics entries below"));
- pointButton_ ->setToolTip(tr("Unit for most metrics entries below"));
- pixelButton_ ->setToolTip(tr("Unit for most metrics entries below"));
- bboxSizeLabel_->setToolTip(
- tr("Glyph bounding box (in unit specified above)"));
- horiBearingLabel_->setToolTip(
- tr("Bearing for horizontal layout (in unit specified above)"));
- horiAdvanceLabel_->setToolTip(
- tr("Advance for horizontal layout (in unit specified above)"));
- vertBearingLabel_->setToolTip(
- tr("Bearing for vertical layout (in unit specified above)"));
- vertAdvanceLabel_->setToolTip(
- tr("Advance for vertical layout (in unit specified above)"));
- inkSizeLabel_->setToolTip(
- tr("The tightest bounding box size (always in pixels)"));
- bitmapOffsetLabel_->setToolTip(
- tr("Offset from the most top-left point to the bitmap (always in
pixels)"));
+ pointButton_->setToolTip(tr("Unit for most metrics entries below"));
+ pixelButton_->setToolTip(tr("Unit for most metrics entries below"));
+ bboxSizeLabel_->setToolTip(tr(
+ "Glyph bounding box (in unit specified above)"));
+ horiBearingLabel_->setToolTip(tr(
+ "Bearing for horizontal layout (in unit specified above)"));
+ horiAdvanceLabel_->setToolTip(tr(
+ "Advance for horizontal layout (in unit specified above)"));
+ vertBearingLabel_->setToolTip(tr(
+ "Bearing for vertical layout (in unit specified above)"));
+ vertAdvanceLabel_->setToolTip(tr(
+ "Advance for vertical layout (in unit specified above)"));
+ inkSizeLabel_->setToolTip(tr(
+ "The tightest bounding box size (always in pixels)"));
+ bitmapOffsetLabel_->setToolTip(tr(
+ "Offset from the most top-left point to the bitmap (always in pixels)"));
bitmapWidget_->setToolTip(tr("Bitmap preview"));
// Layouting
@@ -169,11 +173,11 @@ GlyphDetails::createLayout()
gridLayout2ColAddItem(layout_, new QSpacerItem(0, 18));
gridLayout2ColAddWidget(layout_, glyphIndexPromptLabel_, glyphIndexLabel_);
- gridLayout2ColAddWidget(layout_, charCodePromptLabel_ , charCodeLabel_ );
- gridLayout2ColAddWidget(layout_, glyphNamePromptLabel_ , glyphNameLabel_ );
+ gridLayout2ColAddWidget(layout_, charCodePromptLabel_, charCodeLabel_);
+ gridLayout2ColAddWidget(layout_, glyphNamePromptLabel_, glyphNameLabel_);
gridLayout2ColAddItem(layout_, new QSpacerItem(0, 18));
- gridLayout2ColAddWidget(layout_, bboxSizePromptLabel_, bboxSizeLabel_ );
+ gridLayout2ColAddWidget(layout_, bboxSizePromptLabel_, bboxSizeLabel_ );
gridLayout2ColAddWidget(layout_, horiBearingPromptLabel_, horiBearingLabel_);
gridLayout2ColAddWidget(layout_, horiAdvancePromptLabel_, horiAdvanceLabel_);
gridLayout2ColAddWidget(layout_, vertBearingPromptLabel_, vertBearingLabel_);
@@ -181,7 +185,7 @@ GlyphDetails::createLayout()
gridLayout2ColAddItem(layout_, new QSpacerItem(0, 18));
gridLayout2ColAddWidget(layout_, inkSizePromptLabel_, inkSizeLabel_);
- gridLayout2ColAddWidget(layout_, bitmapOffsetPromptLabel_,
+ gridLayout2ColAddWidget(layout_, bitmapOffsetPromptLabel_,
bitmapOffsetLabel_);
gridLayout2ColAddItem(layout_, new QSpacerItem(0, 18));
@@ -242,7 +246,7 @@ GlyphDetails::changeUnit(int unitId)
vertBearingY = pixelMetrics_.vertBearingY * 1.125 / dpi_;
vertAdvance = pixelMetrics_.vertAdvance * 1.125 / dpi_;
break;
-
+
case DU_Pixel:
unitSuffix = " px";
bboxW = pixelMetrics_.width/ 64.0;
diff --git a/src/ftinspect/panels/glyphdetails.hpp
b/src/ftinspect/panels/glyphdetails.hpp
index 99b6139..c3474e7 100644
--- a/src/ftinspect/panels/glyphdetails.hpp
+++ b/src/ftinspect/panels/glyphdetails.hpp
@@ -6,25 +6,28 @@
#include "../glyphcomponents/glyphbitmap.hpp"
-#include <QWidget>
-#include <QLabel>
-#include <QGridLayout>
#include <QBoxLayout>
+#include <QButtonGroup>
+#include <QGridLayout>
#include <QImage>
+#include <QLabel>
#include <QRadioButton>
-#include <QButtonGroup>
+#include <QWidget>
#include <freetype/freetype.h>
+
struct GlyphCacheEntry;
class Engine;
+
class GlyphDetails
: public QWidget
{
Q_OBJECT
public:
- GlyphDetails(QWidget* parent, Engine* engine);
+ GlyphDetails(QWidget* parent,
+ Engine* engine);
~GlyphDetails() override;
void updateGlyph(GlyphCacheEntry& ctxt,
@@ -81,7 +84,8 @@ private:
QGridLayout* layout_;
int dpi_;
- FT_Glyph_Metrics fontUnitMetrics_, pixelMetrics_;
+ FT_Glyph_Metrics fontUnitMetrics_;
+ FT_Glyph_Metrics pixelMetrics_;
void createLayout();
void createConnections();
diff --git a/src/ftinspect/panels/info.cpp b/src/ftinspect/panels/info.cpp
index 6c64465..ef9c778 100644
--- a/src/ftinspect/panels/info.cpp
+++ b/src/ftinspect/panels/info.cpp
@@ -3,23 +3,24 @@
// Copyright (C) 2022 by Charlie Jiang.
#include "info.hpp"
-
-#include "../uihelper.hpp"
#include "../engine/engine.hpp"
+#include "../uihelper.hpp"
#include <cstring>
-#include <QStringList>
+
#include <QHeaderView>
+#include <QStringList>
-#define GL2CRow(l, w) gridLayout2ColAddWidget(l, \
- w##PromptLabel_, \
+#define GL2CRow(l, w) gridLayout2ColAddWidget(l, \
+ w##PromptLabel_, \
w##Label_)
InfoTab::InfoTab(QWidget* parent,
Engine* engine)
-: QWidget(parent), engine_(engine)
+: QWidget(parent),
+ engine_(engine)
{
createLayout();
createConnections();
@@ -73,7 +74,8 @@ InfoTab::createConnections()
GeneralInfoTab::GeneralInfoTab(QWidget* parent,
Engine* engine)
-: QWidget(parent), engine_(engine)
+: QWidget(parent),
+ engine_(engine)
{
createLayout();
}
@@ -83,27 +85,27 @@ void
GeneralInfoTab::reloadFont()
{
auto basicInfo = FontBasicInfo::get(engine_);
- // don't update when unnecessary
- if (basicInfo != oldFontBasicInfo_)
+ // Don't update if unnecessary.
+ if (basicInfo != oldFontBasicInfo_)
{
oldFontBasicInfo_ = basicInfo;
if (basicInfo.numFaces < 0)
numFacesLabel_->clear();
else
numFacesLabel_->setText(QString::number(basicInfo.numFaces));
-
- familyLabel_->setText(basicInfo.familyName);
- styleLabel_->setText(basicInfo.styleName);
- postscriptLabel_->setText(basicInfo.postscriptName);
- revisionLabel_->setText(basicInfo.revision);
- copyrightLabel_->setText(basicInfo.copyright);
- trademarkLabel_->setText(basicInfo.trademark);
+
+ familyLabel_->setText(basicInfo.familyName);
+ styleLabel_->setText(basicInfo.styleName);
+ postscriptLabel_->setText(basicInfo.postscriptName);
+ revisionLabel_->setText(basicInfo.revision);
+ copyrightLabel_->setText(basicInfo.copyright);
+ trademarkLabel_->setText(basicInfo.trademark);
manufacturerLabel_->setText(basicInfo.manufacturer);
-
+
createdLabel_->setText(
- basicInfo.createdTime.toString("yyyy-MM-dd hh:mm:ss t"));
+ basicInfo.createdTime.toString("yyyy-MM-dd hh:mm:ss t"));
modifiedLabel_->setText(
- basicInfo.modifiedTime.toString("yyyy-MM-dd hh:mm:ss t"));
+ basicInfo.modifiedTime.toString("yyyy-MM-dd hh:mm:ss t"));
}
auto fontTypeEntries = FontTypeEntries::get(engine_);
@@ -114,12 +116,12 @@ GeneralInfoTab::reloadFont()
QString directionText;
// Don't want to do concat...
if (fontTypeEntries.hasHorizontal && fontTypeEntries.hasVertical)
- directionText = "honizontal, vertical";
+ directionText = "horizontal, vertical";
else if (fontTypeEntries.hasHorizontal)
directionText = "horizontal";
else if (fontTypeEntries.hasVertical)
directionText = "vertical";
-
+
QStringList types;
if (fontTypeEntries.scalable)
types += "scalable";
@@ -127,14 +129,14 @@ GeneralInfoTab::reloadFont()
types += "multiple master";
if (fontTypeEntries.fixedSizes)
types += "fixed sizes";
-
+
driverNameLabel_->setText(fontTypeEntries.driverName);
- sfntLabel_->setText(fontTypeEntries.sfnt ? "yes" : "no");
- fontTypeLabel_->setText(types.join(", "));
- directionLabel_->setText(directionText);
+ sfntLabel_->setText(fontTypeEntries.sfnt ? "yes" : "no");
+ fontTypeLabel_->setText(types.join(", "));
+ directionLabel_->setText(directionText);
fixedWidthLabel_->setText(fontTypeEntries.fixedWidth ? "yes" : "no");
glyphNamesLabel_->setText(fontTypeEntries.glyphNames ? "available"
- : "unavailable");
+ : "unavailable");
if (fontTypeEntries.scalable)
{
@@ -167,7 +169,7 @@ GeneralInfoTab::reloadFont()
fixedSizesTable_->setEnabled(fontTypeEntries.fixedSizes);
bool reset
- = FontFixedSize::get(engine_,
+ = FontFixedSize::get(engine_,
fixedSizeInfoModel_->storage(),
[&] { fixedSizeInfoModel_->beginModelUpdate(); });
if (reset)
@@ -185,112 +187,112 @@ GeneralInfoTab::reloadFont()
void
GeneralInfoTab::createLayout()
{
- numFacesPromptLabel_ = new QLabel(tr("Num of Faces:"), this);
- familyPromptLabel_ = new QLabel(tr("Family Name:"), this);
- stylePromptLabel_ = new QLabel(tr("Style Name:"), this);
- postscriptPromptLabel_ = new QLabel(tr("PostScript Name:"), this);
- createdPromptLabel_ = new QLabel(tr("Created at:"), this);
- modifiedPromptLabel_ = new QLabel(tr("Modified at:"), this);
- revisionPromptLabel_ = new QLabel(tr("Font Revision:"), this);
- copyrightPromptLabel_ = new QLabel(tr("Copyright:"), this);
- trademarkPromptLabel_ = new QLabel(tr("Trademark:"), this);
- manufacturerPromptLabel_ = new QLabel(tr("Manufacturer:"), this);
-
- numFacesLabel_ = new QLabel(this);
- familyLabel_ = new QLabel(this);
- styleLabel_ = new QLabel(this);
- postscriptLabel_ = new QLabel(this);
- createdLabel_ = new QLabel(this);
- modifiedLabel_ = new QLabel(this);
- revisionLabel_ = new QLabel(this);
- copyrightLabel_ = new QLabel(this);
- trademarkLabel_ = new QLabel(this);
+ numFacesPromptLabel_ = new QLabel(tr("Num of Faces:"), this);
+ familyPromptLabel_ = new QLabel(tr("Family Name:"), this);
+ stylePromptLabel_ = new QLabel(tr("Style Name:"), this);
+ postscriptPromptLabel_ = new QLabel(tr("PostScript Name:"), this);
+ createdPromptLabel_ = new QLabel(tr("Created at:"), this);
+ modifiedPromptLabel_ = new QLabel(tr("Modified at:"), this);
+ revisionPromptLabel_ = new QLabel(tr("Font Revision:"), this);
+ copyrightPromptLabel_ = new QLabel(tr("Copyright:"), this);
+ trademarkPromptLabel_ = new QLabel(tr("Trademark:"), this);
+ manufacturerPromptLabel_ = new QLabel(tr("Manufacturer:"), this);
+
+ numFacesLabel_ = new QLabel(this);
+ familyLabel_ = new QLabel(this);
+ styleLabel_ = new QLabel(this);
+ postscriptLabel_ = new QLabel(this);
+ createdLabel_ = new QLabel(this);
+ modifiedLabel_ = new QLabel(this);
+ revisionLabel_ = new QLabel(this);
+ copyrightLabel_ = new QLabel(this);
+ trademarkLabel_ = new QLabel(this);
manufacturerLabel_ = new QLabel(this);
- setLabelSelectable( numFacesLabel_);
- setLabelSelectable( familyLabel_);
- setLabelSelectable( styleLabel_);
- setLabelSelectable( postscriptLabel_);
- setLabelSelectable( createdLabel_);
- setLabelSelectable( modifiedLabel_);
- setLabelSelectable( revisionLabel_);
- setLabelSelectable( copyrightLabel_);
- setLabelSelectable( trademarkLabel_);
+ setLabelSelectable(numFacesLabel_);
+ setLabelSelectable(familyLabel_);
+ setLabelSelectable(styleLabel_);
+ setLabelSelectable(postscriptLabel_);
+ setLabelSelectable(createdLabel_);
+ setLabelSelectable(modifiedLabel_);
+ setLabelSelectable(revisionLabel_);
+ setLabelSelectable(copyrightLabel_);
+ setLabelSelectable(trademarkLabel_);
setLabelSelectable(manufacturerLabel_);
- copyrightLabel_->setWordWrap(true);
- trademarkLabel_->setWordWrap(true);
+ copyrightLabel_->setWordWrap(true);
+ trademarkLabel_->setWordWrap(true);
manufacturerLabel_->setWordWrap(true);
driverNamePromptLabel_ = new QLabel(tr("Driver:"), this);
- sfntPromptLabel_ = new QLabel(tr("SFNT Wrapped:"), this);
- fontTypePromptLabel_ = new QLabel(tr("Type:"), this);
- directionPromptLabel_ = new QLabel(tr("Direction:"), this);
+ sfntPromptLabel_ = new QLabel(tr("SFNT Wrapped:"), this);
+ fontTypePromptLabel_ = new QLabel(tr("Type:"), this);
+ directionPromptLabel_ = new QLabel(tr("Direction:"), this);
fixedWidthPromptLabel_ = new QLabel(tr("Fixed Width:"), this);
glyphNamesPromptLabel_ = new QLabel(tr("Glyph Names:"), this);
driverNameLabel_ = new QLabel(this);
- sfntLabel_ = new QLabel(this);
- fontTypeLabel_ = new QLabel(this);
- directionLabel_ = new QLabel(this);
+ sfntLabel_ = new QLabel(this);
+ fontTypeLabel_ = new QLabel(this);
+ directionLabel_ = new QLabel(this);
fixedWidthLabel_ = new QLabel(this);
glyphNamesLabel_ = new QLabel(this);
setLabelSelectable(driverNameLabel_);
- setLabelSelectable( sfntLabel_);
- setLabelSelectable( fontTypeLabel_);
- setLabelSelectable( directionLabel_);
+ setLabelSelectable(sfntLabel_);
+ setLabelSelectable(fontTypeLabel_);
+ setLabelSelectable(directionLabel_);
setLabelSelectable(fixedWidthLabel_);
setLabelSelectable(glyphNamesLabel_);
- emSizePromptLabel_ = new QLabel(tr("EM Size:"), this);
- bboxPromptLabel_ = new QLabel(tr("Global BBox:"), this);
- ascenderPromptLabel_ = new QLabel(tr("Ascender:"), this);
- descenderPromptLabel_ = new QLabel(tr("Descender:"), this);
- maxAdvanceWidthPromptLabel_ = new QLabel(tr("Max Advance Width:"), this);
+ emSizePromptLabel_ = new QLabel(tr("EM Size:"), this);
+ bboxPromptLabel_ = new QLabel(tr("Global BBox:"), this);
+ ascenderPromptLabel_ = new QLabel(tr("Ascender:"), this);
+ descenderPromptLabel_ = new QLabel(tr("Descender:"), this);
+ maxAdvanceWidthPromptLabel_ = new QLabel(tr("Max Advance Width:"), this);
maxAdvanceHeightPromptLabel_ = new QLabel(tr("Max Advance Height:"), this);
- ulPosPromptLabel_ = new QLabel(tr("Underline Position:"), this);
- ulThicknessPromptLabel_ = new QLabel(tr("Underline Thickness:"), this);
-
- emSizeLabel_ = new QLabel(this);
- bboxLabel_ = new QLabel(this);
- ascenderLabel_ = new QLabel(this);
- descenderLabel_ = new QLabel(this);
- maxAdvanceWidthLabel_ = new QLabel(this);
+ ulPosPromptLabel_ = new QLabel(tr("Underline Position:"), this);
+ ulThicknessPromptLabel_ = new QLabel(tr("Underline Thickness:"), this);
+
+ emSizeLabel_ = new QLabel(this);
+ bboxLabel_ = new QLabel(this);
+ ascenderLabel_ = new QLabel(this);
+ descenderLabel_ = new QLabel(this);
+ maxAdvanceWidthLabel_ = new QLabel(this);
maxAdvanceHeightLabel_ = new QLabel(this);
- ulPosLabel_ = new QLabel(this);
- ulThicknessLabel_ = new QLabel(this);
-
- setLabelSelectable( emSizeLabel_);
- setLabelSelectable( bboxLabel_);
- setLabelSelectable( ascenderLabel_);
- setLabelSelectable( descenderLabel_);
- setLabelSelectable( maxAdvanceWidthLabel_);
+ ulPosLabel_ = new QLabel(this);
+ ulThicknessLabel_ = new QLabel(this);
+
+ setLabelSelectable(emSizeLabel_);
+ setLabelSelectable(bboxLabel_);
+ setLabelSelectable(ascenderLabel_);
+ setLabelSelectable(descenderLabel_);
+ setLabelSelectable(maxAdvanceWidthLabel_);
setLabelSelectable(maxAdvanceHeightLabel_);
- setLabelSelectable( ulPosLabel_);
- setLabelSelectable( ulThicknessLabel_);
-
- scalableOnlyLabels_.push_back( emSizePromptLabel_);
- scalableOnlyLabels_.push_back( bboxPromptLabel_);
- scalableOnlyLabels_.push_back( ascenderPromptLabel_);
- scalableOnlyLabels_.push_back( descenderPromptLabel_);
- scalableOnlyLabels_.push_back( maxAdvanceWidthPromptLabel_);
+ setLabelSelectable(ulPosLabel_);
+ setLabelSelectable(ulThicknessLabel_);
+
+ scalableOnlyLabels_.push_back(emSizePromptLabel_);
+ scalableOnlyLabels_.push_back(bboxPromptLabel_);
+ scalableOnlyLabels_.push_back(ascenderPromptLabel_);
+ scalableOnlyLabels_.push_back(descenderPromptLabel_);
+ scalableOnlyLabels_.push_back(maxAdvanceWidthPromptLabel_);
scalableOnlyLabels_.push_back(maxAdvanceHeightPromptLabel_);
- scalableOnlyLabels_.push_back( ulPosPromptLabel_);
- scalableOnlyLabels_.push_back( ulThicknessPromptLabel_);
- scalableOnlyLabels_.push_back( emSizeLabel_);
- scalableOnlyLabels_.push_back( bboxLabel_);
- scalableOnlyLabels_.push_back( ascenderLabel_);
- scalableOnlyLabels_.push_back( descenderLabel_);
- scalableOnlyLabels_.push_back( maxAdvanceWidthLabel_);
+ scalableOnlyLabels_.push_back(ulPosPromptLabel_);
+ scalableOnlyLabels_.push_back(ulThicknessPromptLabel_);
+ scalableOnlyLabels_.push_back(emSizeLabel_);
+ scalableOnlyLabels_.push_back(bboxLabel_);
+ scalableOnlyLabels_.push_back(ascenderLabel_);
+ scalableOnlyLabels_.push_back(descenderLabel_);
+ scalableOnlyLabels_.push_back(maxAdvanceWidthLabel_);
scalableOnlyLabels_.push_back(maxAdvanceHeightLabel_);
- scalableOnlyLabels_.push_back( ulPosLabel_);
- scalableOnlyLabels_.push_back( ulThicknessLabel_);
+ scalableOnlyLabels_.push_back(ulPosLabel_);
+ scalableOnlyLabels_.push_back(ulThicknessLabel_);
- basicGroupBox_ = new QGroupBox(tr("Basic"), this);
+ basicGroupBox_ = new QGroupBox(tr("Basic"), this);
typeEntriesGroupBox_ = new QGroupBox(tr("Type Entries"), this);
- charMapGroupBox_ = new QGroupBox(tr("CharMaps"), this);
- fixedSizesGroupBox_ = new QGroupBox(tr("Fixed Sizes"), this);
+ charMapGroupBox_ = new QGroupBox(tr("CharMaps"), this);
+ fixedSizesGroupBox_ = new QGroupBox(tr("Fixed Sizes"), this);
charMapsTable_ = new QTableView(this);
fixedSizesTable_ = new QTableView(this);
@@ -298,7 +300,7 @@ GeneralInfoTab::createLayout()
charMapInfoModel_ = new CharMapInfoModel(this);
charMapsTable_->setModel(charMapInfoModel_);
auto header = charMapsTable_->verticalHeader();
- // This will force the minimal size to be used
+ // This forces the minimum size to be used.
header->setDefaultSectionSize(0);
header->setSectionResizeMode(QHeaderView::Fixed);
@@ -312,53 +314,54 @@ GeneralInfoTab::createLayout()
leftScrollArea_ = new UnboundScrollArea(this);
leftScrollArea_->setWidgetResizable(true);
leftScrollArea_->setWidget(leftWidget_);
- leftScrollArea_->setStyleSheet("QScrollArea
{background-color:transparent;}");
+ leftScrollArea_->setStyleSheet(
+ "QScrollArea {background-color:transparent;}");
leftWidget_->setStyleSheet("background-color:transparent;");
- basicLayout_ = new QGridLayout;
+ basicLayout_ = new QGridLayout;
typeEntriesLayout_ = new QGridLayout;
- charMapLayout_ = new QHBoxLayout;
- fixedSizesLayout_ = new QHBoxLayout;
+ charMapLayout_ = new QHBoxLayout;
+ fixedSizesLayout_ = new QHBoxLayout;
#define BasicRow(w) GL2CRow(basicLayout_, w)
#define FTERow(w) GL2CRow(typeEntriesLayout_, w)
- BasicRow( numFaces);
- BasicRow( family);
- BasicRow( style);
- BasicRow( postscript);
- BasicRow( created);
- BasicRow( modified);
- BasicRow( revision);
- BasicRow( copyright);
- BasicRow( trademark);
+ BasicRow(numFaces);
+ BasicRow(family);
+ BasicRow(style);
+ BasicRow(postscript);
+ BasicRow(created);
+ BasicRow(modified);
+ BasicRow(revision);
+ BasicRow(copyright);
+ BasicRow(trademark);
BasicRow(manufacturer);
- FTERow( driverName);
- FTERow( sfnt);
- FTERow( fontType);
- FTERow( direction);
- FTERow( fixedWidth);
- FTERow( glyphNames);
- FTERow( emSize);
- FTERow( bbox);
- FTERow( ascender);
- FTERow( descender);
- FTERow( maxAdvanceWidth);
+ FTERow(driverName);
+ FTERow(sfnt);
+ FTERow(fontType);
+ FTERow(direction);
+ FTERow(fixedWidth);
+ FTERow(glyphNames);
+ FTERow(emSize);
+ FTERow(bbox);
+ FTERow(ascender);
+ FTERow(descender);
+ FTERow(maxAdvanceWidth);
FTERow(maxAdvanceHeight);
- FTERow( ulPos);
- FTERow( ulThickness);
+ FTERow(ulPos);
+ FTERow(ulThickness);
- basicLayout_->setColumnStretch(1, 1);
+ basicLayout_->setColumnStretch(1, 1);
typeEntriesLayout_->setColumnStretch(1, 1);
charMapLayout_->addWidget(charMapsTable_);
fixedSizesLayout_->addWidget(fixedSizesTable_);
- basicGroupBox_ ->setLayout(basicLayout_ );
+ basicGroupBox_ ->setLayout(basicLayout_);
typeEntriesGroupBox_ ->setLayout(typeEntriesLayout_);
- charMapGroupBox_ ->setLayout(charMapLayout_ );
- fixedSizesGroupBox_ ->setLayout(fixedSizesLayout_ );
+ charMapGroupBox_ ->setLayout(charMapLayout_);
+ fixedSizesGroupBox_ ->setLayout(fixedSizesLayout_);
leftLayout_ = new QVBoxLayout;
rightLayout_ = new QVBoxLayout;
@@ -366,8 +369,8 @@ GeneralInfoTab::createLayout()
leftLayout_->addWidget(basicGroupBox_);
leftLayout_->addWidget(typeEntriesGroupBox_);
- leftLayout_->addSpacerItem(new QSpacerItem(0, 0,
- QSizePolicy::Preferred,
+ leftLayout_->addSpacerItem(new QSpacerItem(0, 0,
+ QSizePolicy::Preferred,
QSizePolicy::Expanding));
leftWidget_->setLayout(leftLayout_);
@@ -424,7 +427,8 @@ StringViewDialog::createLayout()
SFNTInfoTab::SFNTInfoTab(QWidget* parent,
Engine* engine)
-: QWidget(parent), engine_(engine)
+: QWidget(parent),
+ engine_(engine)
{
createLayout();
createConnections();
@@ -466,7 +470,7 @@ SFNTInfoTab::createLayout()
sfntNamesModel_ = new SFNTNameModel(this);
sfntNamesTable_->setModel(sfntNamesModel_);
auto header = sfntNamesTable_->verticalHeader();
- // This will force the minimal size to be used
+ // This forces the minimum size to be used.
header->setDefaultSectionSize(0);
header->setSectionResizeMode(QHeaderView::Fixed);
sfntNamesTable_->horizontalHeader()->setStretchLastSection(true);
@@ -474,7 +478,7 @@ SFNTInfoTab::createLayout()
sfntTablesModel_ = new SFNTTableInfoModel(this);
sfntTablesTable_->setModel(sfntTablesModel_);
header = sfntTablesTable_->verticalHeader();
- // This will force the minimal size to be used
+ // This forces the minimum size to be used.
header->setDefaultSectionSize(0);
header->setSectionResizeMode(QHeaderView::Fixed);
sfntTablesTable_->horizontalHeader()->setStretchLastSection(true);
@@ -524,7 +528,8 @@ SFNTInfoTab::nameTableDoubleClicked(QModelIndex const&
index)
PostScriptInfoTab::PostScriptInfoTab(QWidget* parent,
Engine* engine)
-: QWidget(parent), engine_(engine)
+: QWidget(parent),
+ engine_(engine)
{
std::memset(&oldFontPrivate_, 0, sizeof(PS_PrivateRec));
createLayout();
@@ -532,7 +537,8 @@ PostScriptInfoTab::PostScriptInfoTab(QWidget* parent,
template<class T>
-QString genArrayString(T* arr, size_t size)
+QString genArrayString(T* arr,
+ size_t size)
{
// TODO: optimize
QString result = "[";
@@ -563,31 +569,31 @@ PostScriptInfoTab::reloadFont()
infoGroupBox_->setEnabled(hasInfo);
if (hasInfo)
{
- versionLabel_->setText(QString::fromUtf8(fontInfo.version));
- noticeLabel_->setText(QString::fromUtf8(fontInfo.notice));
- fullNameLabel_->setText(QString::fromUtf8(fontInfo.full_name));
- familyNameLabel_->setText(QString::fromUtf8(fontInfo.family_name));
- weightLabel_->setText(QString::fromUtf8(fontInfo.weight));
+ versionLabel_->setText(QString::fromUtf8(fontInfo.version));
+ noticeLabel_->setText(QString::fromUtf8(fontInfo.notice));
+ fullNameLabel_->setText(QString::fromUtf8(fontInfo.full_name));
+ familyNameLabel_->setText(QString::fromUtf8(fontInfo.family_name));
+ weightLabel_->setText(QString::fromUtf8(fontInfo.weight));
italicAngleLabel_->setText(QString::number(fontInfo.italic_angle));
- fixedPitchLabel_->setText(fontInfo.is_fixed_pitch ? "yes" : "no");
- ulPosLabel_->setText(QString::number(fontInfo.underline_position));
+ fixedPitchLabel_->setText(fontInfo.is_fixed_pitch ? "yes" : "no");
+ ulPosLabel_->setText(QString::number(fontInfo.underline_position));
ulThicknessLabel_->setText(QString::number(fontInfo.underline_thickness));
}
else
{
- versionLabel_->clear();
- noticeLabel_->clear();
- fullNameLabel_->clear();
- familyNameLabel_->clear();
- weightLabel_->clear();
+ versionLabel_->clear();
+ noticeLabel_->clear();
+ fullNameLabel_->clear();
+ familyNameLabel_->clear();
+ weightLabel_->clear();
italicAngleLabel_->clear();
- fixedPitchLabel_->clear();
- ulPosLabel_->clear();
+ fixedPitchLabel_->clear();
+ ulPosLabel_->clear();
ulThicknessLabel_->clear();
}
PS_PrivateRec fontPrivate;
- // Don't do zero-initialization since we need to zero out paddings
+ // Don't do zero-initialization since we need to zero out paddings.
std::memset(&fontPrivate, 0, sizeof(PS_PrivateRec));
hasInfo = engine_->currentFontPSPrivateInfo(fontPrivate);
privateGroupBox_->setEnabled(hasInfo);
@@ -596,35 +602,42 @@ PostScriptInfoTab::reloadFont()
if (std::memcmp(&fontPrivate, &oldFontPrivate_, sizeof(PS_PrivateRec)))
{
std::memcpy(&oldFontPrivate_, &fontPrivate, sizeof(PS_PrivateRec));
-
+
uniqueIDLabel_->setText(QString::number(fontPrivate.unique_id));
blueShiftLabel_->setText(QString::number(fontPrivate.blue_shift));
blueFuzzLabel_->setText(QString::number(fontPrivate.blue_fuzz));
forceBoldLabel_->setText(fontPrivate.force_bold ? "true" : "false");
-
languageGroupLabel_->setText(QString::number(fontPrivate.language_group));
+ languageGroupLabel_->setText(
+ QString::number(fontPrivate.language_group));
passwordLabel_->setText(QString::number(fontPrivate.password));
lenIVLabel_->setText(QString::number(fontPrivate.lenIV));
- roundStemUpLabel_->setText(fontPrivate.round_stem_up ? "true" : "false");
+ roundStemUpLabel_->setText(fontPrivate.round_stem_up ? "true"
+ : "false");
familyBluesLabel_->setText(
- genArrayString(fontPrivate.family_blues,
fontPrivate.num_family_blues));
+ genArrayString(fontPrivate.family_blues,
+ fontPrivate.num_family_blues));
blueValuesLabel_->setText(
- genArrayString(fontPrivate.blue_values, fontPrivate.num_blue_values));
+ genArrayString(fontPrivate.blue_values,
+ fontPrivate.num_blue_values));
otherBluesLabel_->setText(
- genArrayString(fontPrivate.other_blues, fontPrivate.num_other_blues));
+ genArrayString(fontPrivate.other_blues,
+ fontPrivate.num_other_blues));
familyOtherBluesLabel_->setText(
genArrayString(fontPrivate.family_other_blues,
- fontPrivate.num_family_other_blues));
+ fontPrivate.num_family_other_blues));
stdWidthsLabel_->setText(
genArrayString(fontPrivate.standard_width,
arraySize(fontPrivate.standard_width)));
stdHeightsLabel_->setText(
- genArrayString(fontPrivate.standard_height,
+ genArrayString(fontPrivate.standard_height,
arraySize(fontPrivate.standard_height)));
snapWidthsLabel_->setText(
- genArrayString(fontPrivate.snap_widths, fontPrivate.num_snap_widths));
+ genArrayString(fontPrivate.snap_widths,
+ fontPrivate.num_snap_widths));
snapHeightsLabel_->setText(
- genArrayString(fontPrivate.snap_heights,
fontPrivate.num_snap_heights));
+ genArrayString(fontPrivate.snap_heights,
+ fontPrivate.num_snap_heights));
minFeatureLabel_->setText(
genArrayString(fontPrivate.min_feature,
arraySize(fontPrivate.min_feature)));
@@ -638,25 +651,26 @@ PostScriptInfoTab::reloadFont()
else
{
std::memset(&oldFontPrivate_, 0, sizeof(PS_PrivateRec));
- uniqueIDLabel_->clear();
- blueValuesLabel_->clear();
- otherBluesLabel_->clear();
- familyBluesLabel_->clear();
+
+ uniqueIDLabel_->clear();
+ blueValuesLabel_->clear();
+ otherBluesLabel_->clear();
+ familyBluesLabel_->clear();
familyOtherBluesLabel_->clear();
- blueScaleLabel_->clear();
- blueShiftLabel_->clear();
- blueFuzzLabel_->clear();
- stdWidthsLabel_->clear();
- stdHeightsLabel_->clear();
- snapWidthsLabel_->clear();
- snapHeightsLabel_->clear();
- forceBoldLabel_->clear();
- languageGroupLabel_->clear();
- passwordLabel_->clear();
- lenIVLabel_->clear();
- minFeatureLabel_->clear();
- roundStemUpLabel_->clear();
- expansionFactorLabel_->clear();
+ blueScaleLabel_->clear();
+ blueShiftLabel_->clear();
+ blueFuzzLabel_->clear();
+ stdWidthsLabel_->clear();
+ stdHeightsLabel_->clear();
+ snapWidthsLabel_->clear();
+ snapHeightsLabel_->clear();
+ forceBoldLabel_->clear();
+ languageGroupLabel_->clear();
+ passwordLabel_->clear();
+ lenIVLabel_->clear();
+ minFeatureLabel_->clear();
+ roundStemUpLabel_->clear();
+ expansionFactorLabel_->clear();
}
}
@@ -664,95 +678,95 @@ PostScriptInfoTab::reloadFont()
void
PostScriptInfoTab::createLayout()
{
- versionPromptLabel_ = new QLabel(tr("/version:"), this);
- noticePromptLabel_ = new QLabel(tr("/Notice:"), this);
- fullNamePromptLabel_ = new QLabel(tr("/FullName:"), this);
- familyNamePromptLabel_ = new QLabel(tr("/FamilyName:"), this);
- weightPromptLabel_ = new QLabel(tr("/Weight:"), this);
- italicAnglePromptLabel_ = new QLabel(tr("/ItaticAngle:"), this);
- fixedPitchPromptLabel_ = new QLabel(tr("/isFixedPitch:"), this);
- ulPosPromptLabel_ = new QLabel(tr("/UnderlinePosition:"), this);
- ulThicknessPromptLabel_ = new QLabel(tr("/UnderlineThickness:"), this);
-
- versionLabel_ = new QLabel(this);
- noticeLabel_ = new QLabel(this);
- fullNameLabel_ = new QLabel(this);
- familyNameLabel_ = new QLabel(this);
- weightLabel_ = new QLabel(this);
+ versionPromptLabel_ = new QLabel(tr("/version:"), this);
+ noticePromptLabel_ = new QLabel(tr("/Notice:"), this);
+ fullNamePromptLabel_ = new QLabel(tr("/FullName:"), this);
+ familyNamePromptLabel_ = new QLabel(tr("/FamilyName:"), this);
+ weightPromptLabel_ = new QLabel(tr("/Weight:"), this);
+ italicAnglePromptLabel_ = new QLabel(tr("/ItaticAngle:"), this);
+ fixedPitchPromptLabel_ = new QLabel(tr("/isFixedPitch:"), this);
+ ulPosPromptLabel_ = new QLabel(tr("/UnderlinePosition:"), this);
+ ulThicknessPromptLabel_ = new QLabel(tr("/UnderlineThickness:"), this);
+
+ versionLabel_ = new QLabel(this);
+ noticeLabel_ = new QLabel(this);
+ fullNameLabel_ = new QLabel(this);
+ familyNameLabel_ = new QLabel(this);
+ weightLabel_ = new QLabel(this);
italicAngleLabel_ = new QLabel(this);
- fixedPitchLabel_ = new QLabel(this);
- ulPosLabel_ = new QLabel(this);
+ fixedPitchLabel_ = new QLabel(this);
+ ulPosLabel_ = new QLabel(this);
ulThicknessLabel_ = new QLabel(this);
- setLabelSelectable( versionLabel_);
- setLabelSelectable( noticeLabel_);
- setLabelSelectable( fullNameLabel_);
- setLabelSelectable( familyNameLabel_);
- setLabelSelectable( weightLabel_);
+ setLabelSelectable(versionLabel_);
+ setLabelSelectable(noticeLabel_);
+ setLabelSelectable(fullNameLabel_);
+ setLabelSelectable(familyNameLabel_);
+ setLabelSelectable(weightLabel_);
setLabelSelectable(italicAngleLabel_);
- setLabelSelectable( fixedPitchLabel_);
- setLabelSelectable( ulPosLabel_);
+ setLabelSelectable(fixedPitchLabel_);
+ setLabelSelectable(ulPosLabel_);
setLabelSelectable(ulThicknessLabel_);
- uniqueIDPromptLabel_ = new QLabel(tr("/UniqueID:"), this);
- blueValuesPromptLabel_ = new QLabel(tr("/BlueValues:"), this);
- otherBluesPromptLabel_ = new QLabel(tr("/OtherBlues:"), this);
- familyBluesPromptLabel_ = new QLabel(tr("/FamilyBlues:"), this);
- familyOtherBluesPromptLabel_ = new QLabel(tr("/FamilyOtherBlues:"), this);
- blueScalePromptLabel_ = new QLabel(tr("/BlueScale:"), this);
- blueShiftPromptLabel_ = new QLabel(tr("/BlueShift:"), this);
- blueFuzzPromptLabel_ = new QLabel(tr("/BlueFuzz:"), this);
- stdWidthsPromptLabel_ = new QLabel(tr("/StdHW:"), this);
- stdHeightsPromptLabel_ = new QLabel(tr("/StdVW:"), this);
- snapWidthsPromptLabel_ = new QLabel(tr("/StemSnapH:"), this);
- snapHeightsPromptLabel_ = new QLabel(tr("/StemSnapV:"), this);
- forceBoldPromptLabel_ = new QLabel(tr("/ForceBold:"), this);
- languageGroupPromptLabel_ = new QLabel(tr("/LanguageGroup:"), this);
- passwordPromptLabel_ = new QLabel(tr("/password:"), this);
- lenIVPromptLabel_ = new QLabel(tr("/lenIV:"), this);
- minFeaturePromptLabel_ = new QLabel(tr("/MinFeature:"), this);
- roundStemUpPromptLabel_ = new QLabel(tr("/RndStemUp:"), this);
- expansionFactorPromptLabel_ = new QLabel(tr("/ExpansionFactor:"), this);
-
- uniqueIDLabel_ = new QLabel(this);
- blueValuesLabel_ = new QLabel(this);
- otherBluesLabel_ = new QLabel(this);
- familyBluesLabel_ = new QLabel(this);
+ uniqueIDPromptLabel_ = new QLabel(tr("/UniqueID:"), this);
+ blueValuesPromptLabel_ = new QLabel(tr("/BlueValues:"), this);
+ otherBluesPromptLabel_ = new QLabel(tr("/OtherBlues:"), this);
+ familyBluesPromptLabel_ = new QLabel(tr("/FamilyBlues:"), this);
+ familyOtherBluesPromptLabel_ = new QLabel(tr("/FamilyOtherBlues:"), this);
+ blueScalePromptLabel_ = new QLabel(tr("/BlueScale:"), this);
+ blueShiftPromptLabel_ = new QLabel(tr("/BlueShift:"), this);
+ blueFuzzPromptLabel_ = new QLabel(tr("/BlueFuzz:"), this);
+ stdWidthsPromptLabel_ = new QLabel(tr("/StdHW:"), this);
+ stdHeightsPromptLabel_ = new QLabel(tr("/StdVW:"), this);
+ snapWidthsPromptLabel_ = new QLabel(tr("/StemSnapH:"), this);
+ snapHeightsPromptLabel_ = new QLabel(tr("/StemSnapV:"), this);
+ forceBoldPromptLabel_ = new QLabel(tr("/ForceBold:"), this);
+ languageGroupPromptLabel_ = new QLabel(tr("/LanguageGroup:"), this);
+ passwordPromptLabel_ = new QLabel(tr("/password:"), this);
+ lenIVPromptLabel_ = new QLabel(tr("/lenIV:"), this);
+ minFeaturePromptLabel_ = new QLabel(tr("/MinFeature:"), this);
+ roundStemUpPromptLabel_ = new QLabel(tr("/RndStemUp:"), this);
+ expansionFactorPromptLabel_ = new QLabel(tr("/ExpansionFactor:"), this);
+
+ uniqueIDLabel_ = new QLabel(this);
+ blueValuesLabel_ = new QLabel(this);
+ otherBluesLabel_ = new QLabel(this);
+ familyBluesLabel_ = new QLabel(this);
familyOtherBluesLabel_ = new QLabel(this);
- blueScaleLabel_ = new QLabel(this);
- blueShiftLabel_ = new QLabel(this);
- blueFuzzLabel_ = new QLabel(this);
- stdWidthsLabel_ = new QLabel(this);
- stdHeightsLabel_ = new QLabel(this);
- snapWidthsLabel_ = new QLabel(this);
- snapHeightsLabel_ = new QLabel(this);
- forceBoldLabel_ = new QLabel(this);
- languageGroupLabel_ = new QLabel(this);
- passwordLabel_ = new QLabel(this);
- lenIVLabel_ = new QLabel(this);
- minFeatureLabel_ = new QLabel(this);
- roundStemUpLabel_ = new QLabel(this);
- expansionFactorLabel_ = new QLabel(this);
-
- setLabelSelectable( uniqueIDLabel_);
- setLabelSelectable( blueValuesLabel_);
- setLabelSelectable( otherBluesLabel_);
- setLabelSelectable( familyBluesLabel_);
+ blueScaleLabel_ = new QLabel(this);
+ blueShiftLabel_ = new QLabel(this);
+ blueFuzzLabel_ = new QLabel(this);
+ stdWidthsLabel_ = new QLabel(this);
+ stdHeightsLabel_ = new QLabel(this);
+ snapWidthsLabel_ = new QLabel(this);
+ snapHeightsLabel_ = new QLabel(this);
+ forceBoldLabel_ = new QLabel(this);
+ languageGroupLabel_ = new QLabel(this);
+ passwordLabel_ = new QLabel(this);
+ lenIVLabel_ = new QLabel(this);
+ minFeatureLabel_ = new QLabel(this);
+ roundStemUpLabel_ = new QLabel(this);
+ expansionFactorLabel_ = new QLabel(this);
+
+ setLabelSelectable(uniqueIDLabel_);
+ setLabelSelectable(blueValuesLabel_);
+ setLabelSelectable(otherBluesLabel_);
+ setLabelSelectable(familyBluesLabel_);
setLabelSelectable(familyOtherBluesLabel_);
- setLabelSelectable( blueScaleLabel_);
- setLabelSelectable( blueShiftLabel_);
- setLabelSelectable( blueFuzzLabel_);
- setLabelSelectable( stdWidthsLabel_);
- setLabelSelectable( stdHeightsLabel_);
- setLabelSelectable( snapWidthsLabel_);
- setLabelSelectable( snapHeightsLabel_);
- setLabelSelectable( forceBoldLabel_);
- setLabelSelectable( languageGroupLabel_);
- setLabelSelectable( passwordLabel_);
- setLabelSelectable( lenIVLabel_);
- setLabelSelectable( minFeatureLabel_);
- setLabelSelectable( roundStemUpLabel_);
- setLabelSelectable( expansionFactorLabel_);
+ setLabelSelectable(blueScaleLabel_);
+ setLabelSelectable(blueShiftLabel_);
+ setLabelSelectable(blueFuzzLabel_);
+ setLabelSelectable(stdWidthsLabel_);
+ setLabelSelectable(stdHeightsLabel_);
+ setLabelSelectable(snapWidthsLabel_);
+ setLabelSelectable(snapHeightsLabel_);
+ setLabelSelectable(forceBoldLabel_);
+ setLabelSelectable(languageGroupLabel_);
+ setLabelSelectable(passwordLabel_);
+ setLabelSelectable(lenIVLabel_);
+ setLabelSelectable(minFeatureLabel_);
+ setLabelSelectable(roundStemUpLabel_);
+ setLabelSelectable(expansionFactorLabel_);
noticeLabel_->setWordWrap(true);
familyBluesLabel_->setWordWrap(true);
@@ -765,8 +779,10 @@ PostScriptInfoTab::createLayout()
snapHeightsLabel_->setWordWrap(true);
minFeatureLabel_->setWordWrap(true);
- infoGroupBox_ = new QGroupBox(tr("PostScript /FontInfo dictionary"), this);
- privateGroupBox_ = new QGroupBox(tr("PostScript /Private dictionary"), this);
+ infoGroupBox_ = new QGroupBox(tr("PostScript /FontInfo dictionary"),
+ this);
+ privateGroupBox_ = new QGroupBox(tr("PostScript /Private dictionary"),
+ this);
infoWidget_ = new QWidget(this);
privateWidget_ = new QWidget(this);
@@ -774,14 +790,16 @@ PostScriptInfoTab::createLayout()
infoScrollArea_ = new UnboundScrollArea(this);
infoScrollArea_->setWidget(infoWidget_);
infoScrollArea_->setWidgetResizable(true);
- infoScrollArea_->setStyleSheet("QScrollArea
{background-color:transparent;}");
+ infoScrollArea_->setStyleSheet(
+ "QScrollArea {background-color:transparent;}");
infoWidget_->setStyleSheet("background-color:transparent;");
infoWidget_->setContentsMargins(0, 0, 0, 0);
privateScrollArea_ = new UnboundScrollArea(this);
privateScrollArea_->setWidget(privateWidget_);
privateScrollArea_->setWidgetResizable(true);
- privateScrollArea_->setStyleSheet("QScrollArea
{background-color:transparent;}");
+ privateScrollArea_->setStyleSheet(
+ "QScrollArea {background-color:transparent;}");
privateWidget_->setStyleSheet("background-color:transparent;");
privateWidget_->setContentsMargins(0, 0, 0, 0);
@@ -793,52 +811,54 @@ PostScriptInfoTab::createLayout()
#define PSI2Row(w) GL2CRow(infoLayout_, w)
#define PSP2Row(w) GL2CRow(privateLayout_, w)
- PSI2Row( version);
- PSI2Row( notice);
- PSI2Row( fullName);
- PSI2Row( familyName);
- PSI2Row( weight);
+ PSI2Row(version);
+ PSI2Row(notice);
+ PSI2Row(fullName);
+ PSI2Row(familyName);
+ PSI2Row(weight);
PSI2Row(italicAngle);
- PSI2Row( fixedPitch);
- PSI2Row( ulPos);
+ PSI2Row(fixedPitch);
+ PSI2Row(ulPos);
PSI2Row(ulThickness);
- PSP2Row( uniqueID);
- PSP2Row( blueValues);
- PSP2Row( otherBlues);
- PSP2Row( familyBlues);
+ PSP2Row(uniqueID);
+ PSP2Row(blueValues);
+ PSP2Row(otherBlues);
+ PSP2Row(familyBlues);
PSP2Row(familyOtherBlues);
- PSP2Row( blueScale);
- PSP2Row( blueShift);
- PSP2Row( blueFuzz);
- PSP2Row( stdWidths);
- PSP2Row( stdHeights);
- PSP2Row( snapWidths);
- PSP2Row( snapHeights);
- PSP2Row( forceBold);
- PSP2Row( languageGroup);
- PSP2Row( password);
- PSP2Row( lenIV);
- PSP2Row( minFeature);
- PSP2Row( roundStemUp);
- PSP2Row( expansionFactor);
-
- infoLayout_->addItem(new QSpacerItem(0, 0,
- QSizePolicy::Preferred,
+ PSP2Row(blueScale);
+ PSP2Row(blueShift);
+ PSP2Row(blueFuzz);
+ PSP2Row(stdWidths);
+ PSP2Row(stdHeights);
+ PSP2Row(snapWidths);
+ PSP2Row(snapHeights);
+ PSP2Row(forceBold);
+ PSP2Row(languageGroup);
+ PSP2Row(password);
+ PSP2Row(lenIV);
+ PSP2Row(minFeature);
+ PSP2Row(roundStemUp);
+ PSP2Row(expansionFactor);
+
+ infoLayout_->addItem(new QSpacerItem(0, 0,
+ QSizePolicy::Preferred,
QSizePolicy::Expanding),
infoLayout_->rowCount(), 0, 1, 2);
- privateLayout_->addItem(new QSpacerItem(0, 0,
- QSizePolicy::Preferred,
+ privateLayout_->addItem(new QSpacerItem(0, 0,
+ QSizePolicy::Preferred,
QSizePolicy::Expanding),
privateLayout_->rowCount(), 0, 1, 2);
- infoLayout_->setColumnStretch(1, 1);
+ infoLayout_->setColumnStretch(1, 1);
privateLayout_->setColumnStretch(1, 1);
infoWidget_->setLayout(infoLayout_);
privateWidget_->setLayout(privateLayout_);
- infoGroupBox_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);
- privateGroupBox_->setSizePolicy(QSizePolicy::Ignored,
QSizePolicy::Expanding);
+ infoGroupBox_->setSizePolicy(QSizePolicy::Ignored,
+ QSizePolicy::Expanding);
+ privateGroupBox_->setSizePolicy(QSizePolicy::Ignored,
+ QSizePolicy::Expanding);
infoGroupBoxLayout_->addWidget(infoScrollArea_);
privateGroupBoxLayout_->addWidget(privateScrollArea_);
@@ -854,7 +874,8 @@ PostScriptInfoTab::createLayout()
MMGXInfoTab::MMGXInfoTab(QWidget* parent,
Engine* engine)
-: QWidget(parent), engine_(engine)
+: QWidget(parent),
+ engine_(engine)
{
createLayout();
}
@@ -867,7 +888,7 @@ MMGXInfoTab::reloadFont()
axesGroupBox_->setEnabled(state != MMGXState::NoMMGX);
switch (state)
{
- case MMGXState::NoMMGX:
+ case MMGXState::NoMMGX:
mmgxTypeLabel_->setText("No MM/GX");
break;
case MMGXState::MM:
@@ -903,7 +924,7 @@ MMGXInfoTab::createLayout()
axesModel_ = new MMGXAxisInfoModel(this);
axesTable_->setModel(axesModel_);
auto header = axesTable_->verticalHeader();
- // This will force the minimal size to be used
+ // This forces the minimum size to be used.
header->setDefaultSectionSize(0);
header->setSectionResizeMode(QHeaderView::Fixed);
axesTable_->horizontalHeader()->setStretchLastSection(true);
@@ -919,8 +940,8 @@ MMGXInfoTab::createLayout()
#define MMGXI2Row(w) GL2CRow(infoLayout_, w)
auto r = MMGXI2Row(mmgxType);
- infoLayout_->addItem(new QSpacerItem(0, 0,
- QSizePolicy::Expanding,
+ infoLayout_->addItem(new QSpacerItem(0, 0,
+ QSizePolicy::Expanding,
QSizePolicy::Preferred),
r, 2);
@@ -934,7 +955,8 @@ MMGXInfoTab::createLayout()
CompositeGlyphsTab::CompositeGlyphsTab(QWidget* parent,
Engine* engine)
-: QWidget(parent), engine_(engine)
+: QWidget(parent),
+ engine_(engine)
{
createLayout();
createConnections();
@@ -994,7 +1016,7 @@ CompositeGlyphsTab::createConnections()
void
CompositeGlyphsTab::forceReloadFont()
{
- engine_->loadDefaults(); // this would reload the font
+ engine_->loadDefaults(); // This reloads the font.
auto face = engine_->currentFallbackFtFace();
std::vector<CompositeGlyphInfo> list;
@@ -1009,7 +1031,7 @@ CompositeGlyphsTab::forceReloadFont()
if (!face || !FT_IS_SFNT(face))
{
compositeGlyphCountPromptLabel_->setVisible(false);
- compositeGlyphCountLabel_->setText(tr("Not a SFNT font."));
+ compositeGlyphCountLabel_->setText(tr("Not an SFNT font."));
}
else if (compositeModel_->storage().empty())
{
diff --git a/src/ftinspect/panels/info.hpp b/src/ftinspect/panels/info.hpp
index 6890d23..e287113 100644
--- a/src/ftinspect/panels/info.hpp
+++ b/src/ftinspect/panels/info.hpp
@@ -10,17 +10,18 @@
#include "../widgets/customwidgets.hpp"
#include <vector>
-#include <QWidget>
-#include <QTabWidget>
+
#include <QBoxLayout>
-#include <QTextEdit>
#include <QDialog>
#include <QGridLayout>
-#include <QVector>
-#include <QLabel>
#include <QGroupBox>
+#include <QLabel>
#include <QTableView>
+#include <QTabWidget>
+#include <QTextEdit>
#include <QTreeView>
+#include <QVector>
+#include <QWidget>
class Engine;
class GeneralInfoTab;
@@ -30,11 +31,14 @@ class MMGXInfoTab;
class CompositeGlyphsTab;
class InfoTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- InfoTab(QWidget* parent, Engine* engine);
+ InfoTab(QWidget* parent,
+ Engine* engine);
~InfoTab() override = default;
void repaintGlyph() override {}
@@ -47,10 +51,10 @@ private:
Engine* engine_;
QVector<AbstractTab*> tabs_;
- GeneralInfoTab* generalTab_;
- SFNTInfoTab* sfntTab_;
- PostScriptInfoTab* postScriptTab_;
- MMGXInfoTab* mmgxTab_;
+ GeneralInfoTab* generalTab_;
+ SFNTInfoTab* sfntTab_;
+ PostScriptInfoTab* postScriptTab_;
+ MMGXInfoTab* mmgxTab_;
CompositeGlyphsTab* compositeGlyphsTab_;
QTabWidget* tab_;
@@ -67,11 +71,14 @@ private:
class GeneralInfoTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- GeneralInfoTab(QWidget* parent, Engine* engine);
+ GeneralInfoTab(QWidget* parent,
+ Engine* engine);
~GeneralInfoTab() override = default;
void repaintGlyph() override {}
@@ -80,39 +87,39 @@ public:
private:
Engine* engine_;
- LabelPair( numFaces)
- LabelPair( family)
- LabelPair( style)
- LabelPair( postscript)
- LabelPair( created)
- LabelPair( modified)
- LabelPair( revision)
- LabelPair( copyright)
- LabelPair( trademark)
+ LabelPair(numFaces)
+ LabelPair(family)
+ LabelPair(style)
+ LabelPair(postscript)
+ LabelPair(created)
+ LabelPair(modified)
+ LabelPair(revision)
+ LabelPair(copyright)
+ LabelPair(trademark)
LabelPair(manufacturer)
LabelPair(driverName)
- LabelPair( sfnt)
- LabelPair( fontType)
- LabelPair( direction)
+ LabelPair(sfnt)
+ LabelPair(fontType)
+ LabelPair(direction)
LabelPair(fixedWidth)
LabelPair(glyphNames)
- LabelPair( emSize)
- LabelPair( bbox)
- LabelPair( ascender)
- LabelPair( descender)
- LabelPair( maxAdvanceWidth)
+ LabelPair(emSize)
+ LabelPair(bbox)
+ LabelPair(ascender)
+ LabelPair(descender)
+ LabelPair(maxAdvanceWidth)
LabelPair(maxAdvanceHeight)
- LabelPair( ulPos)
- LabelPair( ulThickness)
+ LabelPair(ulPos)
+ LabelPair(ulThickness)
- QGroupBox* basicGroupBox_;
+ QGroupBox* basicGroupBox_;
QGroupBox* typeEntriesGroupBox_;
- QGroupBox* charMapGroupBox_;
- QGroupBox* fixedSizesGroupBox_;
+ QGroupBox* charMapGroupBox_;
+ QGroupBox* fixedSizesGroupBox_;
- QTableView* charMapsTable_;
+ QTableView* charMapsTable_;
QTableView* fixedSizesTable_;
FixedSizeInfoModel* fixedSizeInfoModel_;
@@ -142,11 +149,13 @@ class StringViewDialog
: public QDialog
{
Q_OBJECT
+
public:
StringViewDialog(QWidget* parent);
~StringViewDialog() override = default;
- void updateString(QByteArray const& rawArray, QString const& str);
+ void updateString(QByteArray const& rawArray,
+ QString const& str);
private:
QLabel* textLabel_;
@@ -162,11 +171,14 @@ private:
class SFNTInfoTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- SFNTInfoTab(QWidget* parent, Engine* engine);
+ SFNTInfoTab(QWidget* parent,
+ Engine* engine);
~SFNTInfoTab() override = default;
void repaintGlyph() override {}
@@ -198,11 +210,14 @@ private:
class PostScriptInfoTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- PostScriptInfoTab(QWidget* parent, Engine* engine);
+ PostScriptInfoTab(QWidget* parent,
+ Engine* engine);
~PostScriptInfoTab() override = default;
void repaintGlyph() override {}
@@ -211,35 +226,35 @@ public:
private:
Engine* engine_;
- LabelPair( version)
- LabelPair( notice)
- LabelPair( fullName)
- LabelPair( familyName)
- LabelPair( weight)
+ LabelPair(version)
+ LabelPair(notice)
+ LabelPair(fullName)
+ LabelPair(familyName)
+ LabelPair(weight)
LabelPair(italicAngle)
- LabelPair( fixedPitch)
- LabelPair( ulPos)
+ LabelPair(fixedPitch)
+ LabelPair(ulPos)
LabelPair(ulThickness)
- LabelPair( uniqueID)
- LabelPair( blueValues)
- LabelPair( otherBlues)
- LabelPair( familyBlues)
+ LabelPair(uniqueID)
+ LabelPair(blueValues)
+ LabelPair(otherBlues)
+ LabelPair(familyBlues)
LabelPair(familyOtherBlues)
- LabelPair( blueScale)
- LabelPair( blueShift)
- LabelPair( blueFuzz)
- LabelPair( stdWidths)
- LabelPair( stdHeights)
- LabelPair( snapWidths)
- LabelPair( snapHeights)
- LabelPair( forceBold)
- LabelPair( languageGroup)
- LabelPair( password)
- LabelPair( lenIV)
- LabelPair( minFeature)
- LabelPair( roundStemUp)
- LabelPair( expansionFactor)
+ LabelPair(blueScale)
+ LabelPair(blueShift)
+ LabelPair(blueFuzz)
+ LabelPair(stdWidths)
+ LabelPair(stdHeights)
+ LabelPair(snapWidths)
+ LabelPair(snapHeights)
+ LabelPair(forceBold)
+ LabelPair(languageGroup)
+ LabelPair(password)
+ LabelPair(lenIV)
+ LabelPair(minFeature)
+ LabelPair(roundStemUp)
+ LabelPair(expansionFactor)
QGroupBox* infoGroupBox_;
QGroupBox* privateGroupBox_;
@@ -263,11 +278,13 @@ private:
class MMGXInfoTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
public:
- MMGXInfoTab(QWidget* parent, Engine* engine);
+ MMGXInfoTab(QWidget* parent,
+ Engine* engine);
~MMGXInfoTab() override = default;
void repaintGlyph() override {}
@@ -292,11 +309,14 @@ private:
class CompositeGlyphsTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- CompositeGlyphsTab(QWidget* parent, Engine* engine);
+ CompositeGlyphsTab(QWidget* parent,
+ Engine* engine);
~CompositeGlyphsTab() override = default;
void repaintGlyph() override {}
diff --git a/src/ftinspect/panels/settingpanel.cpp
b/src/ftinspect/panels/settingpanel.cpp
index 79a5ab8..2e64b3c 100644
--- a/src/ftinspect/panels/settingpanel.cpp
+++ b/src/ftinspect/panels/settingpanel.cpp
@@ -3,14 +3,14 @@
// Copyright (C) 2022 by Charlie Jiang.
#include "settingpanel.hpp"
-
#include "../uihelper.hpp"
#include <QColorDialog>
-// for `FT_DEBUG_AUTOFIT`
+// For `FT_DEBUG_AUTOFIT`.
#include <freetype/config/ftoption.h>
+
SettingPanel::SettingPanel(QWidget* parent,
Engine* engine,
bool comparatorMode)
@@ -96,7 +96,7 @@ SettingPanel::checkHinting()
if (tricky)
autoHintingCheckBox_->setChecked(false);
}
- checkAutoHinting(); // this will emit repaint
+ checkAutoHinting(); // This causes repainting.
}
else
{
@@ -119,7 +119,7 @@ SettingPanel::checkHinting()
|| aaMode == AntiAliasingComboBoxModel::AntiAliasing_Light_SubPixel)
antiAliasingComboBox_->setCurrentIndex(
AntiAliasingComboBoxModel::AntiAliasing_Normal);
-
+
emit repaintNeeded();
}
}
@@ -212,7 +212,7 @@ SettingPanel::checkPalette()
void
SettingPanel::openBackgroundPicker()
{
- auto result = QColorDialog::getColor(backgroundColor_,
+ auto result = QColorDialog::getColor(backgroundColor_,
this,
tr("Background Color"));
if (result.isValid())
@@ -227,7 +227,7 @@ SettingPanel::openBackgroundPicker()
void
SettingPanel::openForegroundPicker()
{
- auto result = QColorDialog::getColor(foregroundColor_,
+ auto result = QColorDialog::getColor(foregroundColor_,
this,
tr("Foreground Color"),
QColorDialog::ShowAlphaChannel);
@@ -244,8 +244,8 @@ void
SettingPanel::updateGamma()
{
gammaValueLabel_->setText(QString::number(gammaSlider_->value() / 10.0,
- 'f',
- 1));
+ 'f',
+ 1));
emit repaintNeeded();
}
@@ -273,7 +273,7 @@ SettingPanel::populatePalettes()
{
auto needToReload = false;
auto& newPalettes = engine_->currentFontPalettes();
- auto newSize = static_cast<int>(newPalettes.size()); // this never exceeds!
+ auto newSize = static_cast<int>(newPalettes.size()); // This never exceeds!
if (newSize != paletteComboBox_->count())
needToReload = true;
else
@@ -291,6 +291,7 @@ SettingPanel::populatePalettes()
break;
}
}
+
if (!needToReload)
return;
@@ -347,7 +348,7 @@ SettingPanel::onFontChanged()
mmgxPanel_->reloadFont();
blockSignals(blockState);
- // Place this after `blockSignals` to let the signals emitted normally
+ // Place this after `blockSignals` to let the signals be emitted normally.
auto bmapOnly = engine_->currentFontBitmapOnly();
embeddedBitmapCheckBox_->setEnabled(
!bmapOnly && engine_->currentFontHasEmbeddedBitmap());
@@ -401,10 +402,10 @@ SettingPanel::applySettings()
void
SettingPanel::applyDelayedSettings()
{
- // This must not be combined into `applySettings`:
- // those engine manipulations will reset the whole cache!!
- // Therefore must only be called when the selection of the combo box actually
- // changes a.k.a. QComboBox::activate.
+ // This must not be combined with `applySettings` since those engine
+ // manipulations reset the whole cache! Therefore, it must only be called
+ // when the selection of the combobox actually changes (a.k.a.
+ // `QComboBox::activate`).
int index = hintingModeComboBox_->currentIndex();
@@ -450,7 +451,7 @@ SettingPanel::createLayout()
blueZoneHintingCheckBox_ = new QCheckBox(tr("Blue-Zone Hinting"), this);
segmentDrawingCheckBox_ = new QCheckBox(tr("Segment Drawing"), this);
}
-
+
embeddedBitmapCheckBox_ = new QCheckBox(tr("Enable Embedded Bitmap"), this);
colorLayerCheckBox_ = new QCheckBox(tr("Enable Color Layer"), this);
@@ -518,36 +519,37 @@ SettingPanel::createLayout()
// Tooltips
hintingCheckBox_->setToolTip(tr("Enable hinting a.k.a. grid-fitting."));
- hintingModeComboBox_->setToolTip(
- tr("Modes not available for current font type will be disabled. No "
- "effect when auto-hinting is enabled"));
+ hintingModeComboBox_->setToolTip(tr(
+ "Modes not available for current font type will be disabled."
+ " No effect when auto-hinting is enabled"));
autoHintingCheckBox_->setToolTip(tr("Enable FreeType Auto-Hinter."));
if (debugMode_)
{
horizontalHintingCheckBox_->setToolTip(tr("(auto-hinter debug option)"));
- verticalHintingCheckBox_ ->setToolTip(tr("(auto-hinter debug option)"));
- blueZoneHintingCheckBox_ ->setToolTip(tr("(auto-hinter debug option)"));
- segmentDrawingCheckBox_ ->setToolTip(tr("(auto-hinter debug option)"));
+ verticalHintingCheckBox_->setToolTip(tr("(auto-hinter debug option)"));
+ blueZoneHintingCheckBox_->setToolTip(tr("(auto-hinter debug option)"));
+ segmentDrawingCheckBox_->setToolTip(tr("(auto-hinter debug option)"));
}
antiAliasingComboBox_->setToolTip(tr("Select anti-aliasing mode."));
- lcdFilterComboBox_->setToolTip(
- tr("Select LCD filter (only valid when LCD AA is enabled)."));
+ lcdFilterComboBox_->setToolTip(tr(
+ "Select LCD filter (only valid when LCD AA is enabled)."));
embeddedBitmapCheckBox_->setToolTip(tr(
- "Enable embedded bitmap strikes (force enabled for bitmap-only fonts)."));
- stemDarkeningCheckBox_->setToolTip(
- tr("Enable stem darkening (only valid for auto-hinter with gamma "
- "correction enabled and with Light AA modes)."));
+ "Enable embedded bitmap strikes (force-enabled for bitmap-only fonts)."));
+ stemDarkeningCheckBox_->setToolTip(tr(
+ "Enable stem darkening (only valid for auto-hinter with gamma"
+ " correction enabled and with Light AA modes)."));
gammaSlider_->setToolTip("Gamma correction value.");
colorLayerCheckBox_->setToolTip(tr("Enable color layer rendering."));
- paletteComboBox_->setToolTip(tr("Select color layer palette (only valid when
"
- "any palette exists in the font)."));
+ paletteComboBox_->setToolTip(tr(
+ "Select color layer palette (only valid when"
+ " any palette exists in the font)."));
if (comparatorMode_)
{
- kerningCheckBox_->setToolTip(
- tr("Enable kerning (GPOS table not supported)."));
- lsbRsbDeltaCheckBox_->setToolTip(
- tr("Enable LSB/RSB delta positioning (only valid when hinting is "
- "enabled)."));
+ kerningCheckBox_->setToolTip(tr(
+ "Enable kerning (GPOS table not supported)."));
+ lsbRsbDeltaCheckBox_->setToolTip(tr(
+ "Enable LSB/RSB delta positioning (only valid when hinting is"
+ " enabled)."));
}
backgroundButton_->setToolTip(tr("Set canvas background color."));
foregroundButton_->setToolTip(tr("Set text color."));
@@ -593,22 +595,22 @@ SettingPanel::createLayoutNormal()
generalTabLayout_ = new QGridLayout;
gridLayout2ColAddWidget(generalTabLayout_, hintingCheckBox_);
- gridLayout2ColAddWidget(generalTabLayout_,
+ gridLayout2ColAddWidget(generalTabLayout_,
hintingModeLabel_, hintingModeComboBox_);
gridLayout2ColAddWidget(generalTabLayout_, autoHintingCheckBox_);
if (debugMode_)
gridLayout2ColAddLayout(generalTabLayout_, debugLayout_);
-
+
gridLayout2ColAddItem(generalTabLayout_,
new QSpacerItem(0, 20, QSizePolicy::Minimum,
QSizePolicy::MinimumExpanding));
- gridLayout2ColAddWidget(generalTabLayout_,
+ gridLayout2ColAddWidget(generalTabLayout_,
antiAliasingLabel_, antiAliasingComboBox_);
- gridLayout2ColAddWidget(generalTabLayout_,
+ gridLayout2ColAddWidget(generalTabLayout_,
lcdFilterLabel_, lcdFilterComboBox_);
-
+
gridLayout2ColAddItem(generalTabLayout_,
new QSpacerItem(0, 20, QSizePolicy::Minimum,
QSizePolicy::MinimumExpanding));
@@ -618,9 +620,9 @@ SettingPanel::createLayoutNormal()
gridLayout2ColAddWidget(generalTabLayout_, stemDarkeningCheckBox_);
gridLayout2ColAddWidget(generalTabLayout_, embeddedBitmapCheckBox_);
gridLayout2ColAddWidget(generalTabLayout_, colorLayerCheckBox_);
- gridLayout2ColAddWidget(generalTabLayout_,
+ gridLayout2ColAddWidget(generalTabLayout_,
paletteLabel_, paletteComboBox_);
-
+
gridLayout2ColAddItem(generalTabLayout_,
new QSpacerItem(0, 20, QSizePolicy::Minimum,
QSizePolicy::MinimumExpanding));
@@ -646,16 +648,16 @@ SettingPanel::createLayoutComparator()
// Hinting & Rendering
gridLayout2ColAddWidget(hintingRenderingTabLayout_, hintingCheckBox_);
- gridLayout2ColAddWidget(hintingRenderingTabLayout_,
+ gridLayout2ColAddWidget(hintingRenderingTabLayout_,
hintingModeLabel_, hintingModeComboBox_);
gridLayout2ColAddWidget(hintingRenderingTabLayout_, autoHintingCheckBox_);
if (debugMode_)
gridLayout2ColAddLayout(hintingRenderingTabLayout_, debugLayout_);
- gridLayout2ColAddWidget(hintingRenderingTabLayout_,
+ gridLayout2ColAddWidget(hintingRenderingTabLayout_,
antiAliasingLabel_, antiAliasingComboBox_);
- gridLayout2ColAddWidget(hintingRenderingTabLayout_,
+ gridLayout2ColAddWidget(hintingRenderingTabLayout_,
lcdFilterLabel_, lcdFilterComboBox_);
gridLayout2ColAddLayout(hintingRenderingTabLayout_, gammaLayout_);
@@ -665,7 +667,7 @@ SettingPanel::createLayoutComparator()
gridLayout2ColAddLayout(generalTabLayout_, colorPickerLayout_);
gridLayout2ColAddWidget(generalTabLayout_, embeddedBitmapCheckBox_);
gridLayout2ColAddWidget(generalTabLayout_, colorLayerCheckBox_);
- gridLayout2ColAddWidget(generalTabLayout_,
+ gridLayout2ColAddWidget(generalTabLayout_,
paletteLabel_, paletteComboBox_);
gridLayout2ColAddWidget(generalTabLayout_, kerningCheckBox_);
@@ -689,23 +691,23 @@ SettingPanel::createLayoutComparator()
void
SettingPanel::createConnections()
{
- // use `qOverload` here to prevent ambiguity.
- connect(hintingModeComboBox_,
+ // Use `QOverload` here to prevent ambiguities.
+ connect(hintingModeComboBox_,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &SettingPanel::fontReloadNeeded);
connect(antiAliasingComboBox_,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &SettingPanel::checkAntiAliasing);
- connect(lcdFilterComboBox_,
+ connect(lcdFilterComboBox_,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &SettingPanel::repaintNeeded);
connect(paletteComboBox_,
- QOverload<int>::of(&QComboBox::currentIndexChanged),
+ QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &SettingPanel::checkPalette);
connect(gammaSlider_, &QSlider::valueChanged,
this, &SettingPanel::updateGamma);
-
+
connect(hintingCheckBox_, &QCheckBox::clicked,
this, &SettingPanel::checkHinting);
@@ -757,15 +759,15 @@ SettingPanel::setDefaults()
{ defaults.ttInterpreterVersionDefault,
defaults.ttInterpreterVersionOther,
defaults.ttInterpreterVersionOther1 },
- { defaults.cffHintingEngineDefault,
+ { defaults.cffHintingEngineDefault,
defaults.cffHintingEngineOther });
currentCFFHintingMode_
= hintingModeComboBoxModel_->cffModeToIndex(
- defaults.cffHintingEngineDefault);
+ defaults.cffHintingEngineDefault);
currentTTInterpreterVersion_
= hintingModeComboBoxModel_->ttInterpreterVersionToIndex(
- defaults.ttInterpreterVersionDefault);
+ defaults.ttInterpreterVersionDefault);
hintingCheckBox_->setChecked(true);
diff --git a/src/ftinspect/panels/settingpanel.hpp
b/src/ftinspect/panels/settingpanel.hpp
index 12bdf57..ba34e38 100644
--- a/src/ftinspect/panels/settingpanel.hpp
+++ b/src/ftinspect/panels/settingpanel.hpp
@@ -4,33 +4,35 @@
#pragma once
+#include "settingpanelmmgx.hpp"
#include "../engine/engine.hpp"
#include "../models/customcomboboxmodels.hpp"
-#include "settingpanelmmgx.hpp"
-#include <QWidget>
-#include <QTabWidget>
-#include <QLabel>
-#include <QComboBox>
+#include <QBoxLayout>
#include <QCheckBox>
+#include <QComboBox>
#include <QGridLayout>
-#include <QBoxLayout>
+#include <QLabel>
#include <QPushButton>
+#include <QTabWidget>
+#include <QWidget>
+
class SettingPanel
: public QWidget
{
Q_OBJECT
+
public:
- SettingPanel(QWidget* parent, Engine* engine, bool comparatorMode = false);
+ SettingPanel(QWidget* parent,
+ Engine* engine,
+ bool comparatorMode = false);
~SettingPanel() override = default;
void onFontChanged();
void applySettings();
- /*
- * When in comparator mode, this is needed to sync the hinting modes when
- * reloading the font.
- */
+ // In comparator mode, this is needed to sync the hinting modes when
+ // reloading the font.
void applyDelayedSettings();
//////// Getters/Setters
@@ -50,16 +52,14 @@ private:
int currentCFFHintingMode_;
int currentTTInterpreterVersion_;
- /*
- * There's two places where `SettingPanel` appears: On the left for most
tabs,
- * and on the bottom in the comparator for each column. Therefore,
- * set `comparatorMode_` to `true` will change the panel for the Comparator
- * View.
- *
- * In comparator view, some updating is suppressed during GUI events.
- * Instead, updating was strictly passive called from the parent (comparator
- * view).
- */
+ // There are two places where `SettingPanel` appears: On the left for most
+ // tabs, and on the bottom in the comparator for each column. Therefore,
+ // setting `comparatorMode_` to `true` changes the panel for the
+ // Comparator View.
+ //
+ // In comparator view, some updating is suppressed during GUI events.
+ // Instead, updating is strictly passively called from the parent
+ // (comparator view).
bool comparatorMode_ = false;
bool debugMode_ = false;
@@ -114,7 +114,7 @@ private:
QColor backgroundColor_;
QColor foregroundColor_;
- //////// Initializing funcs
+ //////// Initializing functions.
void createConnections();
void createLayout();
@@ -122,7 +122,7 @@ private:
void createLayoutComparator();
void setDefaults();
- //////// Other funcs
+ //////// Other functions.
void checkAllSettings();
void checkHinting();
diff --git a/src/ftinspect/panels/settingpanelmmgx.cpp
b/src/ftinspect/panels/settingpanelmmgx.cpp
index a1a81dc..b9dcc71 100644
--- a/src/ftinspect/panels/settingpanelmmgx.cpp
+++ b/src/ftinspect/panels/settingpanelmmgx.cpp
@@ -9,6 +9,7 @@
#include "../engine/engine.hpp"
#include "../uihelper.hpp"
+
SettingPanelMMGX::SettingPanelMMGX(QWidget* parent,
Engine* engine)
: QWidget(parent),
@@ -32,7 +33,7 @@ SettingPanelMMGX::reloadFont()
auto oldSize = itemWidgets_.size();
auto minSize = std::min(newSize, oldSize);
- // This won't trigger unexpected updating since signals are blocked
+ // This won't trigger unexpected updating since signals are blocked.
for (size_t i = 0; i < minSize; ++i)
itemWidgets_[i]->updateInfo(currentAxes_[i]);
@@ -147,7 +148,8 @@ void
SettingPanelMMGX::itemChanged(size_t index)
{
if (groupingCheckBox_->isChecked()
- && index < currentAxes_.size() && index < itemWidgets_.size())
+ && index < currentAxes_.size()
+ && index < itemWidgets_.size())
{
auto tag = currentAxes_[index].tag;
auto value = itemWidgets_[index]->value();
@@ -217,9 +219,8 @@ MMGXSettingItem::updateInfo(MMGXAxisInfo& info)
else
nameLabel_->setText(info.name);
- // To keep things simple, we will use 1/1024 of the span between the min and
- // max as one step on the slider.
-
+ // To keep things simple, we use 1/1024th of the span between the minimum
+ // and the maximum as one step on the slider.
slider_->setMinimum(0);
slider_->setTickInterval(1);
slider_->setMaximum(1024);
@@ -264,8 +265,8 @@ MMGXSettingItem::createLayout()
setButtonNarrowest(resetDefaultButton_);
nameLabel_->setToolTip(tr("Axis name or tag"));
- slider_->setToolTip(
- tr("Axis value (max precision: 1/1024 of the value range)"));
+ slider_->setToolTip(tr(
+ "Axis value (max precision: 1/1024 of the value range)"));
valueLineEdit_->setToolTip(tr("Axis value"));
resetDefaultButton_->setToolTip(tr("Reset axis to default"));
@@ -300,7 +301,7 @@ void
MMGXSettingItem::sliderValueChanged()
{
auto value = slider_->value() / 1024.0
- * (axisInfo_.maximum - axisInfo_.minimum)
+ * (axisInfo_.maximum - axisInfo_.minimum)
+ axisInfo_.minimum;
actualValue_ = static_cast<FT_Fixed>(value * 65536.0);
diff --git a/src/ftinspect/panels/settingpanelmmgx.hpp
b/src/ftinspect/panels/settingpanelmmgx.hpp
index f61ca42..f06875d 100644
--- a/src/ftinspect/panels/settingpanelmmgx.hpp
+++ b/src/ftinspect/panels/settingpanelmmgx.hpp
@@ -7,30 +7,33 @@
#include "../engine/mmgx.hpp"
#include "../widgets/customwidgets.hpp"
-#include <QWidget>
-#include <QGridLayout>
#include <QBoxLayout>
#include <QCheckBox>
-#include <QScrollArea>
-#include <QLineEdit>
-#include <QSlider>
+#include <QDoubleValidator>
#include <QFrame>
+#include <QGridLayout>
+#include <QLabel>
+#include <QLineEdit>
#include <QPushButton>
+#include <QScrollArea>
+#include <QSlider>
#include <QToolButton>
-#include <QLabel>
-#include <QDoubleValidator>
+#include <QWidget>
#include <freetype/fttypes.h>
-class Engine;
+class Engine;
class MMGXSettingItem;
+
class SettingPanelMMGX
: public QWidget
{
Q_OBJECT
+
public:
- SettingPanelMMGX(QWidget* parent, Engine* engine);
+ SettingPanelMMGX(QWidget* parent,
+ Engine* engine);
~SettingPanelMMGX() override = default;
void reloadFont();
@@ -72,6 +75,7 @@ class MMGXSettingItem
: public QFrame
{
Q_OBJECT
+
public:
MMGXSettingItem(QWidget* parent);
~MMGXSettingItem() override = default;
diff --git a/src/ftinspect/panels/singular.cpp
b/src/ftinspect/panels/singular.cpp
index 2cb2a20..188c0dc 100644
--- a/src/ftinspect/panels/singular.cpp
+++ b/src/ftinspect/panels/singular.cpp
@@ -9,8 +9,10 @@
#include <QWheelEvent>
-SingularTab::SingularTab(QWidget* parent, Engine* engine)
-: QWidget(parent), engine_(engine),
+SingularTab::SingularTab(QWidget* parent,
+ Engine* engine)
+: QWidget(parent),
+ engine_(engine),
graphicsDefault_(GraphicsDefault::deafultInstance())
{
createLayout();
@@ -32,7 +34,7 @@ SingularTab::~SingularTab()
void
SingularTab::setGlyphIndex(int index)
{
- // only adjust current glyph index if we have a valid font
+ // Only adjust current glyph index if we have a valid font.
if (currentGlyphCount_ <= 0)
return;
@@ -40,7 +42,7 @@ SingularTab::setGlyphIndex(int index)
QString upperHex = QString::number(currentGlyphIndex_, 16).toUpper();
glyphIndexLabel_->setText(
- QString("%1 (0x%2)").arg(currentGlyphIndex_).arg(upperHex));
+ QString("%1 (0x%2)").arg(currentGlyphIndex_).arg(upperHex));
glyphNameLabel_->setText(engine_->glyphName(currentGlyphIndex_));
drawGlyph();
@@ -50,7 +52,7 @@ SingularTab::setGlyphIndex(int index)
void
SingularTab::drawGlyph()
{
- // the call to `engine->loadOutline' updates FreeType's load flags
+ // The call to `engine->loadOutline' updates FreeType's load flags.
if (!engine_)
return;
@@ -97,18 +99,17 @@ SingularTab::drawGlyph()
{
if (showBitmapCheckBox_->isChecked())
{
- currentGlyphBitmapItem_
- = new GlyphBitmap(currentGlyphIndex_,
- glyph,
- engine_);
+ currentGlyphBitmapItem_ = new GlyphBitmap(currentGlyphIndex_,
+ glyph,
+ engine_);
currentGlyphBitmapItem_->setZValue(-1);
glyphScene_->addItem(currentGlyphBitmapItem_);
}
if (showOutlinesCheckBox_->isChecked())
{
- currentGlyphOutlineItem_ = new
GlyphOutline(graphicsDefault_->outlinePen,
- glyph);
+ currentGlyphOutlineItem_ =
+ new GlyphOutline(graphicsDefault_->outlinePen, glyph);
currentGlyphOutlineItem_->setZValue(1);
glyphScene_->addItem(currentGlyphOutlineItem_);
}
@@ -165,9 +166,9 @@ SingularTab::zoom()
QTransform transform;
transform.scale(scale, scale);
- // we want horizontal and vertical 1px lines displayed with full pixels;
+ // We want horizontal and vertical 1px lines displayed with full pixels;
// we thus have to shift the coordinate system accordingly, using a value
- // that represents 0.5px (i.e., half the 1px line width) after the scaling
+ // that represents 0.5px (i.e., half the 1px line width) after the scaling.
qreal shift = 0.5 / scale;
transform.translate(shift, shift);
@@ -254,7 +255,7 @@ SingularTab::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event);
- // Tricky part: when loading, this method will be called twice. Only at the
+ // Tricky part: when loading, this method will be called twice. Only at the
// second time the initial layouting is done, thus the result of `centerOn`
// can be valid.
// We want to only center the midpoint of the size when the program starts up
@@ -263,9 +264,9 @@ SingularTab::resizeEvent(QResizeEvent* event)
return;
initialPositionSetCount_--;
- // The code below mainly:
- // 1. Center the grid on the the center point of the ppem x ppem bbox.
- // 2. Adjust the viewport zoom to fit the ppem x ppem bbox
+ // The code below does mainly the following:
+ // 1. Center the grid on the the center point of the x ppem bbox.
+ // 2. Adjust the viewport zoom to fit the x ppem bbox
updateGeometry();
auto size = sizeSelector_->selectedSize();
auto unit = sizeSelector_->selectedUnit();
@@ -306,7 +307,7 @@ SingularTab::createLayout()
gridItem_ = new Grid(glyphView_);
glyphScene_->addItem(gridItem_);
- // Don't use QGraphicsTextItem: We want this hint to be anchored at the
+ // Don't use `QGraphicsTextItem`: We want this hint to be anchored at the
// top-left corner.
auto overlayFont = font();
overlayFont.setPixelSize(24);
@@ -343,15 +344,15 @@ SingularTab::createLayout()
centerGridButton_->setToolTip(tr(
"Move the viewport so the origin point is at the center of the view."));
showBitmapCheckBox_->setToolTip(tr("Show glyph bitmap."));
- showPointsCheckBox_->setToolTip(
- tr("Show control points (only valid when the glyph is an outline
glyph)."));
- showPointNumbersCheckBox_->setToolTip(
- tr("Show point numbers (only available when points are shown)."));
- showOutlinesCheckBox_->setToolTip(tr("Show (vector) outline (only valid when
"
- "the glyph is an outline glyph)."));
+ showPointsCheckBox_->setToolTip(tr(
+ "Show control points (only valid when the glyph is an outline glyph)."));
+ showPointNumbersCheckBox_->setToolTip(tr(
+ "Show point numbers (only available when points are shown)."));
+ showOutlinesCheckBox_->setToolTip(tr(
+ "Show (vector) outline (only valid when the glyph is an outline glyph)."));
showGridCheckBox_->setToolTip(tr("Show grid lines (x axis: baseline)."));
- showBitmapCheckBox_->setToolTip(
- tr("Show auxiliary lines (blue: y-advance; red: ascender/descender)."));
+ showBitmapCheckBox_->setToolTip(tr(
+ "Show auxiliary lines (blue: y-advance; red: ascender/descender)."));
helpButton_->setToolTip(tr("View scroll help"));
// Layouting
@@ -378,7 +379,7 @@ SingularTab::createLayout()
glyphOverlayIndexLayout_ = new QHBoxLayout;
glyphOverlayIndexLayout_->addWidget(glyphIndexLabel_);
glyphOverlayIndexLayout_->addWidget(glyphNameLabel_);
- glyphOverlayLayout_ = new QGridLayout; // use a grid layout to align
+ glyphOverlayLayout_ = new QGridLayout; // Use a grid layout to align.
glyphOverlayLayout_->addLayout(glyphOverlayIndexLayout_, 0, 1,
Qt::AlignTop | Qt::AlignRight);
glyphView_->setLayout(glyphOverlayLayout_);
@@ -400,17 +401,17 @@ SingularTab::createConnections()
{
connect(sizeSelector_, &FontSizeSelector::valueChanged,
this, &SingularTab::repaintGlyph);
- connect(indexSelector_, &GlyphIndexSelector::currentIndexChanged,
+ connect(indexSelector_, &GlyphIndexSelector::currentIndexChanged,
this, &SingularTab::setGlyphIndex);
-
- connect(glyphView_, &QGraphicsViewx::shiftWheelEvent,
+
+ connect(glyphView_, &QGraphicsViewx::shiftWheelEvent,
this, &SingularTab::wheelResize);
- connect(glyphView_, &QGraphicsViewx::ctrlWheelEvent,
+ connect(glyphView_, &QGraphicsViewx::ctrlWheelEvent,
this, &SingularTab::wheelZoom);
// Use `updateGrid` to support infinite panning.
connect(glyphView_->horizontalScrollBar(), &QScrollBar::valueChanged,
this, &SingularTab::updateGrid);
- connect(glyphView_->verticalScrollBar(), &QScrollBar::valueChanged,
+ connect(glyphView_->verticalScrollBar(), &QScrollBar::valueChanged,
this, &SingularTab::updateGrid);
connect(centerGridButton_, &QPushButton::clicked,
@@ -420,7 +421,7 @@ SingularTab::createConnections()
connect(showBitmapCheckBox_, &QCheckBox::clicked,
this, &SingularTab::drawGlyph);
- connect(showPointsCheckBox_, &QCheckBox::clicked,
+ connect(showPointsCheckBox_, &QCheckBox::clicked,
this, &SingularTab::checkShowPoints);
connect(showPointNumbersCheckBox_, &QCheckBox::clicked,
this, &SingularTab::drawGlyph);
@@ -463,7 +464,7 @@ SingularTab::setCurrentGlyphAndSize(int glyphIndex,
{
if (sizePoint >= 0)
sizeSelector_->setSizePoint(sizePoint);
- indexSelector_->setCurrentIndex(glyphIndex); // this will auto trigger update
+ indexSelector_->setCurrentIndex(glyphIndex); // This auto-triggers update.
}
diff --git a/src/ftinspect/panels/singular.hpp
b/src/ftinspect/panels/singular.hpp
index ffb9cc1..c0892d8 100644
--- a/src/ftinspect/panels/singular.hpp
+++ b/src/ftinspect/panels/singular.hpp
@@ -5,50 +5,55 @@
#pragma once
#include "abstracttab.hpp"
-#include "../widgets/customwidgets.hpp"
-#include "../widgets/glyphindexselector.hpp"
-#include "../widgets/fontsizeselector.hpp"
+#include "../engine/engine.hpp"
#include "../glyphcomponents/glyphbitmap.hpp"
#include "../glyphcomponents/glyphoutline.hpp"
#include "../glyphcomponents/glyphpointnumbers.hpp"
#include "../glyphcomponents/glyphpoints.hpp"
-#include "../glyphcomponents/grid.hpp"
#include "../glyphcomponents/graphicsdefault.hpp"
-#include "../engine/engine.hpp"
+#include "../glyphcomponents/grid.hpp"
#include "../models/customcomboboxmodels.hpp"
+#include "../widgets/customwidgets.hpp"
+#include "../widgets/glyphindexselector.hpp"
+#include "../widgets/fontsizeselector.hpp"
-#include <QWidget>
-#include <QPushButton>
-#include <QSpinBox>
+#include <QBoxLayout>
+#include <QCheckBox>
+#include <QComboBox>
#include <QGraphicsScene>
#include <QGraphicsView>
-#include <QScrollBar>
+#include <QGridLayout>
#include <QLabel>
-#include <QComboBox>
#include <QPen>
-#include <QCheckBox>
+#include <QPushButton>
+#include <QScrollBar>
+#include <QSpinBox>
#include <QVector>
-#include <QGridLayout>
-#include <QBoxLayout>
+#include <QWidget>
+
class SingularTab
-: public QWidget, public AbstractTab
+: public QWidget,
+ public AbstractTab
{
Q_OBJECT
+
public:
- SingularTab(QWidget* parent, Engine* engine);
+ SingularTab(QWidget* parent,
+ Engine* engine);
~SingularTab() override;
void repaintGlyph() override;
void reloadFont() override;
- // when sizePoint <= 0, the size remains unchanged.
- void setCurrentGlyphAndSize(int glyphIndex, double sizePoint);
+ // The size remains unchanged if `sizePoint` <= 0.
+ void setCurrentGlyphAndSize(int glyphIndex,
+ double sizePoint);
int currentGlyph();
private slots:
void setGlyphIndex(int);
void drawGlyph();
-
+
void checkShowPoints();
void zoom();
@@ -59,7 +64,8 @@ private slots:
void showToolTip();
protected:
- bool eventFilter(QObject* watched, QEvent* event) override;
+ bool eventFilter(QObject* watched,
+ QEvent* event) override;
void resizeEvent(QResizeEvent* event) override;
private:
@@ -101,14 +107,15 @@ private:
GraphicsDefault* graphicsDefault_;
- int initialPositionSetCount_ = 2; // see `resizeEvent`
+ int initialPositionSetCount_ = 2; // See `resizeEvent`.
void createLayout();
void createConnections();
-
+
void updateGrid();
void applySettings();
void setDefaults();
};
+
// end of singular.hpp
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 6e71c99 38/41: [ftinspect] Format `src/ftinspect/panels/*`.,
Werner Lemberg <=