Commits:
-
51cd5197
by Charlie Jiang
at 2022-07-11T22:17:19+08:00
[ftinspect] Fix compilation on GCC.
* src/ftinspect/panels/continuous.hpp, src/ftinspect/panels/continuous.cpp,
use `std::vector` over `QVector` because the latter requires default
`constructor`; Fix signedness because of `std::vector`;
* src/ftinspect/models/ttsettingscomboboxmodel.hpp: Fix enum inconsistency.
* src/ftinspect/engine/engine.hpp, src/ftinspect/engine/engine.cpp: Fix
missing include; use `std::vector`;
* src/ftinspect/CMakeLists.txt: Fix MinGW: g++ doesn't need `/utf-8` switch.
7 changed files:
Changes:
src/ftinspect/CMakeLists.txt
... |
... |
@@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD 11) |
4
|
4
|
|
5
|
5
|
project("ftinspect")
|
6
|
6
|
|
7
|
|
-if (WIN32)
|
|
7
|
+if (MSVC)
|
8
|
8
|
add_compile_options("/utf-8")
|
9
|
9
|
endif ()
|
10
|
10
|
|
src/ftinspect/engine/engine.cpp
... |
... |
@@ -309,7 +309,7 @@ Engine::loadFont(int fontIndex, |
309
|
309
|
curCharMaps_.clear();
|
310
|
310
|
curCharMaps_.reserve(face->num_charmaps);
|
311
|
311
|
for (int i = 0; i < face->num_charmaps; i++)
|
312
|
|
- curCharMaps_.append(CharMapInfo(i, face->charmaps[i]));
|
|
312
|
+ curCharMaps_.emplace_back(i, face->charmaps[i]);
|
313
|
313
|
}
|
314
|
314
|
|
315
|
315
|
curNumGlyphs_ = numGlyphs;
|
src/ftinspect/engine/engine.hpp
... |
... |
@@ -7,6 +7,7 @@ |
7
|
7
|
|
8
|
8
|
#include "fontfilemanager.hpp"
|
9
|
9
|
|
|
10
|
+#include <vector>
|
10
|
11
|
#include <QString>
|
11
|
12
|
#include <QMap>
|
12
|
13
|
|
... |
... |
@@ -121,7 +122,7 @@ public: |
121
|
122
|
unsigned glyphIndexFromCharCode(int code, int charMapIndex);
|
122
|
123
|
FT_Size_Metrics const& currentFontMetrics();
|
123
|
124
|
|
124
|
|
- QVector<CharMapInfo>& currentFontCharMaps() { return curCharMaps_; }
|
|
125
|
+ std::vector<CharMapInfo>& currentFontCharMaps() { return curCharMaps_; }
|
125
|
126
|
FontFileManager& fontFileManager() { return fontFileManager_; }
|
126
|
127
|
EngineDefaultValues& engineDefaults() { return engineDefaults_; }
|
127
|
128
|
bool antiAliasingEnabled() { return antiAliasingEnabled_; }
|
... |
... |
@@ -174,7 +175,7 @@ private: |
174
|
175
|
QString curFamilyName_;
|
175
|
176
|
QString curStyleName_;
|
176
|
177
|
int curNumGlyphs_ = -1;
|
177
|
|
- QVector<CharMapInfo> curCharMaps_;
|
|
178
|
+ std::vector<CharMapInfo> curCharMaps_;
|
178
|
179
|
|
179
|
180
|
FT_Library library_;
|
180
|
181
|
FTC_Manager cacheManager_;
|
src/ftinspect/models/ttsettingscomboboxmodel.hpp
... |
... |
@@ -112,7 +112,7 @@ public: |
112
|
112
|
virtual ~LCDFilterComboBoxModel() = default;
|
113
|
113
|
|
114
|
114
|
public:
|
115
|
|
- enum LCDFilter
|
|
115
|
+ enum LCDFilter : int
|
116
|
116
|
{
|
117
|
117
|
LCDFilter_Default,
|
118
|
118
|
LCDFilter_Light,
|
src/ftinspect/panels/continuous.cpp
... |
... |
@@ -145,7 +145,7 @@ ContinousAllGlyphsTab::ContinousAllGlyphsTab(QWidget* parent) |
145
|
145
|
{
|
146
|
146
|
createLayout();
|
147
|
147
|
|
148
|
|
- QVector<CharMapInfo> tempCharMaps;
|
|
148
|
+ std::vector<CharMapInfo> tempCharMaps;
|
149
|
149
|
setCharMaps(tempCharMaps); // pass in an empty one
|
150
|
150
|
|
151
|
151
|
checkSubMode();
|
... |
... |
@@ -210,7 +210,7 @@ ContinousAllGlyphsTab::charMapIndex() |
210
|
210
|
auto index = charMapSelector_->currentIndex() - 1;
|
211
|
211
|
if (index <= -1)
|
212
|
212
|
return -1;
|
213
|
|
- if (index >= charMaps_.size())
|
|
213
|
+ if (static_cast<unsigned>(index) >= charMaps_.size())
|
214
|
214
|
return -1;
|
215
|
215
|
return index;
|
216
|
216
|
}
|
... |
... |
@@ -240,7 +240,7 @@ ContinousAllGlyphsTab::setDisplayingCount(int count) |
240
|
240
|
|
241
|
241
|
#define EncodingRole (Qt::UserRole + 10)
|
242
|
242
|
void
|
243
|
|
-ContinousAllGlyphsTab::setCharMaps(QVector<CharMapInfo>& charMaps)
|
|
243
|
+ContinousAllGlyphsTab::setCharMaps(std::vector<CharMapInfo>& charMaps)
|
244
|
244
|
{
|
245
|
245
|
charMaps_ = charMaps;
|
246
|
246
|
int oldIndex = charMapSelector_->currentIndex();
|
... |
... |
@@ -419,7 +419,8 @@ ContinousAllGlyphsTab::charMapChanged() |
419
|
419
|
int newIndex = charMapSelector_->currentIndex();
|
420
|
420
|
if (newIndex != lastCharMapIndex_)
|
421
|
421
|
{
|
422
|
|
- if (newIndex <= 0 || charMaps_.size() <= newIndex - 1)
|
|
422
|
+ if (newIndex <= 0
|
|
423
|
+ || charMaps_.size() <= static_cast<unsigned>(newIndex - 1))
|
423
|
424
|
setGlyphBeginindex(0);
|
424
|
425
|
else if (charMaps_[newIndex - 1].maxIndex <= 20)
|
425
|
426
|
setGlyphBeginindex(charMaps_[newIndex - 1].maxIndex - 1);
|
src/ftinspect/panels/continuous.hpp
... |
... |
@@ -12,10 +12,10 @@ |
12
|
12
|
#include "../rendering/glyphcontinuous.hpp"
|
13
|
13
|
#include "../engine/engine.hpp"
|
14
|
14
|
|
|
15
|
+#include <vector>
|
15
|
16
|
#include <QWidget>
|
16
|
17
|
#include <QLabel>
|
17
|
18
|
#include <QComboBox>
|
18
|
|
-#include <QVector>
|
19
|
19
|
#include <QGridLayout>
|
20
|
20
|
#include <QBoxLayout>
|
21
|
21
|
|
... |
... |
@@ -92,7 +92,7 @@ public: |
92
|
92
|
void setGlyphCount(int count);
|
93
|
93
|
void setDisplayingCount(int count);
|
94
|
94
|
|
95
|
|
- void setCharMaps(QVector<CharMapInfo>& charMaps);
|
|
95
|
+ void setCharMaps(std::vector<CharMapInfo>& charMaps);
|
96
|
96
|
// This doesn't trigger either.
|
97
|
97
|
void updateLimitIndex();
|
98
|
98
|
|
... |
... |
@@ -124,7 +124,7 @@ private: |
124
|
124
|
|
125
|
125
|
QGridLayout* layout_;
|
126
|
126
|
|
127
|
|
- QVector<CharMapInfo> charMaps_;
|
|
127
|
+ std::vector<CharMapInfo> charMaps_;
|
128
|
128
|
|
129
|
129
|
void createLayout();
|
130
|
130
|
void createConnections();
|
src/ftinspect/rendering/grid.hpp
... |
... |
@@ -6,6 +6,7 @@ |
6
|
6
|
#pragma once
|
7
|
7
|
|
8
|
8
|
#include <QGraphicsItem>
|
|
9
|
+#include <QGraphicsView>
|
9
|
10
|
#include <QPen>
|
10
|
11
|
|
11
|
12
|
class Grid
|
|