Charlie Jiang pushed to branch ftinspect-cmake at FreeType / FreeType Demo Programs
Commits:
-
8d329489
by Hugh McMaster at 2022-06-21T12:59:07-04:00
-
23a41ca7
by Charlie Jiang at 2022-06-28T12:27:45+00:00
-
66d6925b
by Charlie Jiang at 2022-06-28T12:37:52+00:00
-
bfbed48e
by Charlie Jiang at 2022-06-28T12:37:52+00:00
6 changed files:
- Makefile
- src/ftinspect/.gitignore
- + src/ftinspect/CMakeLists.txt
- src/ftinspect/engine/engine.cpp
- src/ftinspect/engine/engine.hpp
- − src/ftinspect/ftinspect.pro
Changes:
... | ... | @@ -125,6 +125,10 @@ else |
125 | 125 | SRC_DIR := $(TOP_DIR_2)/src
|
126 | 126 | endif
|
127 | 127 | |
128 | + # Append any system-defined CPPFLAGS (e.g. hardening flags) to CFLAGS.
|
|
129 | + #
|
|
130 | + CFLAGS += $(CPPFLAGS)
|
|
131 | + |
|
128 | 132 | ifeq ($(PLATFORM),unixdev)
|
129 | 133 | # `FT_DEMO_CFLAGS` comes from FreeType's `configure` script (via
|
130 | 134 | # `builds/unix/unix-cc.mk`), holding additional flags to compile the
|
... | ... | @@ -143,7 +147,6 @@ else |
143 | 147 | |
144 | 148 | COMPILE = $(CC) $(ANSIFLAGS) \
|
145 | 149 | $(INCLUDES:%=$I%) \
|
146 | - $(CPPFLAGS) \
|
|
147 | 150 | $(CFLAGS) \
|
148 | 151 | $(FT_DEMO_CFLAGS)
|
149 | 152 |
... | ... | @@ -4,3 +4,8 @@ ftinspect |
4 | 4 | moc_*.cpp
|
5 | 5 | moc_*.h
|
6 | 6 | .qmake.stash
|
7 | + |
|
8 | +# Visual Studio specific
|
|
9 | +out
|
|
10 | +.vs
|
|
11 | +CMakeSettings.json |
1 | +cmake_minimum_required (VERSION 3.0)
|
|
2 | +cmake_policy(SET CMP0074 NEW)
|
|
3 | +set(CMAKE_CXX_STANDARD 11)
|
|
4 | + |
|
5 | +project("ftinspect")
|
|
6 | + |
|
7 | +if (WIN32)
|
|
8 | + add_compile_options("/utf-8")
|
|
9 | +endif ()
|
|
10 | + |
|
11 | +set(CMAKE_AUTOMOC ON)
|
|
12 | +set(CMAKE_AUTORCC ON)
|
|
13 | +set(CMAKE_AUTOUIC ON)
|
|
14 | + |
|
15 | +find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
|
16 | +find_package(Freetype REQUIRED)
|
|
17 | + |
|
18 | +add_executable(ftinspect
|
|
19 | + "ftinspect.cpp"
|
|
20 | + "maingui.cpp"
|
|
21 | +
|
|
22 | + "engine/engine.cpp"
|
|
23 | + |
|
24 | + "rendering/glyphbitmap.cpp"
|
|
25 | + "rendering/glyphoutline.cpp"
|
|
26 | + "rendering/glyphpointnumbers.cpp"
|
|
27 | + "rendering/glyphpoints.cpp"
|
|
28 | + "rendering/grid.cpp"
|
|
29 | + |
|
30 | + "widgets/qcomboboxx.cpp"
|
|
31 | + "widgets/qgraphicsviewx.cpp"
|
|
32 | + "widgets/qpushbuttonx.cpp"
|
|
33 | + "widgets/qspinboxx.cpp"
|
|
34 | +)
|
|
35 | +target_link_libraries(ftinspect
|
|
36 | + Qt5::Core Qt5::Widgets
|
|
37 | + Freetype::Freetype
|
|
38 | +) |
... | ... | @@ -259,7 +259,7 @@ Engine::numberOfFaces(int fontIndex) |
259 | 259 | long numFaces = -1;
|
260 | 260 | |
261 | 261 | // search triplet (fontIndex, 0, 0)
|
262 | - FTC_FaceID ftcFaceID = reinterpret_cast<void*>
|
|
262 | + FTC_FaceID ftcFaceID = reinterpret_cast<FTC_FaceID>
|
|
263 | 263 | (faceIDMap.value(FaceID(fontIndex,
|
264 | 264 | 0,
|
265 | 265 | 0)));
|
... | ... | @@ -272,7 +272,7 @@ Engine::numberOfFaces(int fontIndex) |
272 | 272 | else
|
273 | 273 | {
|
274 | 274 | // not found; try to load triplet (fontIndex, 0, 0)
|
275 | - ftcFaceID = reinterpret_cast<void*>(faceCounter);
|
|
275 | + ftcFaceID = reinterpret_cast<FTC_FaceID>(faceCounter);
|
|
276 | 276 | faceIDMap.insert(FaceID(fontIndex, 0, 0),
|
277 | 277 | faceCounter++);
|
278 | 278 | |
... | ... | @@ -299,7 +299,7 @@ Engine::numberOfNamedInstances(int fontIndex, |
299 | 299 | int numNamedInstances = -1;
|
300 | 300 | |
301 | 301 | // search triplet (fontIndex, faceIndex, 0)
|
302 | - FTC_FaceID ftcFaceID = reinterpret_cast<void*>
|
|
302 | + FTC_FaceID ftcFaceID = reinterpret_cast<FTC_FaceID>
|
|
303 | 303 | (faceIDMap.value(FaceID(fontIndex,
|
304 | 304 | faceIndex,
|
305 | 305 | 0)));
|
... | ... | @@ -312,7 +312,7 @@ Engine::numberOfNamedInstances(int fontIndex, |
312 | 312 | else
|
313 | 313 | {
|
314 | 314 | // not found; try to load triplet (fontIndex, faceIndex, 0)
|
315 | - ftcFaceID = reinterpret_cast<void*>(faceCounter);
|
|
315 | + ftcFaceID = reinterpret_cast<FTC_FaceID>(faceCounter);
|
|
316 | 316 | faceIDMap.insert(FaceID(fontIndex, faceIndex, 0),
|
317 | 317 | faceCounter++);
|
318 | 318 | |
... | ... | @@ -340,7 +340,7 @@ Engine::loadFont(int fontIndex, |
340 | 340 | update();
|
341 | 341 | |
342 | 342 | // search triplet (fontIndex, faceIndex, namedInstanceIndex)
|
343 | - scaler.face_id = reinterpret_cast<void*>
|
|
343 | + scaler.face_id = reinterpret_cast<FTC_FaceID>
|
|
344 | 344 | (faceIDMap.value(FaceID(fontIndex,
|
345 | 345 | faceIndex,
|
346 | 346 | namedInstanceIndex)));
|
... | ... | @@ -354,7 +354,7 @@ Engine::loadFont(int fontIndex, |
354 | 354 | {
|
355 | 355 | // not found; try to load triplet
|
356 | 356 | // (fontIndex, faceIndex, namedInstanceIndex)
|
357 | - scaler.face_id = reinterpret_cast<void*>(faceCounter);
|
|
357 | + scaler.face_id = reinterpret_cast<FTC_FaceID>(faceCounter);
|
|
358 | 358 | faceIDMap.insert(FaceID(fontIndex,
|
359 | 359 | faceIndex,
|
360 | 360 | namedInstanceIndex),
|
... | ... | @@ -400,7 +400,7 @@ Engine::removeFont(int fontIndex) |
400 | 400 | {
|
401 | 401 | // we iterate over all triplets that contain the given font index
|
402 | 402 | // and remove them
|
403 | - QMap<FaceID, int>::iterator iter
|
|
403 | + QMap<FaceID, FTC_IDType>::iterator iter
|
|
404 | 404 | = faceIDMap.lowerBound(FaceID(fontIndex, 0, 0));
|
405 | 405 | |
406 | 406 | for (;;)
|
... | ... | @@ -412,7 +412,7 @@ Engine::removeFont(int fontIndex) |
412 | 412 | if (faceID.fontIndex != fontIndex)
|
413 | 413 | break;
|
414 | 414 | |
415 | - FTC_FaceID ftcFaceID = reinterpret_cast<void*>(iter.value());
|
|
415 | + FTC_FaceID ftcFaceID = reinterpret_cast<FTC_FaceID>(iter.value());
|
|
416 | 416 | FTC_Manager_RemoveFaceID(cacheManager, ftcFaceID);
|
417 | 417 | |
418 | 418 | iter = faceIDMap.erase(iter);
|
... | ... | @@ -76,8 +76,9 @@ public: |
76 | 76 | private:
|
77 | 77 | MainGUI* gui;
|
78 | 78 | |
79 | - int faceCounter; // a running number used to initialize `faceIDMap'
|
|
80 | - QMap<FaceID, int> faceIDMap;
|
|
79 | + using FTC_IDType = uintptr_t;
|
|
80 | + FTC_IDType faceCounter; // a running number used to initialize `faceIDMap'
|
|
81 | + QMap<FaceID, FTC_IDType> faceIDMap;
|
|
81 | 82 | |
82 | 83 | QString curFamilyName;
|
83 | 84 | QString curStyleName;
|
1 | -# ftinspect.pro
|
|
2 | - |
|
3 | -QMAKE_CXXFLAGS += -isystem ../../../freetype/include
|
|
4 | - |
|
5 | -# To avoid conflicts with the FreeType version compiled into or used by Qt,
|
|
6 | -# we use the static library.
|
|
7 | -#
|
|
8 | -# You should adapt this to your setup.
|
|
9 | -unix|macx {
|
|
10 | - LIBS += ../../../freetype/objs/.libs/libfreetype.a
|
|
11 | - |
|
12 | - CONFIG += link_pkgconfig
|
|
13 | - PKGCONFIG += libpng harfbuzz zlib bzip2 libbrotlidec librsvg-2.0
|
|
14 | -}
|
|
15 | -win32 {
|
|
16 | - LIBS += ../../../freetyp2/objs/vc2010/freetype.lib
|
|
17 | - LIBS += -lpng -lharfbuzz -lz -lbz2 -lm -lbrotlidec -lrsvg-2
|
|
18 | -}
|
|
19 | - |
|
20 | -CONFIG += qt debug
|
|
21 | - |
|
22 | -SOURCES += \
|
|
23 | - engine/engine.cpp \
|
|
24 | - rendering/glyphbitmap.cpp \
|
|
25 | - rendering/glyphoutline.cpp \
|
|
26 | - rendering/glyphpointnumbers.cpp \
|
|
27 | - rendering/glyphpoints.cpp \
|
|
28 | - rendering/grid.cpp \
|
|
29 | - widgets/qcomboboxx.cpp \
|
|
30 | - widgets/qgraphicsviewx.cpp \
|
|
31 | - widgets/qpushbuttonx.cpp \
|
|
32 | - widgets/qspinboxx.cpp \
|
|
33 | - ftinspect.cpp \
|
|
34 | - maingui.cpp
|
|
35 | - |
|
36 | -HEADERS += \
|
|
37 | - engine/engine.hpp \
|
|
38 | - rendering/glyphbitmap.hpp \
|
|
39 | - rendering/glyphoutline.hpp \
|
|
40 | - rendering/glyphpointnumbers.hpp \
|
|
41 | - rendering/glyphpoints.hpp \
|
|
42 | - rendering/grid.hpp \
|
|
43 | - widgets/qcomboboxx.hpp \
|
|
44 | - widgets/qgraphicsviewx.hpp \
|
|
45 | - widgets/qpushbuttonx.hpp \
|
|
46 | - widgets/qspinboxx.hpp \
|
|
47 | - maingui.hpp
|
|
48 | - |
|
49 | -TARGET = ftinspect
|
|
50 | - |
|
51 | -QT += widgets
|
|
52 | - |
|
53 | - |
|
54 | -# end of ftinpect.pro |