Charlie Jiang pushed to branch reorg-maingui at FreeType / FreeType Demo Programs
Commits:
-
8cc92c54
by Charlie Jiang at 2022-06-30T18:21:36+08:00
-
1f0ead70
by Charlie Jiang at 2022-06-30T18:39:28+08:00
-
5771bdf9
by Charlie Jiang at 2022-06-30T18:39:28+08:00
-
c22559ce
by Charlie Jiang at 2022-06-30T22:28:26+08:00
23 changed files:
- src/ftinspect/CMakeLists.txt
- src/ftinspect/engine/engine.cpp
- src/ftinspect/engine/engine.hpp
- + src/ftinspect/engine/fontfilemanager.cpp
- + src/ftinspect/engine/fontfilemanager.hpp
- src/ftinspect/ftinspect.cpp
- src/ftinspect/maingui.cpp
- src/ftinspect/maingui.hpp
- src/ftinspect/meson.build
- + src/ftinspect/models/ttsettingscomboboxmodel.cpp
- + src/ftinspect/models/ttsettingscomboboxmodel.hpp
- src/ftinspect/rendering/glyphbitmap.cpp
- src/ftinspect/rendering/glyphbitmap.hpp
- src/ftinspect/rendering/glyphoutline.cpp
- src/ftinspect/rendering/glyphoutline.hpp
- src/ftinspect/rendering/glyphpointnumbers.cpp
- src/ftinspect/rendering/glyphpointnumbers.hpp
- src/ftinspect/rendering/glyphpoints.cpp
- src/ftinspect/rendering/glyphpoints.hpp
- src/ftinspect/rendering/grid.cpp
- src/ftinspect/rendering/grid.hpp
- src/ftinspect/widgets/qgraphicsviewx.cpp
- src/ftinspect/widgets/qgraphicsviewx.hpp
Changes:
... | ... | @@ -20,6 +20,7 @@ add_executable(ftinspect |
20 | 20 | "maingui.cpp"
|
21 | 21 |
|
22 | 22 | "engine/engine.cpp"
|
23 | + "engine/fontfilemanager.cpp"
|
|
23 | 24 | |
24 | 25 | "rendering/glyphbitmap.cpp"
|
25 | 26 | "rendering/glyphoutline.cpp"
|
... | ... | @@ -31,6 +32,8 @@ add_executable(ftinspect |
31 | 32 | "widgets/qgraphicsviewx.cpp"
|
32 | 33 | "widgets/qpushbuttonx.cpp"
|
33 | 34 | "widgets/qspinboxx.cpp"
|
35 | + |
|
36 | + "models/ttsettingscomboboxmodel.cpp"
|
|
34 | 37 | )
|
35 | 38 | target_link_libraries(ftinspect
|
36 | 39 | Qt5::Core Qt5::Widgets
|
... | ... | @@ -4,7 +4,6 @@ |
4 | 4 | |
5 | 5 | |
6 | 6 | #include "engine.hpp"
|
7 | -#include "../maingui.hpp"
|
|
8 | 7 | |
9 | 8 | #include <stdexcept>
|
10 | 9 | #include <stdint.h>
|
... | ... | @@ -77,7 +76,7 @@ faceRequester(FTC_FaceID ftcFaceID, |
77 | 76 | FT_Pointer requestData,
|
78 | 77 | FT_Face* faceP)
|
79 | 78 | {
|
80 | - MainGUI* gui = static_cast<MainGUI*>(requestData);
|
|
79 | + Engine* engine = static_cast<Engine*>(requestData);
|
|
81 | 80 | // `ftcFaceID' is actually an integer
|
82 | 81 | // -> first convert pointer to same-width integer, then discard superfluous
|
83 | 82 | // bits (e.g., on x86_64 where pointers are wider than int)
|
... | ... | @@ -88,16 +87,16 @@ faceRequester(FTC_FaceID ftcFaceID, |
88 | 87 | "Pointer size must be at least the size of int"
|
89 | 88 | " in order to treat FTC_FaceID correctly");
|
90 | 89 | |
91 | - const FaceID& faceID = gui->engine->faceIDMap.key(val);
|
|
90 | + const FaceID& faceID = engine->faceIDMap_.key(val);
|
|
92 | 91 | |
93 | 92 | // this is the only place where we have to check the validity of the font
|
94 | 93 | // index; note that the validity of both the face and named instance index
|
95 | 94 | // is checked by FreeType itself
|
96 | 95 | if (faceID.fontIndex < 0
|
97 | - || faceID.fontIndex >= gui->fontList.size())
|
|
96 | + || faceID.fontIndex >= engine->numberOfOpenedFonts())
|
|
98 | 97 | return FT_Err_Invalid_Argument;
|
99 | 98 | |
100 | - QString& font = gui->fontList[faceID.fontIndex];
|
|
99 | + QString font = engine->fontFileManager_[faceID.fontIndex].filePath();
|
|
101 | 100 | long faceIndex = faceID.faceIndex;
|
102 | 101 | |
103 | 102 | if (faceID.namedInstanceIndex > 0)
|
... | ... | @@ -116,139 +115,47 @@ faceRequester(FTC_FaceID ftcFaceID, |
116 | 115 | //
|
117 | 116 | /////////////////////////////////////////////////////////////////////////////
|
118 | 117 | |
119 | -Engine::Engine(MainGUI* g)
|
|
118 | +Engine::Engine()
|
|
120 | 119 | {
|
121 | - gui = g;
|
|
122 | - ftSize = NULL;
|
|
120 | + ftSize_ = NULL;
|
|
123 | 121 | // we reserve value 0 for the `invalid face ID'
|
124 | - faceCounter = 1;
|
|
122 | + faceCounter_ = 1;
|
|
125 | 123 | |
126 | 124 | FT_Error error;
|
127 | 125 | |
128 | - error = FT_Init_FreeType(&library);
|
|
126 | + error = FT_Init_FreeType(&library_);
|
|
129 | 127 | if (error)
|
130 | 128 | {
|
131 | 129 | // XXX error handling
|
132 | 130 | }
|
133 | 131 | |
134 | - error = FTC_Manager_New(library, 0, 0, 0,
|
|
135 | - faceRequester, gui, &cacheManager);
|
|
132 | + error = FTC_Manager_New(library_, 0, 0, 0,
|
|
133 | + faceRequester, this, &cacheManager_);
|
|
136 | 134 | if (error)
|
137 | 135 | {
|
138 | 136 | // XXX error handling
|
139 | 137 | }
|
140 | 138 | |
141 | - error = FTC_SBitCache_New(cacheManager, &sbitsCache);
|
|
139 | + error = FTC_SBitCache_New(cacheManager_, &sbitsCache_);
|
|
142 | 140 | if (error)
|
143 | 141 | {
|
144 | 142 | // XXX error handling
|
145 | 143 | }
|
146 | 144 | |
147 | - error = FTC_ImageCache_New(cacheManager, &imageCache);
|
|
145 | + error = FTC_ImageCache_New(cacheManager_, &imageCache_);
|
|
148 | 146 | if (error)
|
149 | 147 | {
|
150 | 148 | // XXX error handling
|
151 | 149 | }
|
152 | 150 | |
153 | - // query engines and check for alternatives
|
|
154 | - |
|
155 | - // CFF
|
|
156 | - error = FT_Property_Get(library,
|
|
157 | - "cff",
|
|
158 | - "hinting-engine",
|
|
159 | - &cffHintingEngineDefault);
|
|
160 | - if (error)
|
|
161 | - {
|
|
162 | - // no CFF engine
|
|
163 | - cffHintingEngineDefault = -1;
|
|
164 | - cffHintingEngineOther = -1;
|
|
165 | - }
|
|
166 | - else
|
|
167 | - {
|
|
168 | - int engines[] =
|
|
169 | - {
|
|
170 | - FT_HINTING_FREETYPE,
|
|
171 | - FT_HINTING_ADOBE
|
|
172 | - };
|
|
173 | - |
|
174 | - int i;
|
|
175 | - for (i = 0; i < 2; i++)
|
|
176 | - if (cffHintingEngineDefault == engines[i])
|
|
177 | - break;
|
|
178 | - |
|
179 | - cffHintingEngineOther = engines[(i + 1) % 2];
|
|
180 | - |
|
181 | - error = FT_Property_Set(library,
|
|
182 | - "cff",
|
|
183 | - "hinting-engine",
|
|
184 | - &cffHintingEngineOther);
|
|
185 | - if (error)
|
|
186 | - cffHintingEngineOther = -1;
|
|
187 | - |
|
188 | - // reset
|
|
189 | - FT_Property_Set(library,
|
|
190 | - "cff",
|
|
191 | - "hinting-engine",
|
|
192 | - &cffHintingEngineDefault);
|
|
193 | - }
|
|
194 | - |
|
195 | - // TrueType
|
|
196 | - error = FT_Property_Get(library,
|
|
197 | - "truetype",
|
|
198 | - "interpreter-version",
|
|
199 | - &ttInterpreterVersionDefault);
|
|
200 | - if (error)
|
|
201 | - {
|
|
202 | - // no TrueType engine
|
|
203 | - ttInterpreterVersionDefault = -1;
|
|
204 | - ttInterpreterVersionOther = -1;
|
|
205 | - ttInterpreterVersionOther1 = -1;
|
|
206 | - }
|
|
207 | - else
|
|
208 | - {
|
|
209 | - int interpreters[] =
|
|
210 | - {
|
|
211 | - TT_INTERPRETER_VERSION_35,
|
|
212 | - TT_INTERPRETER_VERSION_38,
|
|
213 | - TT_INTERPRETER_VERSION_40
|
|
214 | - };
|
|
215 | - |
|
216 | - int i;
|
|
217 | - for (i = 0; i < 3; i++)
|
|
218 | - if (ttInterpreterVersionDefault == interpreters[i])
|
|
219 | - break;
|
|
220 | - |
|
221 | - ttInterpreterVersionOther = interpreters[(i + 1) % 3];
|
|
222 | - |
|
223 | - error = FT_Property_Set(library,
|
|
224 | - "truetype",
|
|
225 | - "interpreter-version",
|
|
226 | - &ttInterpreterVersionOther);
|
|
227 | - if (error)
|
|
228 | - ttInterpreterVersionOther = -1;
|
|
229 | - |
|
230 | - ttInterpreterVersionOther1 = interpreters[(i + 2) % 3];
|
|
231 | - |
|
232 | - error = FT_Property_Set(library,
|
|
233 | - "truetype",
|
|
234 | - "interpreter-version",
|
|
235 | - &ttInterpreterVersionOther1);
|
|
236 | - if (error)
|
|
237 | - ttInterpreterVersionOther1 = -1;
|
|
238 | - |
|
239 | - // reset
|
|
240 | - FT_Property_Set(library,
|
|
241 | - "truetype",
|
|
242 | - "interpreter-version",
|
|
243 | - &ttInterpreterVersionDefault);
|
|
244 | - }
|
|
151 | + queryEngine();
|
|
245 | 152 | }
|
246 | 153 | |
247 | 154 | |
248 | 155 | Engine::~Engine()
|
249 | 156 | {
|
250 | - FTC_Manager_Done(cacheManager);
|
|
251 | - FT_Done_FreeType(library);
|
|
157 | + FTC_Manager_Done(cacheManager_);
|
|
158 | + FT_Done_FreeType(library_);
|
|
252 | 159 | }
|
253 | 160 | |
254 | 161 | |
... | ... | @@ -260,28 +167,28 @@ Engine::numberOfFaces(int fontIndex) |
260 | 167 | |
261 | 168 | // search triplet (fontIndex, 0, 0)
|
262 | 169 | FTC_FaceID ftcFaceID = reinterpret_cast<FTC_FaceID>
|
263 | - (faceIDMap.value(FaceID(fontIndex,
|
|
170 | + (faceIDMap_.value(FaceID(fontIndex,
|
|
264 | 171 | 0,
|
265 | 172 | 0)));
|
266 | 173 | if (ftcFaceID)
|
267 | 174 | {
|
268 | 175 | // found
|
269 | - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face))
|
|
176 | + if (!FTC_Manager_LookupFace(cacheManager_, ftcFaceID, &face))
|
|
270 | 177 | numFaces = face->num_faces;
|
271 | 178 | }
|
272 | 179 | else
|
273 | 180 | {
|
274 | 181 | // not found; try to load triplet (fontIndex, 0, 0)
|
275 | - ftcFaceID = reinterpret_cast<FTC_FaceID>(faceCounter);
|
|
276 | - faceIDMap.insert(FaceID(fontIndex, 0, 0),
|
|
277 | - faceCounter++);
|
|
182 | + ftcFaceID = reinterpret_cast<FTC_FaceID>(faceCounter_);
|
|
183 | + faceIDMap_.insert(FaceID(fontIndex, 0, 0),
|
|
184 | + faceCounter_++);
|
|
278 | 185 | |
279 | - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face))
|
|
186 | + if (!FTC_Manager_LookupFace(cacheManager_, ftcFaceID, &face))
|
|
280 | 187 | numFaces = face->num_faces;
|
281 | 188 | else
|
282 | 189 | {
|
283 | - faceIDMap.remove(FaceID(fontIndex, 0, 0));
|
|
284 | - faceCounter--;
|
|
190 | + faceIDMap_.remove(FaceID(fontIndex, 0, 0));
|
|
191 | + faceCounter_--;
|
|
285 | 192 | }
|
286 | 193 | }
|
287 | 194 | |
... | ... | @@ -300,28 +207,28 @@ Engine::numberOfNamedInstances(int fontIndex, |
300 | 207 | |
301 | 208 | // search triplet (fontIndex, faceIndex, 0)
|
302 | 209 | FTC_FaceID ftcFaceID = reinterpret_cast<FTC_FaceID>
|
303 | - (faceIDMap.value(FaceID(fontIndex,
|
|
210 | + (faceIDMap_.value(FaceID(fontIndex,
|
|
304 | 211 | faceIndex,
|
305 | 212 | 0)));
|
306 | 213 | if (ftcFaceID)
|
307 | 214 | {
|
308 | 215 | // found
|
309 | - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face))
|
|
216 | + if (!FTC_Manager_LookupFace(cacheManager_, ftcFaceID, &face))
|
|
310 | 217 | numNamedInstances = static_cast<int>((face->style_flags >> 16) + 1);
|
311 | 218 | }
|
312 | 219 | else
|
313 | 220 | {
|
314 | 221 | // not found; try to load triplet (fontIndex, faceIndex, 0)
|
315 | - ftcFaceID = reinterpret_cast<FTC_FaceID>(faceCounter);
|
|
316 | - faceIDMap.insert(FaceID(fontIndex, faceIndex, 0),
|
|
317 | - faceCounter++);
|
|
222 | + ftcFaceID = reinterpret_cast<FTC_FaceID>(faceCounter_);
|
|
223 | + faceIDMap_.insert(FaceID(fontIndex, faceIndex, 0),
|
|
224 | + faceCounter_++);
|
|
318 | 225 | |
319 | - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face))
|
|
226 | + if (!FTC_Manager_LookupFace(cacheManager_, ftcFaceID, &face))
|
|
320 | 227 | numNamedInstances = static_cast<int>((face->style_flags >> 16) + 1);
|
321 | 228 | else
|
322 | 229 | {
|
323 | - faceIDMap.remove(FaceID(fontIndex, faceIndex, 0));
|
|
324 | - faceCounter--;
|
|
230 | + faceIDMap_.remove(FaceID(fontIndex, faceIndex, 0));
|
|
231 | + faceCounter_--;
|
|
325 | 232 | }
|
326 | 233 | }
|
327 | 234 | |
... | ... | @@ -335,60 +242,60 @@ Engine::loadFont(int fontIndex, |
335 | 242 | int namedInstanceIndex)
|
336 | 243 | {
|
337 | 244 | int numGlyphs = -1;
|
338 | - fontType = FontType_Other;
|
|
245 | + fontType_ = FontType_Other;
|
|
339 | 246 | |
340 | 247 | update();
|
341 | 248 | |
342 | 249 | // search triplet (fontIndex, faceIndex, namedInstanceIndex)
|
343 | - scaler.face_id = reinterpret_cast<FTC_FaceID>
|
|
344 | - (faceIDMap.value(FaceID(fontIndex,
|
|
250 | + scaler_.face_id = reinterpret_cast<FTC_FaceID>
|
|
251 | + (faceIDMap_.value(FaceID(fontIndex,
|
|
345 | 252 | faceIndex,
|
346 | 253 | namedInstanceIndex)));
|
347 | - if (scaler.face_id)
|
|
254 | + if (scaler_.face_id)
|
|
348 | 255 | {
|
349 | 256 | // found
|
350 | - if (!FTC_Manager_LookupSize(cacheManager, &scaler, &ftSize))
|
|
351 | - numGlyphs = ftSize->face->num_glyphs;
|
|
257 | + if (!FTC_Manager_LookupSize(cacheManager_, &scaler_, &ftSize_))
|
|
258 | + numGlyphs = ftSize_->face->num_glyphs;
|
|
352 | 259 | }
|
353 | 260 | else
|
354 | 261 | {
|
355 | 262 | // not found; try to load triplet
|
356 | 263 | // (fontIndex, faceIndex, namedInstanceIndex)
|
357 | - scaler.face_id = reinterpret_cast<FTC_FaceID>(faceCounter);
|
|
358 | - faceIDMap.insert(FaceID(fontIndex,
|
|
264 | + scaler_.face_id = reinterpret_cast<FTC_FaceID>(faceCounter_);
|
|
265 | + faceIDMap_.insert(FaceID(fontIndex,
|
|
359 | 266 | faceIndex,
|
360 | 267 | namedInstanceIndex),
|
361 | - faceCounter++);
|
|
268 | + faceCounter_++);
|
|
362 | 269 | |
363 | - if (!FTC_Manager_LookupSize(cacheManager, &scaler, &ftSize))
|
|
364 | - numGlyphs = ftSize->face->num_glyphs;
|
|
270 | + if (!FTC_Manager_LookupSize(cacheManager_, &scaler_, &ftSize_))
|
|
271 | + numGlyphs = ftSize_->face->num_glyphs;
|
|
365 | 272 | else
|
366 | 273 | {
|
367 | - faceIDMap.remove(FaceID(fontIndex,
|
|
274 | + faceIDMap_.remove(FaceID(fontIndex,
|
|
368 | 275 | faceIndex,
|
369 | 276 | namedInstanceIndex));
|
370 | - faceCounter--;
|
|
277 | + faceCounter_--;
|
|
371 | 278 | }
|
372 | 279 | }
|
373 | 280 | |
374 | 281 | if (numGlyphs < 0)
|
375 | 282 | {
|
376 | - ftSize = NULL;
|
|
377 | - curFamilyName = QString();
|
|
378 | - curStyleName = QString();
|
|
283 | + ftSize_ = NULL;
|
|
284 | + curFamilyName_ = QString();
|
|
285 | + curStyleName_ = QString();
|
|
379 | 286 | }
|
380 | 287 | else
|
381 | 288 | {
|
382 | - curFamilyName = QString(ftSize->face->family_name);
|
|
383 | - curStyleName = QString(ftSize->face->style_name);
|
|
289 | + curFamilyName_ = QString(ftSize_->face->family_name);
|
|
290 | + curStyleName_ = QString(ftSize_->face->style_name);
|
|
384 | 291 | |
385 | - const char* moduleName = FT_FACE_DRIVER_NAME( ftSize->face );
|
|
292 | + const char* moduleName = FT_FACE_DRIVER_NAME( ftSize_->face );
|
|
386 | 293 | |
387 | 294 | // XXX cover all available modules
|
388 | 295 | if (!strcmp(moduleName, "cff"))
|
389 | - fontType = FontType_CFF;
|
|
296 | + fontType_ = FontType_CFF;
|
|
390 | 297 | else if (!strcmp(moduleName, "truetype"))
|
391 | - fontType = FontType_TrueType;
|
|
298 | + fontType_ = FontType_TrueType;
|
|
392 | 299 | }
|
393 | 300 | |
394 | 301 | return numGlyphs;
|
... | ... | @@ -396,16 +303,16 @@ Engine::loadFont(int fontIndex, |
396 | 303 | |
397 | 304 | |
398 | 305 | void
|
399 | -Engine::removeFont(int fontIndex)
|
|
306 | +Engine::removeFont(int fontIndex, bool closeFile)
|
|
400 | 307 | {
|
401 | 308 | // we iterate over all triplets that contain the given font index
|
402 | 309 | // and remove them
|
403 | 310 | QMap<FaceID, FTC_IDType>::iterator iter
|
404 | - = faceIDMap.lowerBound(FaceID(fontIndex, 0, 0));
|
|
311 | + = faceIDMap_.lowerBound(FaceID(fontIndex, 0, 0));
|
|
405 | 312 | |
406 | 313 | for (;;)
|
407 | 314 | {
|
408 | - if (iter == faceIDMap.end())
|
|
315 | + if (iter == faceIDMap_.end())
|
|
409 | 316 | break;
|
410 | 317 | |
411 | 318 | FaceID faceID = iter.key();
|
... | ... | @@ -413,24 +320,13 @@ Engine::removeFont(int fontIndex) |
413 | 320 | break;
|
414 | 321 | |
415 | 322 | FTC_FaceID ftcFaceID = reinterpret_cast<FTC_FaceID>(iter.value());
|
416 | - FTC_Manager_RemoveFaceID(cacheManager, ftcFaceID);
|
|
323 | + FTC_Manager_RemoveFaceID(cacheManager_, ftcFaceID);
|
|
417 | 324 | |
418 | - iter = faceIDMap.erase(iter);
|
|
325 | + iter = faceIDMap_.erase(iter);
|
|
419 | 326 | }
|
420 | -}
|
|
421 | - |
|
422 | 327 | |
423 | -const QString&
|
|
424 | -Engine::currentFamilyName()
|
|
425 | -{
|
|
426 | - return curFamilyName;
|
|
427 | -}
|
|
428 | - |
|
429 | - |
|
430 | -const QString&
|
|
431 | -Engine::currentStyleName()
|
|
432 | -{
|
|
433 | - return curStyleName;
|
|
328 | + if (closeFile)
|
|
329 | + fontFileManager_.remove(fontIndex);
|
|
434 | 330 | }
|
435 | 331 | |
436 | 332 | |
... | ... | @@ -442,10 +338,10 @@ Engine::glyphName(int index) |
442 | 338 | if (index < 0)
|
443 | 339 | throw std::runtime_error("Invalid glyph index");
|
444 | 340 | |
445 | - if (ftSize && FT_HAS_GLYPH_NAMES(ftSize->face))
|
|
341 | + if (ftSize_ && FT_HAS_GLYPH_NAMES(ftSize_->face))
|
|
446 | 342 | {
|
447 | 343 | char buffer[256];
|
448 | - if (!FT_Get_Glyph_Name(ftSize->face,
|
|
344 | + if (!FT_Get_Glyph_Name(ftSize_->face,
|
|
449 | 345 | static_cast<unsigned int>(index),
|
450 | 346 | buffer,
|
451 | 347 | sizeof(buffer)))
|
... | ... | @@ -470,9 +366,9 @@ Engine::loadOutline(int glyphIndex) |
470 | 366 | |
471 | 367 | // the `scaler' object is set up by the
|
472 | 368 | // `update' and `loadFont' methods
|
473 | - if (FTC_ImageCache_LookupScaler(imageCache,
|
|
474 | - &scaler,
|
|
475 | - loadFlags | FT_LOAD_NO_BITMAP,
|
|
369 | + if (FTC_ImageCache_LookupScaler(imageCache_,
|
|
370 | + &scaler_,
|
|
371 | + loadFlags_ | FT_LOAD_NO_BITMAP,
|
|
476 | 372 | static_cast<unsigned int>(glyphIndex),
|
477 | 373 | &glyph,
|
478 | 374 | NULL))
|
... | ... | @@ -490,36 +386,70 @@ Engine::loadOutline(int glyphIndex) |
490 | 386 | }
|
491 | 387 | |
492 | 388 | |
389 | +int
|
|
390 | +Engine::numberOfOpenedFonts()
|
|
391 | +{
|
|
392 | + return fontFileManager_.size();
|
|
393 | +}
|
|
394 | + |
|
395 | + |
|
493 | 396 | void
|
494 | -Engine::setCFFHintingMode(int mode)
|
|
397 | +Engine::openFonts(QStringList fontFileNames)
|
|
398 | +{
|
|
399 | + fontFileManager_.append(fontFileNames);
|
|
400 | +}
|
|
401 | + |
|
402 | + |
|
403 | +void
|
|
404 | +Engine::setSizeByPixel(double pixelSize)
|
|
495 | 405 | {
|
496 | - int index = gui->hintingModesCFFHash.key(mode);
|
|
406 | + this->pixelSize_ = pixelSize;
|
|
407 | + pointSize_ = pixelSize * 72.0 / dpi_;
|
|
408 | + usingPixelSize_ = true;
|
|
409 | +}
|
|
497 | 410 | |
498 | - FT_Error error = FT_Property_Set(library,
|
|
411 | +void
|
|
412 | +Engine::setSizeByPoint(double pointSize)
|
|
413 | +{
|
|
414 | + this->pointSize_ = pointSize;
|
|
415 | + pixelSize_ = pointSize * dpi_ / 72.0;
|
|
416 | + usingPixelSize_ = false;
|
|
417 | +}
|
|
418 | + |
|
419 | + |
|
420 | +void
|
|
421 | +Engine::setLcdFilter(FT_LcdFilter filter)
|
|
422 | +{
|
|
423 | + FT_Library_SetLcdFilter(library_, filter);
|
|
424 | +}
|
|
425 | + |
|
426 | + |
|
427 | +void
|
|
428 | +Engine::setCFFHintingMode(int mode)
|
|
429 | +{
|
|
430 | + FT_Error error = FT_Property_Set(library_,
|
|
499 | 431 | "cff",
|
500 | 432 | "hinting-engine",
|
501 | - &index);
|
|
433 | + &mode);
|
|
502 | 434 | if (!error)
|
503 | 435 | {
|
504 | 436 | // reset the cache
|
505 | - FTC_Manager_Reset(cacheManager);
|
|
437 | + FTC_Manager_Reset(cacheManager_);
|
|
506 | 438 | }
|
507 | 439 | }
|
508 | 440 | |
509 | 441 | |
510 | 442 | void
|
511 | -Engine::setTTInterpreterVersion(int mode)
|
|
443 | +Engine::setTTInterpreterVersion(int version)
|
|
512 | 444 | {
|
513 | - int index = gui->hintingModesTrueTypeHash.key(mode);
|
|
514 | - |
|
515 | - FT_Error error = FT_Property_Set(library,
|
|
445 | + FT_Error error = FT_Property_Set(library_,
|
|
516 | 446 | "truetype",
|
517 | 447 | "interpreter-version",
|
518 | - &index);
|
|
448 | + &version);
|
|
519 | 449 | if (!error)
|
520 | 450 | {
|
521 | 451 | // reset the cache
|
522 | - FTC_Manager_Reset(cacheManager);
|
|
452 | + FTC_Manager_Reset(cacheManager_);
|
|
523 | 453 | }
|
524 | 454 | }
|
525 | 455 | |
... | ... | @@ -527,95 +457,143 @@ Engine::setTTInterpreterVersion(int mode) |
527 | 457 | void
|
528 | 458 | Engine::update()
|
529 | 459 | {
|
530 | - // Spinbox value cannot become negative
|
|
531 | - dpi = static_cast<unsigned int>(gui->dpiSpinBox->value());
|
|
460 | + loadFlags_ = FT_LOAD_DEFAULT;
|
|
461 | + if (doAutoHinting_)
|
|
462 | + loadFlags_ |= FT_LOAD_FORCE_AUTOHINT;
|
|
463 | + loadFlags_ |= FT_LOAD_NO_BITMAP; // XXX handle bitmap fonts also
|
|
532 | 464 | |
533 | - if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px)
|
|
465 | + if (doHinting_)
|
|
534 | 466 | {
|
535 | - pixelSize = gui->sizeDoubleSpinBox->value();
|
|
536 | - pointSize = pixelSize * 72.0 / dpi;
|
|
467 | + // TODO Differenate RGB/BGR here?
|
|
468 | + unsigned long target = antiAliasingTarget_;
|
|
469 | + loadFlags_ |= target;
|
|
537 | 470 | }
|
538 | 471 | else
|
539 | 472 | {
|
540 | - pointSize = gui->sizeDoubleSpinBox->value();
|
|
541 | - pixelSize = pointSize * dpi / 72.0;
|
|
473 | + loadFlags_ |= FT_LOAD_NO_HINTING;
|
|
474 | + |
|
475 | + if (antiAliasingTarget_ == FT_LOAD_TARGET_MONO)
|
|
476 | + loadFlags_ |= FT_LOAD_MONOCHROME;
|
|
542 | 477 | }
|
543 | 478 | |
544 | - doHinting = gui->hintingCheckBox->isChecked();
|
|
479 | + // XXX handle color fonts also
|
|
545 | 480 | |
546 | - doAutoHinting = gui->autoHintingCheckBox->isChecked();
|
|
547 | - doHorizontalHinting = gui->horizontalHintingCheckBox->isChecked();
|
|
548 | - doVerticalHinting = gui->verticalHintingCheckBox->isChecked();
|
|
549 | - doBlueZoneHinting = gui->blueZoneHintingCheckBox->isChecked();
|
|
550 | - showSegments = gui->segmentDrawingCheckBox->isChecked();
|
|
481 | + scaler_.pixel = 0; // use 26.6 format
|
|
551 | 482 | |
552 | - gamma = gui->gammaSlider->value();
|
|
483 | + if (usingPixelSize_)
|
|
484 | + {
|
|
485 | + scaler_.width = static_cast<unsigned int>(pixelSize_ * 64.0);
|
|
486 | + scaler_.height = static_cast<unsigned int>(pixelSize_ * 64.0);
|
|
487 | + scaler_.x_res = 0;
|
|
488 | + scaler_.y_res = 0;
|
|
489 | + }
|
|
490 | + else
|
|
491 | + {
|
|
492 | + scaler_.width = static_cast<unsigned int>(pointSize_ * 64.0);
|
|
493 | + scaler_.height = static_cast<unsigned int>(pointSize_ * 64.0);
|
|
494 | + scaler_.x_res = dpi_;
|
|
495 | + scaler_.y_res = dpi_;
|
|
496 | + }
|
|
497 | +}
|
|
553 | 498 | |
554 | - loadFlags = FT_LOAD_DEFAULT;
|
|
555 | - if (doAutoHinting)
|
|
556 | - loadFlags |= FT_LOAD_FORCE_AUTOHINT;
|
|
557 | - loadFlags |= FT_LOAD_NO_BITMAP; // XXX handle bitmap fonts also
|
|
558 | 499 | |
559 | - int index = gui->antiAliasingComboBoxx->currentIndex();
|
|
500 | +void
|
|
501 | +Engine::queryEngine()
|
|
502 | +{
|
|
503 | + FT_Error error;
|
|
560 | 504 | |
561 | - if (doHinting)
|
|
562 | - {
|
|
563 | - unsigned long target;
|
|
505 | + // query engines and check for alternatives
|
|
564 | 506 | |
565 | - if (index == MainGUI::AntiAliasing_None)
|
|
566 | - target = FT_LOAD_TARGET_MONO;
|
|
567 | - else
|
|
507 | + // CFF
|
|
508 | + error = FT_Property_Get(library_,
|
|
509 | + "cff",
|
|
510 | + "hinting-engine",
|
|
511 | + &engineDefaults_.cffHintingEngineDefault);
|
|
512 | + if (error)
|
|
513 | + {
|
|
514 | + // no CFF engine
|
|
515 | + engineDefaults_.cffHintingEngineDefault = -1;
|
|
516 | + engineDefaults_.cffHintingEngineOther = -1;
|
|
517 | + }
|
|
518 | + else
|
|
519 | + {
|
|
520 | + int engines[] =
|
|
568 | 521 | {
|
569 | - switch (index)
|
|
570 | - {
|
|
571 | - case MainGUI::AntiAliasing_Light:
|
|
572 | - target = FT_LOAD_TARGET_LIGHT;
|
|
573 | - break;
|
|
522 | + FT_HINTING_FREETYPE,
|
|
523 | + FT_HINTING_ADOBE
|
|
524 | + };
|
|
574 | 525 | |
575 | - case MainGUI::AntiAliasing_LCD:
|
|
576 | - case MainGUI::AntiAliasing_LCD_BGR:
|
|
577 | - target = FT_LOAD_TARGET_LCD;
|
|
526 | + int i;
|
|
527 | + for (i = 0; i < 2; i++)
|
|
528 | + if (engineDefaults_.cffHintingEngineDefault == engines[i])
|
|
578 | 529 | break;
|
579 | 530 | |
580 | - case MainGUI::AntiAliasing_LCD_Vertical:
|
|
581 | - case MainGUI::AntiAliasing_LCD_Vertical_BGR:
|
|
582 | - target = FT_LOAD_TARGET_LCD_V;
|
|
583 | - break;
|
|
531 | + engineDefaults_.cffHintingEngineOther = engines[(i + 1) % 2];
|
|
584 | 532 | |
585 | - default:
|
|
586 | - target = FT_LOAD_TARGET_NORMAL;
|
|
587 | - }
|
|
588 | - }
|
|
533 | + error = FT_Property_Set(library_,
|
|
534 | + "cff",
|
|
535 | + "hinting-engine",
|
|
536 | + &engineDefaults_.cffHintingEngineOther);
|
|
537 | + if (error)
|
|
538 | + engineDefaults_.cffHintingEngineOther = -1;
|
|
589 | 539 | |
590 | - loadFlags |= target;
|
|
540 | + // reset
|
|
541 | + FT_Property_Set(library_,
|
|
542 | + "cff",
|
|
543 | + "hinting-engine",
|
|
544 | + &engineDefaults_.cffHintingEngineDefault);
|
|
545 | + }
|
|
546 | + |
|
547 | + // TrueType
|
|
548 | + error = FT_Property_Get(library_,
|
|
549 | + "truetype",
|
|
550 | + "interpreter-version",
|
|
551 | + &engineDefaults_.ttInterpreterVersionDefault);
|
|
552 | + if (error)
|
|
553 | + {
|
|
554 | + // no TrueType engine
|
|
555 | + engineDefaults_.ttInterpreterVersionDefault = -1;
|
|
556 | + engineDefaults_.ttInterpreterVersionOther = -1;
|
|
557 | + engineDefaults_.ttInterpreterVersionOther1 = -1;
|
|
591 | 558 | }
|
592 | 559 | else
|
593 | 560 | {
|
594 | - loadFlags |= FT_LOAD_NO_HINTING;
|
|
561 | + int interpreters[] =
|
|
562 | + {
|
|
563 | + TT_INTERPRETER_VERSION_35,
|
|
564 | + TT_INTERPRETER_VERSION_38,
|
|
565 | + TT_INTERPRETER_VERSION_40
|
|
566 | + };
|
|
595 | 567 | |
596 | - if (index == MainGUI::AntiAliasing_None)
|
|
597 | - loadFlags |= FT_LOAD_MONOCHROME;
|
|
598 | - }
|
|
568 | + int i;
|
|
569 | + for (i = 0; i < 3; i++)
|
|
570 | + if (engineDefaults_.ttInterpreterVersionDefault == interpreters[i])
|
|
571 | + break;
|
|
599 | 572 | |
600 | - // XXX handle color fonts also
|
|
573 | + engineDefaults_.ttInterpreterVersionOther = interpreters[(i + 1) % 3];
|
|
601 | 574 | |
602 | - scaler.pixel = 0; // use 26.6 format
|
|
575 | + error = FT_Property_Set(library_,
|
|
576 | + "truetype",
|
|
577 | + "interpreter-version",
|
|
578 | + &engineDefaults_.ttInterpreterVersionOther);
|
|
579 | + if (error)
|
|
580 | + engineDefaults_.ttInterpreterVersionOther = -1;
|
|
603 | 581 | |
604 | - if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px)
|
|
605 | - {
|
|
606 | - scaler.width = static_cast<unsigned int>(pixelSize * 64.0);
|
|
607 | - scaler.height = static_cast<unsigned int>(pixelSize * 64.0);
|
|
608 | - scaler.x_res = 0;
|
|
609 | - scaler.y_res = 0;
|
|
610 | - }
|
|
611 | - else
|
|
612 | - {
|
|
613 | - scaler.width = static_cast<unsigned int>(pointSize * 64.0);
|
|
614 | - scaler.height = static_cast<unsigned int>(pointSize * 64.0);
|
|
615 | - scaler.x_res = dpi;
|
|
616 | - scaler.y_res = dpi;
|
|
582 | + engineDefaults_.ttInterpreterVersionOther1 = interpreters[(i + 2) % 3];
|
|
583 | + |
|
584 | + error = FT_Property_Set(library_,
|
|
585 | + "truetype",
|
|
586 | + "interpreter-version",
|
|
587 | + &engineDefaults_.ttInterpreterVersionOther1);
|
|
588 | + if (error)
|
|
589 | + engineDefaults_.ttInterpreterVersionOther1 = -1;
|
|
590 | + |
|
591 | + // reset
|
|
592 | + FT_Property_Set(library_,
|
|
593 | + "truetype",
|
|
594 | + "interpreter-version",
|
|
595 | + &engineDefaults_.ttInterpreterVersionDefault);
|
|
617 | 596 | }
|
618 | 597 | }
|
619 | 598 | |
620 | - |
|
621 | 599 | // end of engine.cpp |
... | ... | @@ -5,6 +5,8 @@ |
5 | 5 | |
6 | 6 | #pragma once
|
7 | 7 | |
8 | +#include "fontfilemanager.hpp"
|
|
9 | + |
|
8 | 10 | #include <QString>
|
9 | 11 | #include <QMap>
|
10 | 12 | |
... | ... | @@ -12,6 +14,7 @@ |
12 | 14 | #include <freetype/freetype.h>
|
13 | 15 | #include <freetype/ftoutln.h>
|
14 | 16 | #include <freetype/ftcache.h>
|
17 | +#include <freetype/ftlcdfil.h>
|
|
15 | 18 | |
16 | 19 | |
17 | 20 | // This structure maps the (font, face, instance) index triplet to abstract
|
... | ... | @@ -33,87 +36,151 @@ struct FaceID |
33 | 36 | bool operator<(const FaceID& other) const;
|
34 | 37 | };
|
35 | 38 | |
36 | - |
|
37 | -class MainGUI;
|
|
38 | - |
|
39 | 39 | // FreeType specific data.
|
40 | 40 | |
41 | 41 | class Engine
|
42 | 42 | {
|
43 | 43 | public:
|
44 | - Engine(MainGUI*);
|
|
44 | + //////// Nested definitions (forward decl)
|
|
45 | + enum FontType : int;
|
|
46 | + |
|
47 | + struct EngineDefaultValues
|
|
48 | + {
|
|
49 | + int cffHintingEngineDefault;
|
|
50 | + int cffHintingEngineOther;
|
|
51 | + |
|
52 | + int ttInterpreterVersionDefault;
|
|
53 | + int ttInterpreterVersionOther;
|
|
54 | + int ttInterpreterVersionOther1;
|
|
55 | + };
|
|
56 | + |
|
57 | + //////// Ctors & Dtors
|
|
58 | + |
|
59 | + Engine();
|
|
45 | 60 | ~Engine();
|
46 | 61 | |
47 | - const QString& currentFamilyName();
|
|
48 | - const QString& currentStyleName();
|
|
49 | - QString glyphName(int glyphIndex);
|
|
50 | - long numberOfFaces(int fontIndex);
|
|
51 | - int numberOfNamedInstances(int fontIndex,
|
|
52 | - long faceIndex);
|
|
62 | + // Disable copying
|
|
63 | + Engine(const Engine& other) = delete;
|
|
64 | + Engine& operator=(const Engine& other) = delete;
|
|
65 | + |
|
66 | + //////// Actions
|
|
67 | + |
|
53 | 68 | int loadFont(int fontIndex,
|
54 | 69 | long faceIndex,
|
55 | 70 | int namedInstanceIndex); // return number of glyphs
|
56 | 71 | FT_Outline* loadOutline(int glyphIndex);
|
57 | - void removeFont(int fontIndex);
|
|
72 | + |
|
73 | + void openFonts(QStringList fontFileNames);
|
|
74 | + void removeFont(int fontIndex, bool closeFile = true);
|
|
75 | +
|
|
76 | + void update();
|
|
77 | + |
|
78 | + //////// Getters
|
|
79 | + |
|
80 | + FT_Library ftLibrary() const { return library_; }
|
|
81 | + int currentFontType() const { return fontType_; }
|
|
82 | + const QString& currentFamilyName() { return curFamilyName_; }
|
|
83 | + const QString& currentStyleName() { return curStyleName_; }
|
|
84 | + int numberOfOpenedFonts();
|
|
85 | + QString glyphName(int glyphIndex);
|
|
86 | + long numberOfFaces(int fontIndex);
|
|
87 | + int numberOfNamedInstances(int fontIndex,
|
|
88 | + long faceIndex);
|
|
89 | + |
|
90 | + // XXX We should prepend '_' to all private member variable so we can create
|
|
91 | + // getter without naming conflict... e.g. var named _fontFileManager while
|
|
92 | + // getter named fontFileManager
|
|
93 | + FontFileManager& fontFileManager() { return fontFileManager_; }
|
|
94 | + EngineDefaultValues& engineDefaults() { return engineDefaults_; }
|
|
95 | + |
|
96 | + //////// Setters (direct or indirect)
|
|
97 | + |
|
98 | + void setDPI(int d) { dpi_ = d; }
|
|
99 | + void setSizeByPixel(double pixelSize);
|
|
100 | + void setSizeByPoint(double pointSize);
|
|
101 | + void setHinting(bool hinting) { doHinting_ = hinting; }
|
|
102 | + void setAutoHinting(bool autoHinting) { doAutoHinting_ = autoHinting; }
|
|
103 | + void setHorizontalHinting(bool horHinting)
|
|
104 | + {
|
|
105 | + doHorizontalHinting_ = horHinting;
|
|
106 | + }
|
|
107 | + void setVerticalHinting(bool verticalHinting)
|
|
108 | + {
|
|
109 | + doVerticalHinting_ = verticalHinting;
|
|
110 | + }
|
|
111 | + void setBlueZoneHinting(bool blueZoneHinting)
|
|
112 | + {
|
|
113 | + doBlueZoneHinting_ = blueZoneHinting;
|
|
114 | + }
|
|
115 | + void setShowSegments(bool showSegments) { showSegments_ = showSegments; }
|
|
116 | + void setGamma(double gamma) { gamma_ = gamma; }
|
|
117 | + void setAntiAliasingTarget(int target) { antiAliasingTarget_ = target; }
|
|
118 | + |
|
119 | + // Note: These 3 functions now takes actual mode/version from FreeType,
|
|
120 | + // instead of values from enum in MainGUI!
|
|
121 | + void setLcdFilter(FT_LcdFilter filter);
|
|
58 | 122 | void setCFFHintingMode(int mode);
|
59 | 123 | void setTTInterpreterVersion(int version);
|
60 | - void update();
|
|
61 | 124 | |
62 | - friend class MainGUI;
|
|
125 | + //////// Misc
|
|
126 | + |
|
63 | 127 | friend FT_Error faceRequester(FTC_FaceID,
|
64 | 128 | FT_Library,
|
65 | 129 | FT_Pointer,
|
66 | 130 | FT_Face*);
|
67 | 131 | |
68 | - // XXX cover all available modules
|
|
69 | - enum FontType
|
|
70 | - {
|
|
71 | - FontType_CFF,
|
|
72 | - FontType_TrueType,
|
|
73 | - FontType_Other
|
|
74 | - };
|
|
75 | - |
|
76 | 132 | private:
|
77 | - MainGUI* gui;
|
|
78 | - |
|
79 | 133 | using FTC_IDType = uintptr_t;
|
80 | - FTC_IDType faceCounter; // a running number used to initialize `faceIDMap'
|
|
81 | - QMap<FaceID, FTC_IDType> faceIDMap;
|
|
134 | + FTC_IDType faceCounter_; // a running number used to initialize `faceIDMap'
|
|
135 | + QMap<FaceID, FTC_IDType> faceIDMap_;
|
|
136 | + |
|
137 | + FontFileManager fontFileManager_;
|
|
82 | 138 | |
83 | - QString curFamilyName;
|
|
84 | - QString curStyleName;
|
|
139 | + QString curFamilyName_;
|
|
140 | + QString curStyleName_;
|
|
85 | 141 | |
86 | - FT_Library library;
|
|
87 | - FTC_Manager cacheManager;
|
|
88 | - FTC_ImageCache imageCache;
|
|
89 | - FTC_SBitCache sbitsCache;
|
|
142 | + FT_Library library_;
|
|
143 | + FTC_Manager cacheManager_;
|
|
144 | + FTC_ImageCache imageCache_;
|
|
145 | + FTC_SBitCache sbitsCache_;
|
|
90 | 146 | |
91 | - FTC_ScalerRec scaler;
|
|
92 | - FT_Size ftSize;
|
|
147 | + FTC_ScalerRec scaler_;
|
|
148 | + FT_Size ftSize_;
|
|
93 | 149 | |
94 | - int cffHintingEngineDefault;
|
|
95 | - int cffHintingEngineOther;
|
|
150 | + EngineDefaultValues engineDefaults_;
|
|
96 | 151 | |
97 | - int ttInterpreterVersionDefault;
|
|
98 | - int ttInterpreterVersionOther;
|
|
99 | - int ttInterpreterVersionOther1;
|
|
152 | + int fontType_;
|
|
100 | 153 | |
101 | - int fontType;
|
|
154 | + bool usingPixelSize_ = false;
|
|
155 | + double pointSize_;
|
|
156 | + double pixelSize_;
|
|
157 | + unsigned int dpi_;
|
|
102 | 158 | |
103 | - double pointSize;
|
|
104 | - double pixelSize;
|
|
105 | - unsigned int dpi;
|
|
159 | + bool doHinting_;
|
|
160 | + bool doAutoHinting_;
|
|
161 | + bool doHorizontalHinting_;
|
|
162 | + bool doVerticalHinting_;
|
|
163 | + bool doBlueZoneHinting_;
|
|
164 | + bool showSegments_;
|
|
165 | + int antiAliasingTarget_;
|
|
106 | 166 | |
107 | - bool doHinting;
|
|
108 | - bool doAutoHinting;
|
|
109 | - bool doHorizontalHinting;
|
|
110 | - bool doVerticalHinting;
|
|
111 | - bool doBlueZoneHinting;
|
|
112 | - bool showSegments;
|
|
167 | + double gamma_;
|
|
113 | 168 | |
114 | - double gamma;
|
|
169 | + unsigned long loadFlags_;
|
|
115 | 170 | |
116 | - unsigned long loadFlags;
|
|
171 | + void queryEngine();
|
|
172 | + |
|
173 | +public:
|
|
174 | + |
|
175 | + /// Actual definition
|
|
176 | + |
|
177 | + // XXX cover all available modules
|
|
178 | + enum FontType
|
|
179 | + {
|
|
180 | + FontType_CFF,
|
|
181 | + FontType_TrueType,
|
|
182 | + FontType_Other
|
|
183 | + };
|
|
117 | 184 | };
|
118 | 185 | |
119 | 186 |
1 | +// fontfilemanager.cpp
|
|
2 | + |
|
3 | +// Copyright (C) 2022 by Charlie Jiang.
|
|
4 | + |
|
5 | + |
|
6 | +#include "fontfilemanager.hpp"
|
|
7 | + |
|
8 | +FontFileManager::FontFileManager()
|
|
9 | +{
|
|
10 | + fontWatcher_ = new QFileSystemWatcher(this);
|
|
11 | + // if the current input file is invalid we retry once a second to load it
|
|
12 | + watchTimer_ = new QTimer;
|
|
13 | + watchTimer_->setInterval(1000);
|
|
14 | + |
|
15 | + connect(fontWatcher_, &QFileSystemWatcher::fileChanged,
|
|
16 | + this, &FontFileManager::onTimerOrWatcherFire);
|
|
17 | + connect(watchTimer_, &QTimer::timeout,
|
|
18 | + this, &FontFileManager::onTimerOrWatcherFire);
|
|
19 | +}
|
|
20 | + |
|
21 | + |
|
22 | +FontFileManager::~FontFileManager()
|
|
23 | +{
|
|
24 | +}
|
|
25 | + |
|
26 | + |
|
27 | +int
|
|
28 | +FontFileManager::size()
|
|
29 | +{
|
|
30 | + return fontFileNameList_.size();
|
|
31 | +}
|
|
32 | + |
|
33 | + |
|
34 | +void
|
|
35 | +FontFileManager::append(QStringList newFileNames)
|
|
36 | +{
|
|
37 | + for (auto& name : newFileNames)
|
|
38 | + {
|
|
39 | + auto info = QFileInfo(name);
|
|
40 | + |
|
41 | + // Filter non-file elements
|
|
42 | + if (!info.isFile())
|
|
43 | + continue;
|
|
44 | + |
|
45 | + // Uniquify elements
|
|
46 | + auto absPath = info.absoluteFilePath();
|
|
47 | + auto existing = false;
|
|
48 | + for (auto& existingName : fontFileNameList_)
|
|
49 | + if (existingName.absoluteFilePath() == absPath)
|
|
50 | + {
|
|
51 | + existing = true;
|
|
52 | + break;
|
|
53 | + }
|
|
54 | + if (existing)
|
|
55 | + continue;
|
|
56 | + |
|
57 | + fontFileNameList_.append(info);
|
|
58 | + }
|
|
59 | +}
|
|
60 | + |
|
61 | + |
|
62 | +void
|
|
63 | +FontFileManager::remove(int index)
|
|
64 | +{
|
|
65 | + if (index < 0 || index >= size())
|
|
66 | + return;
|
|
67 | + |
|
68 | + fontWatcher_->removePath(fontFileNameList_[index].filePath());
|
|
69 | + fontFileNameList_.removeAt(index);
|
|
70 | +}
|
|
71 | + |
|
72 | + |
|
73 | +QFileInfo&
|
|
74 | +FontFileManager::operator[](int index)
|
|
75 | +{
|
|
76 | + return fontFileNameList_[index];
|
|
77 | +}
|
|
78 | + |
|
79 | + |
|
80 | +void
|
|
81 | +FontFileManager::updateWatching(int index)
|
|
82 | +{
|
|
83 | + QFileInfo& fileInfo = fontFileNameList_[index];
|
|
84 | + |
|
85 | + auto watching = fontWatcher_->files();
|
|
86 | + if (!watching.empty())
|
|
87 | + fontWatcher_->removePaths(watching);
|
|
88 | + |
|
89 | + // Qt's file watcher doesn't handle symlinks;
|
|
90 | + // we thus fall back to polling
|
|
91 | + if (fileInfo.isSymLink() || !fileInfo.exists())
|
|
92 | + watchTimer_->start();
|
|
93 | + else
|
|
94 | + fontWatcher_->addPath(fileInfo.filePath());
|
|
95 | +}
|
|
96 | + |
|
97 | + |
|
98 | +void
|
|
99 | +FontFileManager::timerStart()
|
|
100 | +{
|
|
101 | + watchTimer_->start();
|
|
102 | +}
|
|
103 | + |
|
104 | + |
|
105 | +void
|
|
106 | +FontFileManager::onTimerOrWatcherFire()
|
|
107 | +{
|
|
108 | + watchTimer_->stop();
|
|
109 | + emit currentFileChanged();
|
|
110 | +}
|
|
111 | + |
|
112 | + |
|
113 | +// end of fontfilemanager.hpp |
1 | +// fontfilemanager.hpp
|
|
2 | + |
|
3 | +// Copyright (C) 2022 by Charlie Jiang.
|
|
4 | + |
|
5 | +#pragma once
|
|
6 | + |
|
7 | +#include <QObject>
|
|
8 | +#include <QList>
|
|
9 | +#include <QFileSystemWatcher>
|
|
10 | +#include <QTimer>
|
|
11 | +#include <QFileInfo>
|
|
12 | + |
|
13 | + |
|
14 | +// Class to manage all opened font files, as well as monitoring local file
|
|
15 | +// change.
|
|
16 | + |
|
17 | +class FontFileManager
|
|
18 | +: public QObject
|
|
19 | +{
|
|
20 | + Q_OBJECT
|
|
21 | +public:
|
|
22 | + FontFileManager();
|
|
23 | + ~FontFileManager() override;
|
|
24 | + |
|
25 | + int size();
|
|
26 | + void append(QStringList newFileNames);
|
|
27 | + void remove(int index);
|
|
28 | + |
|
29 | + QFileInfo& operator[](int index);
|
|
30 | + void updateWatching(int index);
|
|
31 | + void timerStart();
|
|
32 | + |
|
33 | +signals:
|
|
34 | + void currentFileChanged();
|
|
35 | + |
|
36 | +private slots:
|
|
37 | + void onTimerOrWatcherFire();
|
|
38 | + |
|
39 | +private:
|
|
40 | + QList<QFileInfo> fontFileNameList_;
|
|
41 | + QFileSystemWatcher* fontWatcher_;
|
|
42 | + QTimer* watchTimer_;
|
|
43 | +};
|
|
44 | + |
|
45 | + |
|
46 | +// end of fontfilemanager.hpp |
... | ... | @@ -22,7 +22,7 @@ main(int argc, |
22 | 22 | app.setOrganizationDomain("freetype.org");
|
23 | 23 | |
24 | 24 | MainGUI gui;
|
25 | - Engine engine(&gui);
|
|
25 | + Engine engine;
|
|
26 | 26 | |
27 | 27 | gui.update(&engine);
|
28 | 28 | gui.setDefaults();
|
... | ... | @@ -7,7 +7,6 @@ |
7 | 7 | #include "rendering/grid.hpp"
|
8 | 8 | |
9 | 9 | #include <QApplication>
|
10 | -#include <QDir>
|
|
11 | 10 | #include <QFileDialog>
|
12 | 11 | #include <QMessageBox>
|
13 | 12 | #include <QSettings>
|
... | ... | @@ -17,12 +16,7 @@ |
17 | 16 | |
18 | 17 | MainGUI::MainGUI()
|
19 | 18 | {
|
20 | - engine = NULL;
|
|
21 | - |
|
22 | - fontWatcher = new QFileSystemWatcher;
|
|
23 | - // if the current input file is invalid we retry once a second to load it
|
|
24 | - timer = new QTimer;
|
|
25 | - timer->setInterval(1000);
|
|
19 | + engine_ = NULL;
|
|
26 | 20 | |
27 | 21 | setGraphicsDefaults();
|
28 | 22 | createLayout();
|
... | ... | @@ -46,7 +40,13 @@ MainGUI::~MainGUI() |
46 | 40 | void
|
47 | 41 | MainGUI::update(Engine* e)
|
48 | 42 | {
|
49 | - engine = e;
|
|
43 | + if (engine_)
|
|
44 | + disconnect(&engine_->fontFileManager(), &FontFileManager::currentFileChanged,
|
|
45 | + this, &MainGUI::watchCurrentFont);
|
|
46 | + |
|
47 | + engine_ = e;
|
|
48 | + connect(&engine_->fontFileManager(), &FontFileManager::currentFileChanged,
|
|
49 | + this, &MainGUI::watchCurrentFont);
|
|
50 | 50 | }
|
51 | 51 | |
52 | 52 | |
... | ... | @@ -94,7 +94,7 @@ MainGUI::aboutQt() |
94 | 94 | void
|
95 | 95 | MainGUI::loadFonts()
|
96 | 96 | {
|
97 | - int oldSize = fontList.size();
|
|
97 | + int oldSize = engine_->numberOfOpenedFonts();
|
|
98 | 98 | |
99 | 99 | QStringList files = QFileDialog::getOpenFileNames(
|
100 | 100 | this,
|
... | ... | @@ -104,12 +104,11 @@ MainGUI::loadFonts() |
104 | 104 | NULL,
|
105 | 105 | QFileDialog::ReadOnly);
|
106 | 106 | |
107 | - // XXX sort data, uniquify elements
|
|
108 | - fontList.append(files);
|
|
107 | + engine_->openFonts(files);
|
|
109 | 108 | |
110 | 109 | // if we have new fonts, set the current index to the first new one
|
111 | - if (oldSize < fontList.size())
|
|
112 | - currentFontIndex = oldSize;
|
|
110 | + if (oldSize < engine_->numberOfOpenedFonts())
|
|
111 | + currentFontIndex_ = oldSize;
|
|
113 | 112 | |
114 | 113 | showFont();
|
115 | 114 | }
|
... | ... | @@ -118,21 +117,20 @@ MainGUI::loadFonts() |
118 | 117 | void
|
119 | 118 | MainGUI::closeFont()
|
120 | 119 | {
|
121 | - if (currentFontIndex < fontList.size())
|
|
120 | + if (currentFontIndex_ < engine_->numberOfOpenedFonts())
|
|
122 | 121 | {
|
123 | - engine->removeFont(currentFontIndex);
|
|
124 | - fontWatcher->removePath(fontList[currentFontIndex]);
|
|
125 | - fontList.removeAt(currentFontIndex);
|
|
122 | + engine_->removeFont(currentFontIndex_);
|
|
126 | 123 | }
|
127 | 124 | |
128 | 125 | // show next font after deletion, i.e., retain index if possible
|
129 | - if (fontList.size())
|
|
126 | + int num = engine_->numberOfOpenedFonts();
|
|
127 | + if (num)
|
|
130 | 128 | {
|
131 | - if (currentFontIndex >= fontList.size())
|
|
132 | - currentFontIndex = fontList.size() - 1;
|
|
129 | + if (currentFontIndex_ >= num)
|
|
130 | + currentFontIndex_ = num - 1;
|
|
133 | 131 | }
|
134 | 132 | else
|
135 | - currentFontIndex = 0;
|
|
133 | + currentFontIndex_ = 0;
|
|
136 | 134 | |
137 | 135 | showFont();
|
138 | 136 | }
|
... | ... | @@ -141,7 +139,6 @@ MainGUI::closeFont() |
141 | 139 | void
|
142 | 140 | MainGUI::watchCurrentFont()
|
143 | 141 | {
|
144 | - timer->stop();
|
|
145 | 142 | showFont();
|
146 | 143 | }
|
147 | 144 | |
... | ... | @@ -151,62 +148,57 @@ MainGUI::showFont() |
151 | 148 | {
|
152 | 149 | // we do lazy computation of FT_Face objects
|
153 | 150 | |
154 | - if (currentFontIndex < fontList.size())
|
|
151 | + if (currentFontIndex_ < engine_->numberOfOpenedFonts())
|
|
155 | 152 | {
|
156 | - QString& font = fontList[currentFontIndex];
|
|
157 | - QFileInfo fileInfo(font);
|
|
153 | + QFileInfo& fileInfo = engine_->fontFileManager()[currentFontIndex_];
|
|
158 | 154 | QString fontName = fileInfo.fileName();
|
159 | 155 | |
160 | - if (fileInfo.exists())
|
|
156 | + engine_->fontFileManager().updateWatching(currentFontIndex_);
|
|
157 | + if (fileInfo.isSymLink())
|
|
161 | 158 | {
|
162 | - // Qt's file watcher doesn't handle symlinks;
|
|
163 | - // we thus fall back to polling
|
|
164 | - if (fileInfo.isSymLink())
|
|
165 | - {
|
|
166 | - fontName.prepend("<i>");
|
|
167 | - fontName.append("</i>");
|
|
168 | - timer->start();
|
|
169 | - }
|
|
170 | - else
|
|
171 | - fontWatcher->addPath(font);
|
|
159 | + fontName.prepend("<i>");
|
|
160 | + fontName.append("</i>");
|
|
172 | 161 | }
|
173 | - else
|
|
162 | + |
|
163 | + if (!fileInfo.exists())
|
|
174 | 164 | {
|
175 | 165 | // On Unix-like systems, the symlink's target gets opened; this
|
176 | 166 | // implies that deletion of a symlink doesn't make `engine->loadFont'
|
177 | 167 | // fail since it operates on a file handle pointing to the target.
|
178 | 168 | // For this reason, we remove the font to enforce a reload.
|
179 | - engine->removeFont(currentFontIndex);
|
|
169 | + engine_->removeFont(currentFontIndex_, false);
|
|
180 | 170 | }
|
181 | 171 | |
182 | - fontFilenameLabel->setText(fontName);
|
|
172 | + fontFilenameLabel_->setText(fontName);
|
|
183 | 173 | }
|
184 | 174 | else
|
185 | - fontFilenameLabel->clear();
|
|
186 | - |
|
187 | - currentNumberOfFaces
|
|
188 | - = engine->numberOfFaces(currentFontIndex);
|
|
189 | - currentNumberOfNamedInstances
|
|
190 | - = engine->numberOfNamedInstances(currentFontIndex,
|
|
191 | - currentFaceIndex);
|
|
192 | - currentNumberOfGlyphs
|
|
193 | - = engine->loadFont(currentFontIndex,
|
|
194 | - currentFaceIndex,
|
|
195 | - currentNamedInstanceIndex);
|
|
196 | - |
|
197 | - if (currentNumberOfGlyphs < 0)
|
|
175 | + fontFilenameLabel_->clear();
|
|
176 | + |
|
177 | + syncSettings();
|
|
178 | + currentNumberOfFaces_
|
|
179 | + = engine_->numberOfFaces(currentFontIndex_);
|
|
180 | + currentNumberOfNamedInstances_
|
|
181 | + = engine_->numberOfNamedInstances(currentFontIndex_,
|
|
182 | + currentFaceIndex_);
|
|
183 | + currentNumberOfGlyphs_
|
|
184 | + = engine_->loadFont(currentFontIndex_,
|
|
185 | + currentFaceIndex_,
|
|
186 | + currentNamedInstanceIndex_);
|
|
187 | + |
|
188 | + if (currentNumberOfGlyphs_ < 0)
|
|
198 | 189 | {
|
199 | 190 | // there might be various reasons why the current
|
200 | 191 | // (file, face, instance) triplet is invalid or missing;
|
201 | 192 | // we thus start our timer to periodically test
|
202 | 193 | // whether the font starts working
|
203 | - if (currentFontIndex < fontList.size())
|
|
204 | - timer->start();
|
|
194 | + if (currentFontIndex_ > 0
|
|
195 | + && currentFontIndex_ < engine_->numberOfOpenedFonts())
|
|
196 | + engine_->fontFileManager().timerStart();
|
|
205 | 197 | }
|
206 | 198 | |
207 | - fontNameLabel->setText(QString("%1 %2")
|
|
208 | - .arg(engine->currentFamilyName())
|
|
209 | - .arg(engine->currentStyleName()));
|
|
199 | + fontNameLabel_->setText(QString("%1 %2")
|
|
200 | + .arg(engine_->currentFamilyName())
|
|
201 | + .arg(engine_->currentStyleName()));
|
|
210 | 202 | |
211 | 203 | checkCurrentFontIndex();
|
212 | 204 | checkCurrentFaceIndex();
|
... | ... | @@ -218,60 +210,81 @@ MainGUI::showFont() |
218 | 210 | }
|
219 | 211 | |
220 | 212 | |
213 | +void
|
|
214 | +MainGUI::syncSettings()
|
|
215 | +{
|
|
216 | + // Spinbox value cannot become negative
|
|
217 | + engine_->setDPI(static_cast<unsigned int>(dpiSpinBox_->value()));
|
|
218 | + |
|
219 | + if (unitsComboBox_->currentIndex() == Units_px)
|
|
220 | + engine_->setSizeByPixel(sizeDoubleSpinBox_->value());
|
|
221 | + else
|
|
222 | + engine_->setSizeByPoint(sizeDoubleSpinBox_->value());
|
|
223 | + |
|
224 | + engine_->setHinting(hintingCheckBox_->isChecked());
|
|
225 | + engine_->setAutoHinting(autoHintingCheckBox_->isChecked());
|
|
226 | + engine_->setHorizontalHinting(horizontalHintingCheckBox_->isChecked());
|
|
227 | + engine_->setVerticalHinting(verticalHintingCheckBox_->isChecked());
|
|
228 | + engine_->setBlueZoneHinting(blueZoneHintingCheckBox_->isChecked());
|
|
229 | + engine_->setShowSegments(segmentDrawingCheckBox_->isChecked());
|
|
230 | + |
|
231 | + engine_->setGamma(gammaSlider_->value());
|
|
232 | + |
|
233 | + engine_->setAntiAliasingTarget(antiAliasingComboBoxModel_->indexToValue(
|
|
234 | + antiAliasingComboBox_->currentIndex()));
|
|
235 | +}
|
|
236 | + |
|
237 | + |
|
238 | +void
|
|
239 | +MainGUI::clearStatusBar()
|
|
240 | +{
|
|
241 | + statusBar()->clearMessage();
|
|
242 | + statusBar()->setStyleSheet("");
|
|
243 | +}
|
|
244 | + |
|
245 | + |
|
221 | 246 | void
|
222 | 247 | MainGUI::checkHinting()
|
223 | 248 | {
|
224 | - if (hintingCheckBox->isChecked())
|
|
249 | + if (hintingCheckBox_->isChecked())
|
|
225 | 250 | {
|
226 | - if (engine->fontType == Engine::FontType_CFF)
|
|
251 | + if (engine_->currentFontType() == Engine::FontType_CFF)
|
|
227 | 252 | {
|
228 | - for (int i = 0; i < hintingModeComboBoxx->count(); i++)
|
|
229 | - {
|
|
230 | - if (hintingModesCFFHash.key(i, -1) != -1)
|
|
231 | - hintingModeComboBoxx->setItemEnabled(i, true);
|
|
232 | - else
|
|
233 | - hintingModeComboBoxx->setItemEnabled(i, false);
|
|
234 | - }
|
|
235 | - |
|
236 | - hintingModeComboBoxx->setCurrentIndex(currentCFFHintingMode);
|
|
253 | + hintingModeComboBoxModel_->setCurrentEngineType(
|
|
254 | + HintingModeComboBoxModel::HintingEngineType_CFF);
|
|
255 | + hintingModeComboBox_->setCurrentIndex(currentCFFHintingMode_);
|
|
237 | 256 | }
|
238 | - else if (engine->fontType == Engine::FontType_TrueType)
|
|
257 | + else if (engine_->currentFontType() == Engine::FontType_TrueType)
|
|
239 | 258 | {
|
240 | - for (int i = 0; i < hintingModeComboBoxx->count(); i++)
|
|
241 | - {
|
|
242 | - if (hintingModesTrueTypeHash.key(i, -1) != -1)
|
|
243 | - hintingModeComboBoxx->setItemEnabled(i, true);
|
|
244 | - else
|
|
245 | - hintingModeComboBoxx->setItemEnabled(i, false);
|
|
246 | - }
|
|
247 | - |
|
248 | - hintingModeComboBoxx->setCurrentIndex(currentTTInterpreterVersion);
|
|
259 | + hintingModeComboBoxModel_->setCurrentEngineType(
|
|
260 | + HintingModeComboBoxModel::HintingEngineType_TrueType);
|
|
261 | + hintingModeComboBox_->setCurrentIndex(currentTTInterpreterVersion_);
|
|
249 | 262 | }
|
250 | 263 | else
|
251 | 264 | {
|
252 | - hintingModeLabel->setEnabled(false);
|
|
253 | - hintingModeComboBoxx->setEnabled(false);
|
|
265 | + hintingModeLabel_->setEnabled(false);
|
|
266 | + hintingModeComboBox_->setEnabled(false);
|
|
254 | 267 | }
|
255 | 268 | |
256 | - for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++)
|
|
257 | - hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i],
|
|
258 | - false);
|
|
259 | - |
|
260 | - autoHintingCheckBox->setEnabled(true);
|
|
269 | + autoHintingCheckBox_->setEnabled(true);
|
|
261 | 270 | checkAutoHinting();
|
262 | 271 | }
|
263 | 272 | else
|
264 | 273 | {
|
265 | - hintingModeLabel->setEnabled(false);
|
|
266 | - hintingModeComboBoxx->setEnabled(false);
|
|
267 | - |
|
268 | - autoHintingCheckBox->setEnabled(false);
|
|
269 | - horizontalHintingCheckBox->setEnabled(false);
|
|
270 | - verticalHintingCheckBox->setEnabled(false);
|
|
271 | - blueZoneHintingCheckBox->setEnabled(false);
|
|
272 | - segmentDrawingCheckBox->setEnabled(false);
|
|
273 | - |
|
274 | - antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, false);
|
|
274 | + hintingModeLabel_->setEnabled(false);
|
|
275 | + hintingModeComboBox_->setEnabled(false);
|
|
276 | + |
|
277 | + autoHintingCheckBox_->setEnabled(false);
|
|
278 | + horizontalHintingCheckBox_->setEnabled(false);
|
|
279 | + verticalHintingCheckBox_->setEnabled(false);
|
|
280 | + blueZoneHintingCheckBox_->setEnabled(false);
|
|
281 | + segmentDrawingCheckBox_->setEnabled(false);
|
|
282 | + |
|
283 | + antiAliasingComboBoxModel_->setLightAntiAliasingEnabled(false);
|
|
284 | + if (antiAliasingComboBox_->currentIndex()
|
|
285 | + == AntiAliasingComboBoxModel::AntiAliasing_Light)
|
|
286 | + antiAliasingComboBox_->setCurrentIndex(
|
|
287 | + AntiAliasingComboBoxModel::AntiAliasing_Normal);
|
|
275 | 288 | }
|
276 | 289 | |
277 | 290 | drawGlyph();
|
... | ... | @@ -281,17 +294,19 @@ MainGUI::checkHinting() |
281 | 294 | void
|
282 | 295 | MainGUI::checkHintingMode()
|
283 | 296 | {
|
284 | - int index = hintingModeComboBoxx->currentIndex();
|
|
297 | + int index = hintingModeComboBox_->currentIndex();
|
|
285 | 298 | |
286 | - if (engine->fontType == Engine::FontType_CFF)
|
|
299 | + if (engine_->currentFontType() == Engine::FontType_CFF)
|
|
287 | 300 | {
|
288 | - engine->setCFFHintingMode(index);
|
|
289 | - currentCFFHintingMode = index;
|
|
301 | + engine_->setCFFHintingMode(
|
|
302 | + hintingModeComboBoxModel_->indexToCFFMode(index));
|
|
303 | + currentCFFHintingMode_ = index;
|
|
290 | 304 | }
|
291 | - else if (engine->fontType == Engine::FontType_TrueType)
|
|
305 | + else if (engine_->currentFontType() == Engine::FontType_TrueType)
|
|
292 | 306 | {
|
293 | - engine->setTTInterpreterVersion(index);
|
|
294 | - currentTTInterpreterVersion = index;
|
|
307 | + engine_->setTTInterpreterVersion(
|
|
308 | + hintingModeComboBoxModel_->indexToTTInterpreterVersion(index));
|
|
309 | + currentTTInterpreterVersion_ = index;
|
|
295 | 310 | }
|
296 | 311 | |
297 | 312 | // this enforces reloading of the font
|
... | ... | @@ -302,36 +317,38 @@ MainGUI::checkHintingMode() |
302 | 317 | void
|
303 | 318 | MainGUI::checkAutoHinting()
|
304 | 319 | {
|
305 | - if (autoHintingCheckBox->isChecked())
|
|
320 | + if (autoHintingCheckBox_->isChecked())
|
|
306 | 321 | {
|
307 | - hintingModeLabel->setEnabled(false);
|
|
308 | - hintingModeComboBoxx->setEnabled(false);
|
|
322 | + hintingModeLabel_->setEnabled(false);
|
|
323 | + hintingModeComboBox_->setEnabled(false);
|
|
309 | 324 | |
310 | - horizontalHintingCheckBox->setEnabled(true);
|
|
311 | - verticalHintingCheckBox->setEnabled(true);
|
|
312 | - blueZoneHintingCheckBox->setEnabled(true);
|
|
313 | - segmentDrawingCheckBox->setEnabled(true);
|
|
325 | + horizontalHintingCheckBox_->setEnabled(true);
|
|
326 | + verticalHintingCheckBox_->setEnabled(true);
|
|
327 | + blueZoneHintingCheckBox_->setEnabled(true);
|
|
328 | + segmentDrawingCheckBox_->setEnabled(true);
|
|
314 | 329 | |
315 | - antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, true);
|
|
330 | + antiAliasingComboBoxModel_->setLightAntiAliasingEnabled(true);
|
|
316 | 331 | }
|
317 | 332 | else
|
318 | 333 | {
|
319 | - if (engine->fontType == Engine::FontType_CFF
|
|
320 | - || engine->fontType == Engine::FontType_TrueType)
|
|
334 | + if (engine_->currentFontType() == Engine::FontType_CFF
|
|
335 | + || engine_->currentFontType() == Engine::FontType_TrueType)
|
|
321 | 336 | {
|
322 | - hintingModeLabel->setEnabled(true);
|
|
323 | - hintingModeComboBoxx->setEnabled(true);
|
|
337 | + hintingModeLabel_->setEnabled(true);
|
|
338 | + hintingModeComboBox_->setEnabled(true);
|
|
324 | 339 | }
|
325 | 340 | |
326 | - horizontalHintingCheckBox->setEnabled(false);
|
|
327 | - verticalHintingCheckBox->setEnabled(false);
|
|
328 | - blueZoneHintingCheckBox->setEnabled(false);
|
|
329 | - segmentDrawingCheckBox->setEnabled(false);
|
|
341 | + horizontalHintingCheckBox_->setEnabled(false);
|
|
342 | + verticalHintingCheckBox_->setEnabled(false);
|
|
343 | + blueZoneHintingCheckBox_->setEnabled(false);
|
|
344 | + segmentDrawingCheckBox_->setEnabled(false);
|
|
330 | 345 | |
331 | - antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, false);
|
|
346 | + antiAliasingComboBoxModel_->setLightAntiAliasingEnabled(false);
|
|
332 | 347 | |
333 | - if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_Light)
|
|
334 | - antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal);
|
|
348 | + if (antiAliasingComboBox_->currentIndex()
|
|
349 | + == AntiAliasingComboBoxModel::AntiAliasing_Light)
|
|
350 | + antiAliasingComboBox_->setCurrentIndex(
|
|
351 | + AntiAliasingComboBoxModel::AntiAliasing_Normal);
|
|
335 | 352 | }
|
336 | 353 | |
337 | 354 | drawGlyph();
|
... | ... | @@ -341,19 +358,19 @@ MainGUI::checkAutoHinting() |
341 | 358 | void
|
342 | 359 | MainGUI::checkAntiAliasing()
|
343 | 360 | {
|
344 | - int index = antiAliasingComboBoxx->currentIndex();
|
|
361 | + int index = antiAliasingComboBox_->currentIndex();
|
|
345 | 362 | |
346 | - if (index == AntiAliasing_None
|
|
347 | - || index == AntiAliasing_Normal
|
|
348 | - || index == AntiAliasing_Light)
|
|
363 | + if (index == AntiAliasingComboBoxModel::AntiAliasing_None
|
|
364 | + || index == AntiAliasingComboBoxModel::AntiAliasing::AntiAliasing_Normal
|
|
365 | + || index == AntiAliasingComboBoxModel::AntiAliasing_Light)
|
|
349 | 366 | {
|
350 | - lcdFilterLabel->setEnabled(false);
|
|
351 | - lcdFilterComboBox->setEnabled(false);
|
|
367 | + lcdFilterLabel_->setEnabled(false);
|
|
368 | + lcdFilterComboBox_->setEnabled(false);
|
|
352 | 369 | }
|
353 | 370 | else
|
354 | 371 | {
|
355 | - lcdFilterLabel->setEnabled(true);
|
|
356 | - lcdFilterComboBox->setEnabled(true);
|
|
372 | + lcdFilterLabel_->setEnabled(true);
|
|
373 | + lcdFilterComboBox_->setEnabled(true);
|
|
357 | 374 | }
|
358 | 375 | |
359 | 376 | drawGlyph();
|
... | ... | @@ -363,18 +380,19 @@ MainGUI::checkAntiAliasing() |
363 | 380 | void
|
364 | 381 | MainGUI::checkLcdFilter()
|
365 | 382 | {
|
366 | - int index = lcdFilterComboBox->currentIndex();
|
|
367 | - FT_Library_SetLcdFilter(engine->library, lcdFilterHash.key(index));
|
|
383 | + int index = lcdFilterComboBox_->currentIndex();
|
|
384 | + engine_->setLcdFilter(static_cast<FT_LcdFilter>(
|
|
385 | + lcdFilterComboboxModel_->indexToValue(index)));
|
|
368 | 386 | }
|
369 | 387 | |
370 | 388 | |
371 | 389 | void
|
372 | 390 | MainGUI::checkShowPoints()
|
373 | 391 | {
|
374 | - if (showPointsCheckBox->isChecked())
|
|
375 | - showPointNumbersCheckBox->setEnabled(true);
|
|
392 | + if (showPointsCheckBox_->isChecked())
|
|
393 | + showPointNumbersCheckBox_->setEnabled(true);
|
|
376 | 394 | else
|
377 | - showPointNumbersCheckBox->setEnabled(false);
|
|
395 | + showPointNumbersCheckBox_->setEnabled(false);
|
|
378 | 396 | |
379 | 397 | drawGlyph();
|
380 | 398 | }
|
... | ... | @@ -383,20 +401,20 @@ MainGUI::checkShowPoints() |
383 | 401 | void
|
384 | 402 | MainGUI::checkUnits()
|
385 | 403 | {
|
386 | - int index = unitsComboBox->currentIndex();
|
|
404 | + int index = unitsComboBox_->currentIndex();
|
|
387 | 405 | |
388 | 406 | if (index == Units_px)
|
389 | 407 | {
|
390 | - dpiLabel->setEnabled(false);
|
|
391 | - dpiSpinBox->setEnabled(false);
|
|
392 | - sizeDoubleSpinBox->setSingleStep(1);
|
|
393 | - sizeDoubleSpinBox->setValue(qRound(sizeDoubleSpinBox->value()));
|
|
408 | + dpiLabel_->setEnabled(false);
|
|
409 | + dpiSpinBox_->setEnabled(false);
|
|
410 | + sizeDoubleSpinBox_->setSingleStep(1);
|
|
411 | + sizeDoubleSpinBox_->setValue(qRound(sizeDoubleSpinBox_->value()));
|
|
394 | 412 | }
|
395 | 413 | else
|
396 | 414 | {
|
397 | - dpiLabel->setEnabled(true);
|
|
398 | - dpiSpinBox->setEnabled(true);
|
|
399 | - sizeDoubleSpinBox->setSingleStep(0.5);
|
|
415 | + dpiLabel_->setEnabled(true);
|
|
416 | + dpiSpinBox_->setEnabled(true);
|
|
417 | + sizeDoubleSpinBox_->setSingleStep(0.5);
|
|
400 | 418 | }
|
401 | 419 | |
402 | 420 | drawGlyph();
|
... | ... | @@ -407,19 +425,19 @@ void |
407 | 425 | MainGUI::adjustGlyphIndex(int delta)
|
408 | 426 | {
|
409 | 427 | // only adjust current glyph index if we have a valid font
|
410 | - if (currentNumberOfGlyphs > 0)
|
|
428 | + if (currentNumberOfGlyphs_ > 0)
|
|
411 | 429 | {
|
412 | - currentGlyphIndex += delta;
|
|
413 | - currentGlyphIndex = qBound(0,
|
|
414 | - currentGlyphIndex,
|
|
415 | - currentNumberOfGlyphs - 1);
|
|
430 | + currentGlyphIndex_ += delta;
|
|
431 | + currentGlyphIndex_ = qBound(0,
|
|
432 | + currentGlyphIndex_,
|
|
433 | + currentNumberOfGlyphs_ - 1);
|
|
416 | 434 | }
|
417 | 435 | |
418 | - QString upperHex = QString::number(currentGlyphIndex, 16).toUpper();
|
|
419 | - glyphIndexLabel->setText(QString("%1 (0x%2)")
|
|
420 | - .arg(currentGlyphIndex)
|
|
436 | + QString upperHex = QString::number(currentGlyphIndex_, 16).toUpper();
|
|
437 | + glyphIndexLabel_->setText(QString("%1 (0x%2)")
|
|
438 | + .arg(currentGlyphIndex_)
|
|
421 | 439 | .arg(upperHex));
|
422 | - glyphNameLabel->setText(engine->glyphName(currentGlyphIndex));
|
|
440 | + glyphNameLabel_->setText(engine_->glyphName(currentGlyphIndex_));
|
|
423 | 441 | |
424 | 442 | drawGlyph();
|
425 | 443 | }
|
... | ... | @@ -428,25 +446,25 @@ MainGUI::adjustGlyphIndex(int delta) |
428 | 446 | void
|
429 | 447 | MainGUI::checkCurrentFontIndex()
|
430 | 448 | {
|
431 | - if (fontList.size() < 2)
|
|
449 | + if (engine_->numberOfOpenedFonts() < 2)
|
|
432 | 450 | {
|
433 | - previousFontButton->setEnabled(false);
|
|
434 | - nextFontButton->setEnabled(false);
|
|
451 | + previousFontButton_->setEnabled(false);
|
|
452 | + nextFontButton_->setEnabled(false);
|
|
435 | 453 | }
|
436 | - else if (currentFontIndex == 0)
|
|
454 | + else if (currentFontIndex_ == 0)
|
|
437 | 455 | {
|
438 | - previousFontButton->setEnabled(false);
|
|
439 | - nextFontButton->setEnabled(true);
|
|
456 | + previousFontButton_->setEnabled(false);
|
|
457 | + nextFontButton_->setEnabled(true);
|
|
440 | 458 | }
|
441 | - else if (currentFontIndex >= fontList.size() - 1)
|
|
459 | + else if (currentFontIndex_ >= engine_->numberOfOpenedFonts() - 1)
|
|
442 | 460 | {
|
443 | - previousFontButton->setEnabled(true);
|
|
444 | - nextFontButton->setEnabled(false);
|
|
461 | + previousFontButton_->setEnabled(true);
|
|
462 | + nextFontButton_->setEnabled(false);
|
|
445 | 463 | }
|
446 | 464 | else
|
447 | 465 | {
|
448 | - previousFontButton->setEnabled(true);
|
|
449 | - nextFontButton->setEnabled(true);
|
|
466 | + previousFontButton_->setEnabled(true);
|
|
467 | + nextFontButton_->setEnabled(true);
|
|
450 | 468 | }
|
451 | 469 | }
|
452 | 470 | |
... | ... | @@ -454,25 +472,25 @@ MainGUI::checkCurrentFontIndex() |
454 | 472 | void
|
455 | 473 | MainGUI::checkCurrentFaceIndex()
|
456 | 474 | {
|
457 | - if (currentNumberOfFaces < 2)
|
|
475 | + if (currentNumberOfFaces_ < 2)
|
|
458 | 476 | {
|
459 | - previousFaceButton->setEnabled(false);
|
|
460 | - nextFaceButton->setEnabled(false);
|
|
477 | + previousFaceButton_->setEnabled(false);
|
|
478 | + nextFaceButton_->setEnabled(false);
|
|
461 | 479 | }
|
462 | - else if (currentFaceIndex == 0)
|
|
480 | + else if (currentFaceIndex_ == 0)
|
|
463 | 481 | {
|
464 | - previousFaceButton->setEnabled(false);
|
|
465 | - nextFaceButton->setEnabled(true);
|
|
482 | + previousFaceButton_->setEnabled(false);
|
|
483 | + nextFaceButton_->setEnabled(true);
|
|
466 | 484 | }
|
467 | - else if (currentFaceIndex >= currentNumberOfFaces - 1)
|
|
485 | + else if (currentFaceIndex_ >= currentNumberOfFaces_ - 1)
|
|
468 | 486 | {
|
469 | - previousFaceButton->setEnabled(true);
|
|
470 | - nextFaceButton->setEnabled(false);
|
|
487 | + previousFaceButton_->setEnabled(true);
|
|
488 | + nextFaceButton_->setEnabled(false);
|
|
471 | 489 | }
|
472 | 490 | else
|
473 | 491 | {
|
474 | - previousFaceButton->setEnabled(true);
|
|
475 | - nextFaceButton->setEnabled(true);
|
|
492 | + previousFaceButton_->setEnabled(true);
|
|
493 | + nextFaceButton_->setEnabled(true);
|
|
476 | 494 | }
|
477 | 495 | }
|
478 | 496 | |
... | ... | @@ -480,25 +498,25 @@ MainGUI::checkCurrentFaceIndex() |
480 | 498 | void
|
481 | 499 | MainGUI::checkCurrentNamedInstanceIndex()
|
482 | 500 | {
|
483 | - if (currentNumberOfNamedInstances < 2)
|
|
501 | + if (currentNumberOfNamedInstances_ < 2)
|
|
484 | 502 | {
|
485 | - previousNamedInstanceButton->setEnabled(false);
|
|
486 | - nextNamedInstanceButton->setEnabled(false);
|
|
503 | + previousNamedInstanceButton_->setEnabled(false);
|
|
504 | + nextNamedInstanceButton_->setEnabled(false);
|
|
487 | 505 | }
|
488 | - else if (currentNamedInstanceIndex == 0)
|
|
506 | + else if (currentNamedInstanceIndex_ == 0)
|
|
489 | 507 | {
|
490 | - previousNamedInstanceButton->setEnabled(false);
|
|
491 | - nextNamedInstanceButton->setEnabled(true);
|
|
508 | + previousNamedInstanceButton_->setEnabled(false);
|
|
509 | + nextNamedInstanceButton_->setEnabled(true);
|
|
492 | 510 | }
|
493 | - else if (currentNamedInstanceIndex >= currentNumberOfNamedInstances - 1)
|
|
511 | + else if (currentNamedInstanceIndex_ >= currentNumberOfNamedInstances_ - 1)
|
|
494 | 512 | {
|
495 | - previousNamedInstanceButton->setEnabled(true);
|
|
496 | - nextNamedInstanceButton->setEnabled(false);
|
|
513 | + previousNamedInstanceButton_->setEnabled(true);
|
|
514 | + nextNamedInstanceButton_->setEnabled(false);
|
|
497 | 515 | }
|
498 | 516 | else
|
499 | 517 | {
|
500 | - previousNamedInstanceButton->setEnabled(true);
|
|
501 | - nextNamedInstanceButton->setEnabled(true);
|
|
518 | + previousNamedInstanceButton_->setEnabled(true);
|
|
519 | + nextNamedInstanceButton_->setEnabled(true);
|
|
502 | 520 | }
|
503 | 521 | }
|
504 | 522 | |
... | ... | @@ -506,11 +524,11 @@ MainGUI::checkCurrentNamedInstanceIndex() |
506 | 524 | void
|
507 | 525 | MainGUI::previousFont()
|
508 | 526 | {
|
509 | - if (currentFontIndex > 0)
|
|
527 | + if (currentFontIndex_ > 0)
|
|
510 | 528 | {
|
511 | - currentFontIndex--;
|
|
512 | - currentFaceIndex = 0;
|
|
513 | - currentNamedInstanceIndex = 0;
|
|
529 | + currentFontIndex_--;
|
|
530 | + currentFaceIndex_ = 0;
|
|
531 | + currentNamedInstanceIndex_ = 0;
|
|
514 | 532 | showFont();
|
515 | 533 | }
|
516 | 534 | }
|
... | ... | @@ -519,11 +537,11 @@ MainGUI::previousFont() |
519 | 537 | void
|
520 | 538 | MainGUI::nextFont()
|
521 | 539 | {
|
522 | - if (currentFontIndex < fontList.size() - 1)
|
|
540 | + if (currentFontIndex_ < engine_->numberOfOpenedFonts() - 1)
|
|
523 | 541 | {
|
524 | - currentFontIndex++;
|
|
525 | - currentFaceIndex = 0;
|
|
526 | - currentNamedInstanceIndex = 0;
|
|
542 | + currentFontIndex_++;
|
|
543 | + currentFaceIndex_ = 0;
|
|
544 | + currentNamedInstanceIndex_ = 0;
|
|
527 | 545 | showFont();
|
528 | 546 | }
|
529 | 547 | }
|
... | ... | @@ -532,10 +550,10 @@ MainGUI::nextFont() |
532 | 550 | void
|
533 | 551 | MainGUI::previousFace()
|
534 | 552 | {
|
535 | - if (currentFaceIndex > 0)
|
|
553 | + if (currentFaceIndex_ > 0)
|
|
536 | 554 | {
|
537 | - currentFaceIndex--;
|
|
538 | - currentNamedInstanceIndex = 0;
|
|
555 | + currentFaceIndex_--;
|
|
556 | + currentNamedInstanceIndex_ = 0;
|
|
539 | 557 | showFont();
|
540 | 558 | }
|
541 | 559 | }
|
... | ... | @@ -544,10 +562,10 @@ MainGUI::previousFace() |
544 | 562 | void
|
545 | 563 | MainGUI::nextFace()
|
546 | 564 | {
|
547 | - if (currentFaceIndex < currentNumberOfFaces - 1)
|
|
565 | + if (currentFaceIndex_ < currentNumberOfFaces_ - 1)
|
|
548 | 566 | {
|
549 | - currentFaceIndex++;
|
|
550 | - currentNamedInstanceIndex = 0;
|
|
567 | + currentFaceIndex_++;
|
|
568 | + currentNamedInstanceIndex_ = 0;
|
|
551 | 569 | showFont();
|
552 | 570 | }
|
553 | 571 | }
|
... | ... | @@ -556,9 +574,9 @@ MainGUI::nextFace() |
556 | 574 | void
|
557 | 575 | MainGUI::previousNamedInstance()
|
558 | 576 | {
|
559 | - if (currentNamedInstanceIndex > 0)
|
|
577 | + if (currentNamedInstanceIndex_ > 0)
|
|
560 | 578 | {
|
561 | - currentNamedInstanceIndex--;
|
|
579 | + currentNamedInstanceIndex_--;
|
|
562 | 580 | showFont();
|
563 | 581 | }
|
564 | 582 | }
|
... | ... | @@ -567,9 +585,9 @@ MainGUI::previousNamedInstance() |
567 | 585 | void
|
568 | 586 | MainGUI::nextNamedInstance()
|
569 | 587 | {
|
570 | - if (currentNamedInstanceIndex < currentNumberOfNamedInstances - 1)
|
|
588 | + if (currentNamedInstanceIndex_ < currentNumberOfNamedInstances_ - 1)
|
|
571 | 589 | {
|
572 | - currentNamedInstanceIndex++;
|
|
590 | + currentNamedInstanceIndex_++;
|
|
573 | 591 | showFont();
|
574 | 592 | }
|
575 | 593 | }
|
... | ... | @@ -578,7 +596,7 @@ MainGUI::nextNamedInstance() |
578 | 596 | void
|
579 | 597 | MainGUI::zoom()
|
580 | 598 | {
|
581 | - int scale = zoomSpinBox->value();
|
|
599 | + int scale = zoomSpinBox_->value();
|
|
582 | 600 | |
583 | 601 | QTransform transform;
|
584 | 602 | transform.scale(scale, scale);
|
... | ... | @@ -589,7 +607,7 @@ MainGUI::zoom() |
589 | 607 | qreal shift = 0.5 / scale;
|
590 | 608 | transform.translate(shift, shift);
|
591 | 609 | |
592 | - glyphView->setTransform(transform);
|
|
610 | + glyphView_->setTransform(transform);
|
|
593 | 611 | }
|
594 | 612 | |
595 | 613 | |
... | ... | @@ -598,28 +616,28 @@ MainGUI::setGraphicsDefaults() |
598 | 616 | {
|
599 | 617 | // color tables (with suitable opacity values) for converting
|
600 | 618 | // FreeType's pixmaps to something Qt understands
|
601 | - monoColorTable.append(QColor(Qt::transparent).rgba());
|
|
602 | - monoColorTable.append(QColor(Qt::black).rgba());
|
|
619 | + monoColorTable_.append(QColor(Qt::transparent).rgba());
|
|
620 | + monoColorTable_.append(QColor(Qt::black).rgba());
|
|
603 | 621 | |
604 | 622 | for (int i = 0xFF; i >= 0; i--)
|
605 | - grayColorTable.append(qRgba(i, i, i, 0xFF - i));
|
|
623 | + grayColorTable_.append(qRgba(i, i, i, 0xFF - i));
|
|
606 | 624 | |
607 | 625 | // XXX make this user-configurable
|
608 | 626 | |
609 | - axisPen.setColor(Qt::black);
|
|
610 | - axisPen.setWidth(0);
|
|
611 | - blueZonePen.setColor(QColor(64, 64, 255, 64)); // light blue
|
|
612 | - blueZonePen.setWidth(0);
|
|
613 | - gridPen.setColor(Qt::lightGray);
|
|
614 | - gridPen.setWidth(0);
|
|
615 | - offPen.setColor(Qt::darkGreen);
|
|
616 | - offPen.setWidth(3);
|
|
617 | - onPen.setColor(Qt::red);
|
|
618 | - onPen.setWidth(3);
|
|
619 | - outlinePen.setColor(Qt::red);
|
|
620 | - outlinePen.setWidth(0);
|
|
621 | - segmentPen.setColor(QColor(64, 255, 128, 64)); // light green
|
|
622 | - segmentPen.setWidth(0);
|
|
627 | + axisPen_.setColor(Qt::black);
|
|
628 | + axisPen_.setWidth(0);
|
|
629 | + blueZonePen_.setColor(QColor(64, 64, 255, 64)); // light blue
|
|
630 | + blueZonePen_.setWidth(0);
|
|
631 | + gridPen_.setColor(Qt::lightGray);
|
|
632 | + gridPen_.setWidth(0);
|
|
633 | + offPen_.setColor(Qt::darkGreen);
|
|
634 | + offPen_.setWidth(3);
|
|
635 | + onPen_.setColor(Qt::red);
|
|
636 | + onPen_.setWidth(3);
|
|
637 | + outlinePen_.setColor(Qt::red);
|
|
638 | + outlinePen_.setWidth(0);
|
|
639 | + segmentPen_.setColor(QColor(64, 255, 128, 64)); // light green
|
|
640 | + segmentPen_.setWidth(0);
|
|
623 | 641 | }
|
624 | 642 | |
625 | 643 | |
... | ... | @@ -628,81 +646,83 @@ MainGUI::drawGlyph() |
628 | 646 | {
|
629 | 647 | // the call to `engine->loadOutline' updates FreeType's load flags
|
630 | 648 | |
631 | - if (!engine)
|
|
649 | + if (!engine_)
|
|
632 | 650 | return;
|
633 | 651 | |
634 | - if (currentGlyphBitmapItem)
|
|
652 | + if (currentGlyphBitmapItem_)
|
|
635 | 653 | {
|
636 | - glyphScene->removeItem(currentGlyphBitmapItem);
|
|
637 | - delete currentGlyphBitmapItem;
|
|
654 | + glyphScene_->removeItem(currentGlyphBitmapItem_);
|
|
655 | + delete currentGlyphBitmapItem_;
|
|
638 | 656 | |
639 | - currentGlyphBitmapItem = NULL;
|
|
657 | + currentGlyphBitmapItem_ = NULL;
|
|
640 | 658 | }
|
641 | 659 | |
642 | - if (currentGlyphOutlineItem)
|
|
660 | + if (currentGlyphOutlineItem_)
|
|
643 | 661 | {
|
644 | - glyphScene->removeItem(currentGlyphOutlineItem);
|
|
645 | - delete currentGlyphOutlineItem;
|
|
662 | + glyphScene_->removeItem(currentGlyphOutlineItem_);
|
|
663 | + delete currentGlyphOutlineItem_;
|
|
646 | 664 | |
647 | - currentGlyphOutlineItem = NULL;
|
|
665 | + currentGlyphOutlineItem_ = NULL;
|
|
648 | 666 | }
|
649 | 667 | |
650 | - if (currentGlyphPointsItem)
|
|
668 | + if (currentGlyphPointsItem_)
|
|
651 | 669 | {
|
652 | - glyphScene->removeItem(currentGlyphPointsItem);
|
|
653 | - delete currentGlyphPointsItem;
|
|
670 | + glyphScene_->removeItem(currentGlyphPointsItem_);
|
|
671 | + delete currentGlyphPointsItem_;
|
|
654 | 672 | |
655 | - currentGlyphPointsItem = NULL;
|
|
673 | + currentGlyphPointsItem_ = NULL;
|
|
656 | 674 | }
|
657 | 675 | |
658 | - if (currentGlyphPointNumbersItem)
|
|
676 | + if (currentGlyphPointNumbersItem_)
|
|
659 | 677 | {
|
660 | - glyphScene->removeItem(currentGlyphPointNumbersItem);
|
|
661 | - delete currentGlyphPointNumbersItem;
|
|
678 | + glyphScene_->removeItem(currentGlyphPointNumbersItem_);
|
|
679 | + delete currentGlyphPointNumbersItem_;
|
|
662 | 680 | |
663 | - currentGlyphPointNumbersItem = NULL;
|
|
681 | + currentGlyphPointNumbersItem_ = NULL;
|
|
664 | 682 | }
|
665 | 683 | |
666 | - FT_Outline* outline = engine->loadOutline(currentGlyphIndex);
|
|
684 | + syncSettings();
|
|
685 | + FT_Outline* outline = engine_->loadOutline(currentGlyphIndex_);
|
|
667 | 686 | if (outline)
|
668 | 687 | {
|
669 | - if (showBitmapCheckBox->isChecked())
|
|
688 | + if (showBitmapCheckBox_->isChecked())
|
|
670 | 689 | {
|
671 | 690 | // XXX support LCD
|
672 | 691 | FT_Pixel_Mode pixelMode = FT_PIXEL_MODE_GRAY;
|
673 | - if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_None)
|
|
692 | + if (antiAliasingComboBox_->currentIndex()
|
|
693 | + == AntiAliasingComboBoxModel::AntiAliasing_None)
|
|
674 | 694 | pixelMode = FT_PIXEL_MODE_MONO;
|
675 | 695 | |
676 | - currentGlyphBitmapItem = new GlyphBitmap(outline,
|
|
677 | - engine->library,
|
|
696 | + currentGlyphBitmapItem_ = new GlyphBitmap(outline,
|
|
697 | + engine_->ftLibrary(),
|
|
678 | 698 | pixelMode,
|
679 | - monoColorTable,
|
|
680 | - grayColorTable);
|
|
681 | - glyphScene->addItem(currentGlyphBitmapItem);
|
|
699 | + monoColorTable_,
|
|
700 | + grayColorTable_);
|
|
701 | + glyphScene_->addItem(currentGlyphBitmapItem_);
|
|
682 | 702 | }
|
683 | 703 | |
684 | - if (showOutlinesCheckBox->isChecked())
|
|
704 | + if (showOutlinesCheckBox_->isChecked())
|
|
685 | 705 | {
|
686 | - currentGlyphOutlineItem = new GlyphOutline(outlinePen, outline);
|
|
687 | - glyphScene->addItem(currentGlyphOutlineItem);
|
|
706 | + currentGlyphOutlineItem_ = new GlyphOutline(outlinePen_, outline);
|
|
707 | + glyphScene_->addItem(currentGlyphOutlineItem_);
|
|
688 | 708 | }
|
689 | 709 | |
690 | - if (showPointsCheckBox->isChecked())
|
|
710 | + if (showPointsCheckBox_->isChecked())
|
|
691 | 711 | {
|
692 | - currentGlyphPointsItem = new GlyphPoints(onPen, offPen, outline);
|
|
693 | - glyphScene->addItem(currentGlyphPointsItem);
|
|
712 | + currentGlyphPointsItem_ = new GlyphPoints(onPen_, offPen_, outline);
|
|
713 | + glyphScene_->addItem(currentGlyphPointsItem_);
|
|
694 | 714 | |
695 | - if (showPointNumbersCheckBox->isChecked())
|
|
715 | + if (showPointNumbersCheckBox_->isChecked())
|
|
696 | 716 | {
|
697 | - currentGlyphPointNumbersItem = new GlyphPointNumbers(onPen,
|
|
698 | - offPen,
|
|
717 | + currentGlyphPointNumbersItem_ = new GlyphPointNumbers(onPen_,
|
|
718 | + offPen_,
|
|
699 | 719 | outline);
|
700 | - glyphScene->addItem(currentGlyphPointNumbersItem);
|
|
720 | + glyphScene_->addItem(currentGlyphPointNumbersItem_);
|
|
701 | 721 | }
|
702 | 722 | }
|
703 | 723 | }
|
704 | 724 | |
705 | - glyphScene->update();
|
|
725 | + glyphScene_->update();
|
|
706 | 726 | }
|
707 | 727 | |
708 | 728 | |
... | ... | @@ -712,309 +732,290 @@ void |
712 | 732 | MainGUI::createLayout()
|
713 | 733 | {
|
714 | 734 | // left side
|
715 | - fontFilenameLabel = new QLabel;
|
|
716 | - |
|
717 | - hintingCheckBox = new QCheckBox(tr("Hinting"));
|
|
718 | - |
|
719 | - hintingModeLabel = new QLabel(tr("Hinting Mode"));
|
|
720 | - hintingModeLabel->setAlignment(Qt::AlignRight);
|
|
721 | - hintingModeComboBoxx = new QComboBoxx;
|
|
722 | - hintingModeComboBoxx->insertItem(HintingMode_TrueType_v35,
|
|
723 | - tr("TrueType v35"));
|
|
724 | - hintingModeComboBoxx->insertItem(HintingMode_TrueType_v38,
|
|
725 | - tr("TrueType v38"));
|
|
726 | - hintingModeComboBoxx->insertItem(HintingMode_TrueType_v40,
|
|
727 | - tr("TrueType v40"));
|
|
728 | - hintingModeComboBoxx->insertItem(HintingMode_CFF_FreeType,
|
|
729 | - tr("CFF (FreeType)"));
|
|
730 | - hintingModeComboBoxx->insertItem(HintingMode_CFF_Adobe,
|
|
731 | - tr("CFF (Adobe)"));
|
|
732 | - hintingModeLabel->setBuddy(hintingModeComboBoxx);
|
|
733 | - |
|
734 | - autoHintingCheckBox = new QCheckBox(tr("Auto-Hinting"));
|
|
735 | - horizontalHintingCheckBox = new QCheckBox(tr("Horizontal Hinting"));
|
|
736 | - verticalHintingCheckBox = new QCheckBox(tr("Vertical Hinting"));
|
|
737 | - blueZoneHintingCheckBox = new QCheckBox(tr("Blue-Zone Hinting"));
|
|
738 | - segmentDrawingCheckBox = new QCheckBox(tr("Segment Drawing"));
|
|
739 | - |
|
740 | - antiAliasingLabel = new QLabel(tr("Anti-Aliasing"));
|
|
741 | - antiAliasingLabel->setAlignment(Qt::AlignRight);
|
|
742 | - antiAliasingComboBoxx = new QComboBoxx;
|
|
743 | - antiAliasingComboBoxx->insertItem(AntiAliasing_None,
|
|
744 | - tr("None"));
|
|
745 | - antiAliasingComboBoxx->insertItem(AntiAliasing_Normal,
|
|
746 | - tr("Normal"));
|
|
747 | - antiAliasingComboBoxx->insertItem(AntiAliasing_Light,
|
|
748 | - tr("Light"));
|
|
749 | - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD,
|
|
750 | - tr("LCD (RGB)"));
|
|
751 | - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_BGR,
|
|
752 | - tr("LCD (BGR)"));
|
|
753 | - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical,
|
|
754 | - tr("LCD (vert. RGB)"));
|
|
755 | - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical_BGR,
|
|
756 | - tr("LCD (vert. BGR)"));
|
|
757 | - antiAliasingLabel->setBuddy(antiAliasingComboBoxx);
|
|
758 | - |
|
759 | - lcdFilterLabel = new QLabel(tr("LCD Filter"));
|
|
760 | - lcdFilterLabel->setAlignment(Qt::AlignRight);
|
|
761 | - lcdFilterComboBox = new QComboBox;
|
|
762 | - lcdFilterComboBox->insertItem(LCDFilter_Default, tr("Default"));
|
|
763 | - lcdFilterComboBox->insertItem(LCDFilter_Light, tr("Light"));
|
|
764 | - lcdFilterComboBox->insertItem(LCDFilter_None, tr("None"));
|
|
765 | - lcdFilterComboBox->insertItem(LCDFilter_Legacy, tr("Legacy"));
|
|
766 | - lcdFilterLabel->setBuddy(lcdFilterComboBox);
|
|
735 | + fontFilenameLabel_ = new QLabel;
|
|
736 | + |
|
737 | + hintingCheckBox_ = new QCheckBox(tr("Hinting"));
|
|
738 | + |
|
739 | + hintingModeLabel_ = new QLabel(tr("Hinting Mode"));
|
|
740 | + hintingModeLabel_->setAlignment(Qt::AlignRight);
|
|
741 | + |
|
742 | + hintingModeComboBoxModel_ = new HintingModeComboBoxModel;
|
|
743 | + hintingModeComboBox_ = new QComboBox;
|
|
744 | + hintingModeComboBox_->setModel(hintingModeComboBoxModel_);
|
|
745 | + hintingModeLabel_->setBuddy(hintingModeComboBox_);
|
|
746 | + |
|
747 | + autoHintingCheckBox_ = new QCheckBox(tr("Auto-Hinting"));
|
|
748 | + horizontalHintingCheckBox_ = new QCheckBox(tr("Horizontal Hinting"));
|
|
749 | + verticalHintingCheckBox_ = new QCheckBox(tr("Vertical Hinting"));
|
|
750 | + blueZoneHintingCheckBox_ = new QCheckBox(tr("Blue-Zone Hinting"));
|
|
751 | + segmentDrawingCheckBox_ = new QCheckBox(tr("Segment Drawing"));
|
|
752 | + |
|
753 | + antiAliasingLabel_ = new QLabel(tr("Anti-Aliasing"));
|
|
754 | + antiAliasingLabel_->setAlignment(Qt::AlignRight);
|
|
755 | + |
|
756 | + antiAliasingComboBoxModel_ = new AntiAliasingComboBoxModel;
|
|
757 | + antiAliasingComboBox_ = new QComboBox;
|
|
758 | + antiAliasingComboBox_->setModel(antiAliasingComboBoxModel_);
|
|
759 | + antiAliasingLabel_->setBuddy(antiAliasingComboBox_);
|
|
760 | + |
|
761 | + lcdFilterLabel_ = new QLabel(tr("LCD Filter"));
|
|
762 | + lcdFilterLabel_->setAlignment(Qt::AlignRight);
|
|
763 | + |
|
764 | + lcdFilterComboboxModel_ = new LCDFilterComboBoxModel;
|
|
765 | + lcdFilterComboBox_ = new QComboBox;
|
|
766 | + lcdFilterComboBox_->setModel(lcdFilterComboboxModel_);
|
|
767 | + lcdFilterLabel_->setBuddy(lcdFilterComboBox_);
|
|
767 | 768 | |
768 | 769 | int width;
|
769 | 770 | // make all labels have the same width
|
770 | - width = hintingModeLabel->minimumSizeHint().width();
|
|
771 | - width = qMax(antiAliasingLabel->minimumSizeHint().width(), width);
|
|
772 | - width = qMax(lcdFilterLabel->minimumSizeHint().width(), width);
|
|
773 | - hintingModeLabel->setMinimumWidth(width);
|
|
774 | - antiAliasingLabel->setMinimumWidth(width);
|
|
775 | - lcdFilterLabel->setMinimumWidth(width);
|
|
771 | + width = hintingModeLabel_->minimumSizeHint().width();
|
|
772 | + width = qMax(antiAliasingLabel_->minimumSizeHint().width(), width);
|
|
773 | + width = qMax(lcdFilterLabel_->minimumSizeHint().width(), width);
|
|
774 | + hintingModeLabel_->setMinimumWidth(width);
|
|
775 | + antiAliasingLabel_->setMinimumWidth(width);
|
|
776 | + lcdFilterLabel_->setMinimumWidth(width);
|
|
776 | 777 | |
777 | 778 | // ensure that all items in combo boxes fit completely;
|
778 | 779 | // also make all combo boxes have the same width
|
779 | - width = hintingModeComboBoxx->minimumSizeHint().width();
|
|
780 | - width = qMax(antiAliasingComboBoxx->minimumSizeHint().width(), width);
|
|
781 | - width = qMax(lcdFilterComboBox->minimumSizeHint().width(), width);
|
|
782 | - hintingModeComboBoxx->setMinimumWidth(width);
|
|
783 | - antiAliasingComboBoxx->setMinimumWidth(width);
|
|
784 | - lcdFilterComboBox->setMinimumWidth(width);
|
|
785 | - |
|
786 | - gammaLabel = new QLabel(tr("Gamma"));
|
|
787 | - gammaLabel->setAlignment(Qt::AlignRight);
|
|
788 | - gammaSlider = new QSlider(Qt::Horizontal);
|
|
789 | - gammaSlider->setRange(0, 30); // in 1/10th
|
|
790 | - gammaSlider->setTickPosition(QSlider::TicksBelow);
|
|
791 | - gammaSlider->setTickInterval(5);
|
|
792 | - gammaLabel->setBuddy(gammaSlider);
|
|
793 | - |
|
794 | - showBitmapCheckBox = new QCheckBox(tr("Show Bitmap"));
|
|
795 | - showPointsCheckBox = new QCheckBox(tr("Show Points"));
|
|
796 | - showPointNumbersCheckBox = new QCheckBox(tr("Show Point Numbers"));
|
|
797 | - showOutlinesCheckBox = new QCheckBox(tr("Show Outlines"));
|
|
798 | - |
|
799 | - infoLeftLayout = new QHBoxLayout;
|
|
800 | - infoLeftLayout->addWidget(fontFilenameLabel);
|
|
801 | - |
|
802 | - hintingModeLayout = new QHBoxLayout;
|
|
803 | - hintingModeLayout->addWidget(hintingModeLabel);
|
|
804 | - hintingModeLayout->addWidget(hintingModeComboBoxx);
|
|
805 | - |
|
806 | - horizontalHintingLayout = new QHBoxLayout;
|
|
807 | - horizontalHintingLayout->addSpacing(20); // XXX px
|
|
808 | - horizontalHintingLayout->addWidget(horizontalHintingCheckBox);
|
|
809 | - |
|
810 | - verticalHintingLayout = new QHBoxLayout;
|
|
811 | - verticalHintingLayout->addSpacing(20); // XXX px
|
|
812 | - verticalHintingLayout->addWidget(verticalHintingCheckBox);
|
|
813 | - |
|
814 | - blueZoneHintingLayout = new QHBoxLayout;
|
|
815 | - blueZoneHintingLayout->addSpacing(20); // XXX px
|
|
816 | - blueZoneHintingLayout->addWidget(blueZoneHintingCheckBox);
|
|
817 | - |
|
818 | - segmentDrawingLayout = new QHBoxLayout;
|
|
819 | - segmentDrawingLayout->addSpacing(20); // XXX px
|
|
820 | - segmentDrawingLayout->addWidget(segmentDrawingCheckBox);
|
|
821 | - |
|
822 | - antiAliasingLayout = new QHBoxLayout;
|
|
823 | - antiAliasingLayout->addWidget(antiAliasingLabel);
|
|
824 | - antiAliasingLayout->addWidget(antiAliasingComboBoxx);
|
|
825 | - |
|
826 | - lcdFilterLayout = new QHBoxLayout;
|
|
827 | - lcdFilterLayout->addWidget(lcdFilterLabel);
|
|
828 | - lcdFilterLayout->addWidget(lcdFilterComboBox);
|
|
829 | - |
|
830 | - gammaLayout = new QHBoxLayout;
|
|
831 | - gammaLayout->addWidget(gammaLabel);
|
|
832 | - gammaLayout->addWidget(gammaSlider);
|
|
833 | - |
|
834 | - pointNumbersLayout = new QHBoxLayout;
|
|
835 | - pointNumbersLayout->addSpacing(20); // XXX px
|
|
836 | - pointNumbersLayout->addWidget(showPointNumbersCheckBox);
|
|
837 | - |
|
838 | - generalTabLayout = new QVBoxLayout;
|
|
839 | - generalTabLayout->addWidget(hintingCheckBox);
|
|
840 | - generalTabLayout->addLayout(hintingModeLayout);
|
|
841 | - generalTabLayout->addWidget(autoHintingCheckBox);
|
|
842 | - generalTabLayout->addLayout(horizontalHintingLayout);
|
|
843 | - generalTabLayout->addLayout(verticalHintingLayout);
|
|
844 | - generalTabLayout->addLayout(blueZoneHintingLayout);
|
|
845 | - generalTabLayout->addLayout(segmentDrawingLayout);
|
|
846 | - generalTabLayout->addSpacing(20); // XXX px
|
|
847 | - generalTabLayout->addStretch(1);
|
|
848 | - generalTabLayout->addLayout(antiAliasingLayout);
|
|
849 | - generalTabLayout->addLayout(lcdFilterLayout);
|
|
850 | - generalTabLayout->addSpacing(20); // XXX px
|
|
851 | - generalTabLayout->addStretch(1);
|
|
852 | - generalTabLayout->addLayout(gammaLayout);
|
|
853 | - generalTabLayout->addSpacing(20); // XXX px
|
|
854 | - generalTabLayout->addStretch(1);
|
|
855 | - generalTabLayout->addWidget(showBitmapCheckBox);
|
|
856 | - generalTabLayout->addWidget(showPointsCheckBox);
|
|
857 | - generalTabLayout->addLayout(pointNumbersLayout);
|
|
858 | - generalTabLayout->addWidget(showOutlinesCheckBox);
|
|
859 | - |
|
860 | - generalTabWidget = new QWidget;
|
|
861 | - generalTabWidget->setLayout(generalTabLayout);
|
|
862 | - |
|
863 | - mmgxTabWidget = new QWidget;
|
|
864 | - |
|
865 | - tabWidget = new QTabWidget;
|
|
866 | - tabWidget->addTab(generalTabWidget, tr("General"));
|
|
867 | - tabWidget->addTab(mmgxTabWidget, tr("MM/GX"));
|
|
868 | - |
|
869 | - leftLayout = new QVBoxLayout;
|
|
870 | - leftLayout->addLayout(infoLeftLayout);
|
|
871 | - leftLayout->addWidget(tabWidget);
|
|
780 | + width = hintingModeComboBox_->minimumSizeHint().width();
|
|
781 | + width = qMax(antiAliasingComboBox_->minimumSizeHint().width(), width);
|
|
782 | + width = qMax(lcdFilterComboBox_->minimumSizeHint().width(), width);
|
|
783 | + hintingModeComboBox_->setMinimumWidth(width);
|
|
784 | + antiAliasingComboBox_->setMinimumWidth(width);
|
|
785 | + lcdFilterComboBox_->setMinimumWidth(width);
|
|
786 | + |
|
787 | + gammaLabel_ = new QLabel(tr("Gamma"));
|
|
788 | + gammaLabel_->setAlignment(Qt::AlignRight);
|
|
789 | + gammaSlider_ = new QSlider(Qt::Horizontal);
|
|
790 | + gammaSlider_->setRange(0, 30); // in 1/10th
|
|
791 | + gammaSlider_->setTickPosition(QSlider::TicksBelow);
|
|
792 | + gammaSlider_->setTickInterval(5);
|
|
793 | + gammaLabel_->setBuddy(gammaSlider_);
|
|
794 | + |
|
795 | + showBitmapCheckBox_ = new QCheckBox(tr("Show Bitmap"));
|
|
796 | + showPointsCheckBox_ = new QCheckBox(tr("Show Points"));
|
|
797 | + showPointNumbersCheckBox_ = new QCheckBox(tr("Show Point Numbers"));
|
|
798 | + showOutlinesCheckBox_ = new QCheckBox(tr("Show Outlines"));
|
|
799 | + |
|
800 | + infoLeftLayout_ = new QHBoxLayout;
|
|
801 | + infoLeftLayout_->addWidget(fontFilenameLabel_);
|
|
802 | + |
|
803 | + hintingModeLayout_ = new QHBoxLayout;
|
|
804 | + hintingModeLayout_->addWidget(hintingModeLabel_);
|
|
805 | + hintingModeLayout_->addWidget(hintingModeComboBox_);
|
|
806 | + |
|
807 | + horizontalHintingLayout_ = new QHBoxLayout;
|
|
808 | + horizontalHintingLayout_->addSpacing(20); // XXX px
|
|
809 | + horizontalHintingLayout_->addWidget(horizontalHintingCheckBox_);
|
|
810 | + |
|
811 | + verticalHintingLayout_ = new QHBoxLayout;
|
|
812 | + verticalHintingLayout_->addSpacing(20); // XXX px
|
|
813 | + verticalHintingLayout_->addWidget(verticalHintingCheckBox_);
|
|
814 | + |
|
815 | + blueZoneHintingLayout_ = new QHBoxLayout;
|
|
816 | + blueZoneHintingLayout_->addSpacing(20); // XXX px
|
|
817 | + blueZoneHintingLayout_->addWidget(blueZoneHintingCheckBox_);
|
|
818 | + |
|
819 | + segmentDrawingLayout_ = new QHBoxLayout;
|
|
820 | + segmentDrawingLayout_->addSpacing(20); // XXX px
|
|
821 | + segmentDrawingLayout_->addWidget(segmentDrawingCheckBox_);
|
|
822 | + |
|
823 | + antiAliasingLayout_ = new QHBoxLayout;
|
|
824 | + antiAliasingLayout_->addWidget(antiAliasingLabel_);
|
|
825 | + antiAliasingLayout_->addWidget(antiAliasingComboBox_);
|
|
826 | + |
|
827 | + lcdFilterLayout_ = new QHBoxLayout;
|
|
828 | + lcdFilterLayout_->addWidget(lcdFilterLabel_);
|
|
829 | + lcdFilterLayout_->addWidget(lcdFilterComboBox_);
|
|
830 | + |
|
831 | + gammaLayout_ = new QHBoxLayout;
|
|
832 | + gammaLayout_->addWidget(gammaLabel_);
|
|
833 | + gammaLayout_->addWidget(gammaSlider_);
|
|
834 | + |
|
835 | + pointNumbersLayout_ = new QHBoxLayout;
|
|
836 | + pointNumbersLayout_->addSpacing(20); // XXX px
|
|
837 | + pointNumbersLayout_->addWidget(showPointNumbersCheckBox_);
|
|
838 | + |
|
839 | + generalTabLayout_ = new QVBoxLayout;
|
|
840 | + generalTabLayout_->addWidget(hintingCheckBox_);
|
|
841 | + generalTabLayout_->addLayout(hintingModeLayout_);
|
|
842 | + generalTabLayout_->addWidget(autoHintingCheckBox_);
|
|
843 | + generalTabLayout_->addLayout(horizontalHintingLayout_);
|
|
844 | + generalTabLayout_->addLayout(verticalHintingLayout_);
|
|
845 | + generalTabLayout_->addLayout(blueZoneHintingLayout_);
|
|
846 | + generalTabLayout_->addLayout(segmentDrawingLayout_);
|
|
847 | + generalTabLayout_->addSpacing(20); // XXX px
|
|
848 | + generalTabLayout_->addStretch(1);
|
|
849 | + generalTabLayout_->addLayout(antiAliasingLayout_);
|
|
850 | + generalTabLayout_->addLayout(lcdFilterLayout_);
|
|
851 | + generalTabLayout_->addSpacing(20); // XXX px
|
|
852 | + generalTabLayout_->addStretch(1);
|
|
853 | + generalTabLayout_->addLayout(gammaLayout_);
|
|
854 | + generalTabLayout_->addSpacing(20); // XXX px
|
|
855 | + generalTabLayout_->addStretch(1);
|
|
856 | + generalTabLayout_->addWidget(showBitmapCheckBox_);
|
|
857 | + generalTabLayout_->addWidget(showPointsCheckBox_);
|
|
858 | + generalTabLayout_->addLayout(pointNumbersLayout_);
|
|
859 | + generalTabLayout_->addWidget(showOutlinesCheckBox_);
|
|
860 | + |
|
861 | + generalTabWidget_ = new QWidget;
|
|
862 | + generalTabWidget_->setLayout(generalTabLayout_);
|
|
863 | + |
|
864 | + mmgxTabWidget_ = new QWidget;
|
|
865 | + |
|
866 | + tabWidget_ = new QTabWidget;
|
|
867 | + tabWidget_->addTab(generalTabWidget_, tr("General"));
|
|
868 | + tabWidget_->addTab(mmgxTabWidget_, tr("MM/GX"));
|
|
869 | + |
|
870 | + leftLayout_ = new QVBoxLayout;
|
|
871 | + leftLayout_->addLayout(infoLeftLayout_);
|
|
872 | + leftLayout_->addWidget(tabWidget_);
|
|
872 | 873 | |
873 | 874 | // we don't want to expand the left side horizontally;
|
874 | 875 | // to change the policy we have to use a widget wrapper
|
875 | - leftWidget = new QWidget;
|
|
876 | - leftWidget->setLayout(leftLayout);
|
|
876 | + leftWidget_ = new QWidget;
|
|
877 | + leftWidget_->setLayout(leftLayout_);
|
|
877 | 878 | |
878 | 879 | QSizePolicy leftWidgetPolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
879 | 880 | leftWidgetPolicy.setHorizontalStretch(0);
|
880 | - leftWidgetPolicy.setVerticalPolicy(leftWidget->sizePolicy().verticalPolicy());
|
|
881 | - leftWidgetPolicy.setHeightForWidth(leftWidget->sizePolicy().hasHeightForWidth());
|
|
881 | + leftWidgetPolicy.setVerticalPolicy(leftWidget_->sizePolicy().verticalPolicy());
|
|
882 | + leftWidgetPolicy.setHeightForWidth(leftWidget_->sizePolicy().hasHeightForWidth());
|
|
882 | 883 | |
883 | - leftWidget->setSizePolicy(leftWidgetPolicy);
|
|
884 | + leftWidget_->setSizePolicy(leftWidgetPolicy);
|
|
884 | 885 | |
885 | 886 | // right side
|
886 | - glyphIndexLabel = new QLabel;
|
|
887 | - glyphNameLabel = new QLabel;
|
|
888 | - fontNameLabel = new QLabel;
|
|
887 | + glyphIndexLabel_ = new QLabel;
|
|
888 | + glyphNameLabel_ = new QLabel;
|
|
889 | + fontNameLabel_ = new QLabel;
|
|
889 | 890 | |
890 | - glyphScene = new QGraphicsScene;
|
|
891 | - glyphScene->addItem(new Grid(gridPen, axisPen));
|
|
891 | + glyphScene_ = new QGraphicsScene;
|
|
892 | + glyphScene_->addItem(new Grid(gridPen_, axisPen_));
|
|
892 | 893 | |
893 | - currentGlyphBitmapItem = NULL;
|
|
894 | - currentGlyphOutlineItem = NULL;
|
|
895 | - currentGlyphPointsItem = NULL;
|
|
896 | - currentGlyphPointNumbersItem = NULL;
|
|
894 | + currentGlyphBitmapItem_ = NULL;
|
|
895 | + currentGlyphOutlineItem_ = NULL;
|
|
896 | + currentGlyphPointsItem_ = NULL;
|
|
897 | + currentGlyphPointNumbersItem_ = NULL;
|
|
897 | 898 | drawGlyph();
|
898 | 899 | |
899 | - glyphView = new QGraphicsViewx;
|
|
900 | - glyphView->setRenderHint(QPainter::Antialiasing, true);
|
|
901 | - glyphView->setDragMode(QGraphicsView::ScrollHandDrag);
|
|
902 | - glyphView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
|
|
903 | - glyphView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
|
|
904 | - glyphView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
|
905 | - glyphView->setScene(glyphScene);
|
|
906 | - |
|
907 | - sizeLabel = new QLabel(tr("Size "));
|
|
908 | - sizeLabel->setAlignment(Qt::AlignRight);
|
|
909 | - sizeDoubleSpinBox = new QDoubleSpinBox;
|
|
910 | - sizeDoubleSpinBox->setAlignment(Qt::AlignRight);
|
|
911 | - sizeDoubleSpinBox->setDecimals(1);
|
|
912 | - sizeDoubleSpinBox->setRange(1, 500);
|
|
913 | - sizeLabel->setBuddy(sizeDoubleSpinBox);
|
|
914 | - |
|
915 | - unitsComboBox = new QComboBox;
|
|
916 | - unitsComboBox->insertItem(Units_px, "px");
|
|
917 | - unitsComboBox->insertItem(Units_pt, "pt");
|
|
918 | - |
|
919 | - dpiLabel = new QLabel(tr("DPI "));
|
|
920 | - dpiLabel->setAlignment(Qt::AlignRight);
|
|
921 | - dpiSpinBox = new QSpinBox;
|
|
922 | - dpiSpinBox->setAlignment(Qt::AlignRight);
|
|
923 | - dpiSpinBox->setRange(10, 600);
|
|
924 | - dpiLabel->setBuddy(dpiSpinBox);
|
|
925 | - |
|
926 | - toStartButtonx = new QPushButtonx("|<");
|
|
927 | - toM1000Buttonx = new QPushButtonx("-1000");
|
|
928 | - toM100Buttonx = new QPushButtonx("-100");
|
|
929 | - toM10Buttonx = new QPushButtonx("-10");
|
|
930 | - toM1Buttonx = new QPushButtonx("-1");
|
|
931 | - toP1Buttonx = new QPushButtonx("+1");
|
|
932 | - toP10Buttonx = new QPushButtonx("+10");
|
|
933 | - toP100Buttonx = new QPushButtonx("+100");
|
|
934 | - toP1000Buttonx = new QPushButtonx("+1000");
|
|
935 | - toEndButtonx = new QPushButtonx(">|");
|
|
936 | - |
|
937 | - zoomLabel = new QLabel(tr("Zoom Factor"));
|
|
938 | - zoomLabel->setAlignment(Qt::AlignRight);
|
|
939 | - zoomSpinBox = new QSpinBoxx;
|
|
940 | - zoomSpinBox->setAlignment(Qt::AlignRight);
|
|
941 | - zoomSpinBox->setRange(1, 1000 - 1000 % 64);
|
|
942 | - zoomSpinBox->setKeyboardTracking(false);
|
|
943 | - zoomLabel->setBuddy(zoomSpinBox);
|
|
944 | - |
|
945 | - previousFontButton = new QPushButton(tr("Previous Font"));
|
|
946 | - nextFontButton = new QPushButton(tr("Next Font"));
|
|
947 | - previousFaceButton = new QPushButton(tr("Previous Face"));
|
|
948 | - nextFaceButton = new QPushButton(tr("Next Face"));
|
|
949 | - previousNamedInstanceButton = new QPushButton(tr("Previous Named Instance"));
|
|
950 | - nextNamedInstanceButton = new QPushButton(tr("Next Named Instance"));
|
|
900 | + glyphView_ = new QGraphicsViewx;
|
|
901 | + glyphView_->setRenderHint(QPainter::Antialiasing, true);
|
|
902 | + glyphView_->setDragMode(QGraphicsView::ScrollHandDrag);
|
|
903 | + glyphView_->setOptimizationFlags(QGraphicsView::DontSavePainterState);
|
|
904 | + glyphView_->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
|
|
905 | + glyphView_->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
|
906 | + glyphView_->setScene(glyphScene_);
|
|
907 | + |
|
908 | + sizeLabel_ = new QLabel(tr("Size "));
|
|
909 | + sizeLabel_->setAlignment(Qt::AlignRight);
|
|
910 | + sizeDoubleSpinBox_ = new QDoubleSpinBox;
|
|
911 | + sizeDoubleSpinBox_->setAlignment(Qt::AlignRight);
|
|
912 | + sizeDoubleSpinBox_->setDecimals(1);
|
|
913 | + sizeDoubleSpinBox_->setRange(1, 500);
|
|
914 | + sizeLabel_->setBuddy(sizeDoubleSpinBox_);
|
|
915 | + |
|
916 | + unitsComboBox_ = new QComboBox;
|
|
917 | + unitsComboBox_->insertItem(Units_px, "px");
|
|
918 | + unitsComboBox_->insertItem(Units_pt, "pt");
|
|
919 | + |
|
920 | + dpiLabel_ = new QLabel(tr("DPI "));
|
|
921 | + dpiLabel_->setAlignment(Qt::AlignRight);
|
|
922 | + dpiSpinBox_ = new QSpinBox;
|
|
923 | + dpiSpinBox_->setAlignment(Qt::AlignRight);
|
|
924 | + dpiSpinBox_->setRange(10, 600);
|
|
925 | + dpiLabel_->setBuddy(dpiSpinBox_);
|
|
926 | + |
|
927 | + toStartButtonx_ = new QPushButtonx("|<");
|
|
928 | + toM1000Buttonx_ = new QPushButtonx("-1000");
|
|
929 | + toM100Buttonx_ = new QPushButtonx("-100");
|
|
930 | + toM10Buttonx_ = new QPushButtonx("-10");
|
|
931 | + toM1Buttonx_ = new QPushButtonx("-1");
|
|
932 | + toP1Buttonx_ = new QPushButtonx("+1");
|
|
933 | + toP10Buttonx_ = new QPushButtonx("+10");
|
|
934 | + toP100Buttonx_ = new QPushButtonx("+100");
|
|
935 | + toP1000Buttonx_ = new QPushButtonx("+1000");
|
|
936 | + toEndButtonx_ = new QPushButtonx(">|");
|
|
937 | + |
|
938 | + zoomLabel_ = new QLabel(tr("Zoom Factor"));
|
|
939 | + zoomLabel_->setAlignment(Qt::AlignRight);
|
|
940 | + zoomSpinBox_ = new QSpinBoxx;
|
|
941 | + zoomSpinBox_->setAlignment(Qt::AlignRight);
|
|
942 | + zoomSpinBox_->setRange(1, 1000 - 1000 % 64);
|
|
943 | + zoomSpinBox_->setKeyboardTracking(false);
|
|
944 | + zoomLabel_->setBuddy(zoomSpinBox_);
|
|
945 | + |
|
946 | + previousFontButton_ = new QPushButton(tr("Previous Font"));
|
|
947 | + nextFontButton_ = new QPushButton(tr("Next Font"));
|
|
948 | + previousFaceButton_ = new QPushButton(tr("Previous Face"));
|
|
949 | + nextFaceButton_ = new QPushButton(tr("Next Face"));
|
|
950 | + previousNamedInstanceButton_ = new QPushButton(tr("Previous Named Instance"));
|
|
951 | + nextNamedInstanceButton_ = new QPushButton(tr("Next Named Instance"));
|
|
951 | 952 | |
952 | 953 | infoRightLayout = new QGridLayout;
|
953 | - infoRightLayout->addWidget(glyphIndexLabel, 0, 0);
|
|
954 | - infoRightLayout->addWidget(glyphNameLabel, 0, 1);
|
|
955 | - infoRightLayout->addWidget(fontNameLabel, 0, 2);
|
|
956 | - |
|
957 | - navigationLayout = new QHBoxLayout;
|
|
958 | - navigationLayout->setSpacing(0);
|
|
959 | - navigationLayout->addStretch(1);
|
|
960 | - navigationLayout->addWidget(toStartButtonx);
|
|
961 | - navigationLayout->addWidget(toM1000Buttonx);
|
|
962 | - navigationLayout->addWidget(toM100Buttonx);
|
|
963 | - navigationLayout->addWidget(toM10Buttonx);
|
|
964 | - navigationLayout->addWidget(toM1Buttonx);
|
|
965 | - navigationLayout->addWidget(toP1Buttonx);
|
|
966 | - navigationLayout->addWidget(toP10Buttonx);
|
|
967 | - navigationLayout->addWidget(toP100Buttonx);
|
|
968 | - navigationLayout->addWidget(toP1000Buttonx);
|
|
969 | - navigationLayout->addWidget(toEndButtonx);
|
|
970 | - navigationLayout->addStretch(1);
|
|
971 | - |
|
972 | - sizeLayout = new QHBoxLayout;
|
|
973 | - sizeLayout->addStretch(2);
|
|
974 | - sizeLayout->addWidget(sizeLabel);
|
|
975 | - sizeLayout->addWidget(sizeDoubleSpinBox);
|
|
976 | - sizeLayout->addWidget(unitsComboBox);
|
|
977 | - sizeLayout->addStretch(1);
|
|
978 | - sizeLayout->addWidget(dpiLabel);
|
|
979 | - sizeLayout->addWidget(dpiSpinBox);
|
|
980 | - sizeLayout->addStretch(1);
|
|
981 | - sizeLayout->addWidget(zoomLabel);
|
|
982 | - sizeLayout->addWidget(zoomSpinBox);
|
|
983 | - sizeLayout->addStretch(2);
|
|
954 | + infoRightLayout->addWidget(glyphIndexLabel_, 0, 0);
|
|
955 | + infoRightLayout->addWidget(glyphNameLabel_, 0, 1);
|
|
956 | + infoRightLayout->addWidget(fontNameLabel_, 0, 2);
|
|
957 | + |
|
958 | + navigationLayout_ = new QHBoxLayout;
|
|
959 | + navigationLayout_->setSpacing(0);
|
|
960 | + navigationLayout_->addStretch(1);
|
|
961 | + navigationLayout_->addWidget(toStartButtonx_);
|
|
962 | + navigationLayout_->addWidget(toM1000Buttonx_);
|
|
963 | + navigationLayout_->addWidget(toM100Buttonx_);
|
|
964 | + navigationLayout_->addWidget(toM10Buttonx_);
|
|
965 | + navigationLayout_->addWidget(toM1Buttonx_);
|
|
966 | + navigationLayout_->addWidget(toP1Buttonx_);
|
|
967 | + navigationLayout_->addWidget(toP10Buttonx_);
|
|
968 | + navigationLayout_->addWidget(toP100Buttonx_);
|
|
969 | + navigationLayout_->addWidget(toP1000Buttonx_);
|
|
970 | + navigationLayout_->addWidget(toEndButtonx_);
|
|
971 | + navigationLayout_->addStretch(1);
|
|
972 | + |
|
973 | + sizeLayout_ = new QHBoxLayout;
|
|
974 | + sizeLayout_->addStretch(2);
|
|
975 | + sizeLayout_->addWidget(sizeLabel_);
|
|
976 | + sizeLayout_->addWidget(sizeDoubleSpinBox_);
|
|
977 | + sizeLayout_->addWidget(unitsComboBox_);
|
|
978 | + sizeLayout_->addStretch(1);
|
|
979 | + sizeLayout_->addWidget(dpiLabel_);
|
|
980 | + sizeLayout_->addWidget(dpiSpinBox_);
|
|
981 | + sizeLayout_->addStretch(1);
|
|
982 | + sizeLayout_->addWidget(zoomLabel_);
|
|
983 | + sizeLayout_->addWidget(zoomSpinBox_);
|
|
984 | + sizeLayout_->addStretch(2);
|
|
984 | 985 | |
985 | 986 | fontLayout = new QGridLayout;
|
986 | 987 | fontLayout->setColumnStretch(0, 2);
|
987 | - fontLayout->addWidget(nextFontButton, 0, 1);
|
|
988 | - fontLayout->addWidget(previousFontButton, 1, 1);
|
|
988 | + fontLayout->addWidget(nextFontButton_, 0, 1);
|
|
989 | + fontLayout->addWidget(previousFontButton_, 1, 1);
|
|
989 | 990 | fontLayout->setColumnStretch(2, 1);
|
990 | - fontLayout->addWidget(nextFaceButton, 0, 3);
|
|
991 | - fontLayout->addWidget(previousFaceButton, 1, 3);
|
|
991 | + fontLayout->addWidget(nextFaceButton_, 0, 3);
|
|
992 | + fontLayout->addWidget(previousFaceButton_, 1, 3);
|
|
992 | 993 | fontLayout->setColumnStretch(4, 1);
|
993 | - fontLayout->addWidget(nextNamedInstanceButton, 0, 5);
|
|
994 | - fontLayout->addWidget(previousNamedInstanceButton, 1, 5);
|
|
994 | + fontLayout->addWidget(nextNamedInstanceButton_, 0, 5);
|
|
995 | + fontLayout->addWidget(previousNamedInstanceButton_, 1, 5);
|
|
995 | 996 | fontLayout->setColumnStretch(6, 2);
|
996 | 997 | |
997 | - rightLayout = new QVBoxLayout;
|
|
998 | - rightLayout->addLayout(infoRightLayout);
|
|
999 | - rightLayout->addWidget(glyphView);
|
|
1000 | - rightLayout->addLayout(navigationLayout);
|
|
1001 | - rightLayout->addSpacing(10); // XXX px
|
|
1002 | - rightLayout->addLayout(sizeLayout);
|
|
1003 | - rightLayout->addSpacing(10); // XXX px
|
|
1004 | - rightLayout->addLayout(fontLayout);
|
|
998 | + rightLayout_ = new QVBoxLayout;
|
|
999 | + rightLayout_->addLayout(infoRightLayout);
|
|
1000 | + rightLayout_->addWidget(glyphView_);
|
|
1001 | + rightLayout_->addLayout(navigationLayout_);
|
|
1002 | + rightLayout_->addSpacing(10); // XXX px
|
|
1003 | + rightLayout_->addLayout(sizeLayout_);
|
|
1004 | + rightLayout_->addSpacing(10); // XXX px
|
|
1005 | + rightLayout_->addLayout(fontLayout);
|
|
1005 | 1006 | |
1006 | 1007 | // for symmetry with the left side use a widget also
|
1007 | - rightWidget = new QWidget;
|
|
1008 | - rightWidget->setLayout(rightLayout);
|
|
1008 | + rightWidget_ = new QWidget;
|
|
1009 | + rightWidget_->setLayout(rightLayout_);
|
|
1009 | 1010 | |
1010 | 1011 | // the whole thing
|
1011 | - ftinspectLayout = new QHBoxLayout;
|
|
1012 | - ftinspectLayout->addWidget(leftWidget);
|
|
1013 | - ftinspectLayout->addWidget(rightWidget);
|
|
1012 | + ftinspectLayout_ = new QHBoxLayout;
|
|
1013 | + ftinspectLayout_->addWidget(leftWidget_);
|
|
1014 | + ftinspectLayout_->addWidget(rightWidget_);
|
|
1014 | 1015 | |
1015 | - ftinspectWidget = new QWidget;
|
|
1016 | - ftinspectWidget->setLayout(ftinspectLayout);
|
|
1017 | - setCentralWidget(ftinspectWidget);
|
|
1016 | + ftinspectWidget_ = new QWidget;
|
|
1017 | + ftinspectWidget_->setLayout(ftinspectLayout_);
|
|
1018 | + setCentralWidget(ftinspectWidget_);
|
|
1018 | 1019 | setWindowTitle("ftinspect");
|
1019 | 1020 | }
|
1020 | 1021 | |
... | ... | @@ -1022,127 +1023,122 @@ MainGUI::createLayout() |
1022 | 1023 | void
|
1023 | 1024 | MainGUI::createConnections()
|
1024 | 1025 | {
|
1025 | - connect(hintingCheckBox, SIGNAL(clicked()),
|
|
1026 | + connect(hintingCheckBox_, SIGNAL(clicked()),
|
|
1026 | 1027 | SLOT(checkHinting()));
|
1027 | 1028 | |
1028 | - connect(hintingModeComboBoxx, SIGNAL(currentIndexChanged(int)),
|
|
1029 | + connect(hintingModeComboBox_, SIGNAL(currentIndexChanged(int)),
|
|
1029 | 1030 | SLOT(checkHintingMode()));
|
1030 | - connect(antiAliasingComboBoxx, SIGNAL(currentIndexChanged(int)),
|
|
1031 | + connect(antiAliasingComboBox_, SIGNAL(currentIndexChanged(int)),
|
|
1031 | 1032 | SLOT(checkAntiAliasing()));
|
1032 | - connect(lcdFilterComboBox, SIGNAL(currentIndexChanged(int)),
|
|
1033 | + connect(lcdFilterComboBox_, SIGNAL(currentIndexChanged(int)),
|
|
1033 | 1034 | SLOT(checkLcdFilter()));
|
1034 | 1035 | |
1035 | - connect(autoHintingCheckBox, SIGNAL(clicked()),
|
|
1036 | + connect(autoHintingCheckBox_, SIGNAL(clicked()),
|
|
1036 | 1037 | SLOT(checkAutoHinting()));
|
1037 | - connect(showBitmapCheckBox, SIGNAL(clicked()),
|
|
1038 | + connect(showBitmapCheckBox_, SIGNAL(clicked()),
|
|
1038 | 1039 | SLOT(drawGlyph()));
|
1039 | - connect(showPointsCheckBox, SIGNAL(clicked()),
|
|
1040 | + connect(showPointsCheckBox_, SIGNAL(clicked()),
|
|
1040 | 1041 | SLOT(checkShowPoints()));
|
1041 | - connect(showPointNumbersCheckBox, SIGNAL(clicked()),
|
|
1042 | + connect(showPointNumbersCheckBox_, SIGNAL(clicked()),
|
|
1042 | 1043 | SLOT(drawGlyph()));
|
1043 | - connect(showOutlinesCheckBox, SIGNAL(clicked()),
|
|
1044 | + connect(showOutlinesCheckBox_, SIGNAL(clicked()),
|
|
1044 | 1045 | SLOT(drawGlyph()));
|
1045 | 1046 | |
1046 | - connect(sizeDoubleSpinBox, SIGNAL(valueChanged(double)),
|
|
1047 | + connect(sizeDoubleSpinBox_, SIGNAL(valueChanged(double)),
|
|
1047 | 1048 | SLOT(drawGlyph()));
|
1048 | - connect(unitsComboBox, SIGNAL(currentIndexChanged(int)),
|
|
1049 | + connect(unitsComboBox_, SIGNAL(currentIndexChanged(int)),
|
|
1049 | 1050 | SLOT(checkUnits()));
|
1050 | - connect(dpiSpinBox, SIGNAL(valueChanged(int)),
|
|
1051 | + connect(dpiSpinBox_, SIGNAL(valueChanged(int)),
|
|
1051 | 1052 | SLOT(drawGlyph()));
|
1052 | 1053 | |
1053 | - connect(zoomSpinBox, SIGNAL(valueChanged(int)),
|
|
1054 | + connect(zoomSpinBox_, SIGNAL(valueChanged(int)),
|
|
1054 | 1055 | SLOT(zoom()));
|
1055 | 1056 | |
1056 | - connect(previousFontButton, SIGNAL(clicked()),
|
|
1057 | + connect(previousFontButton_, SIGNAL(clicked()),
|
|
1057 | 1058 | SLOT(previousFont()));
|
1058 | - connect(nextFontButton, SIGNAL(clicked()),
|
|
1059 | + connect(nextFontButton_, SIGNAL(clicked()),
|
|
1059 | 1060 | SLOT(nextFont()));
|
1060 | - connect(previousFaceButton, SIGNAL(clicked()),
|
|
1061 | + connect(previousFaceButton_, SIGNAL(clicked()),
|
|
1061 | 1062 | SLOT(previousFace()));
|
1062 | - connect(nextFaceButton, SIGNAL(clicked()),
|
|
1063 | + connect(nextFaceButton_, SIGNAL(clicked()),
|
|
1063 | 1064 | SLOT(nextFace()));
|
1064 | - connect(previousNamedInstanceButton, SIGNAL(clicked()),
|
|
1065 | + connect(previousNamedInstanceButton_, SIGNAL(clicked()),
|
|
1065 | 1066 | SLOT(previousNamedInstance()));
|
1066 | - connect(nextNamedInstanceButton, SIGNAL(clicked()),
|
|
1067 | + connect(nextNamedInstanceButton_, SIGNAL(clicked()),
|
|
1067 | 1068 | SLOT(nextNamedInstance()));
|
1068 | 1069 | |
1069 | - glyphNavigationMapper = new QSignalMapper;
|
|
1070 | - connect(glyphNavigationMapper, SIGNAL(mapped(int)),
|
|
1070 | + glyphNavigationMapper_ = new QSignalMapper;
|
|
1071 | + connect(glyphNavigationMapper_, SIGNAL(mapped(int)),
|
|
1071 | 1072 | SLOT(adjustGlyphIndex(int)));
|
1072 | 1073 | |
1073 | - connect(toStartButtonx, SIGNAL(clicked()),
|
|
1074 | - glyphNavigationMapper, SLOT(map()));
|
|
1075 | - connect(toM1000Buttonx, SIGNAL(clicked()),
|
|
1076 | - glyphNavigationMapper, SLOT(map()));
|
|
1077 | - connect(toM100Buttonx, SIGNAL(clicked()),
|
|
1078 | - glyphNavigationMapper, SLOT(map()));
|
|
1079 | - connect(toM10Buttonx, SIGNAL(clicked()),
|
|
1080 | - glyphNavigationMapper, SLOT(map()));
|
|
1081 | - connect(toM1Buttonx, SIGNAL(clicked()),
|
|
1082 | - glyphNavigationMapper, SLOT(map()));
|
|
1083 | - connect(toP1Buttonx, SIGNAL(clicked()),
|
|
1084 | - glyphNavigationMapper, SLOT(map()));
|
|
1085 | - connect(toP10Buttonx, SIGNAL(clicked()),
|
|
1086 | - glyphNavigationMapper, SLOT(map()));
|
|
1087 | - connect(toP100Buttonx, SIGNAL(clicked()),
|
|
1088 | - glyphNavigationMapper, SLOT(map()));
|
|
1089 | - connect(toP1000Buttonx, SIGNAL(clicked()),
|
|
1090 | - glyphNavigationMapper, SLOT(map()));
|
|
1091 | - connect(toEndButtonx, SIGNAL(clicked()),
|
|
1092 | - glyphNavigationMapper, SLOT(map()));
|
|
1093 | - |
|
1094 | - glyphNavigationMapper->setMapping(toStartButtonx, -0x10000);
|
|
1095 | - glyphNavigationMapper->setMapping(toM1000Buttonx, -1000);
|
|
1096 | - glyphNavigationMapper->setMapping(toM100Buttonx, -100);
|
|
1097 | - glyphNavigationMapper->setMapping(toM10Buttonx, -10);
|
|
1098 | - glyphNavigationMapper->setMapping(toM1Buttonx, -1);
|
|
1099 | - glyphNavigationMapper->setMapping(toP1Buttonx, 1);
|
|
1100 | - glyphNavigationMapper->setMapping(toP10Buttonx, 10);
|
|
1101 | - glyphNavigationMapper->setMapping(toP100Buttonx, 100);
|
|
1102 | - glyphNavigationMapper->setMapping(toP1000Buttonx, 1000);
|
|
1103 | - glyphNavigationMapper->setMapping(toEndButtonx, 0x10000);
|
|
1104 | - |
|
1105 | - connect(fontWatcher, SIGNAL(fileChanged(const QString&)),
|
|
1106 | - SLOT(watchCurrentFont()));
|
|
1107 | - connect(timer, SIGNAL(timeout()),
|
|
1108 | - SLOT(watchCurrentFont()));
|
|
1074 | + connect(toStartButtonx_, SIGNAL(clicked()),
|
|
1075 | + glyphNavigationMapper_, SLOT(map()));
|
|
1076 | + connect(toM1000Buttonx_, SIGNAL(clicked()),
|
|
1077 | + glyphNavigationMapper_, SLOT(map()));
|
|
1078 | + connect(toM100Buttonx_, SIGNAL(clicked()),
|
|
1079 | + glyphNavigationMapper_, SLOT(map()));
|
|
1080 | + connect(toM10Buttonx_, SIGNAL(clicked()),
|
|
1081 | + glyphNavigationMapper_, SLOT(map()));
|
|
1082 | + connect(toM1Buttonx_, SIGNAL(clicked()),
|
|
1083 | + glyphNavigationMapper_, SLOT(map()));
|
|
1084 | + connect(toP1Buttonx_, SIGNAL(clicked()),
|
|
1085 | + glyphNavigationMapper_, SLOT(map()));
|
|
1086 | + connect(toP10Buttonx_, SIGNAL(clicked()),
|
|
1087 | + glyphNavigationMapper_, SLOT(map()));
|
|
1088 | + connect(toP100Buttonx_, SIGNAL(clicked()),
|
|
1089 | + glyphNavigationMapper_, SLOT(map()));
|
|
1090 | + connect(toP1000Buttonx_, SIGNAL(clicked()),
|
|
1091 | + glyphNavigationMapper_, SLOT(map()));
|
|
1092 | + connect(toEndButtonx_, SIGNAL(clicked()),
|
|
1093 | + glyphNavigationMapper_, SLOT(map()));
|
|
1094 | + |
|
1095 | + glyphNavigationMapper_->setMapping(toStartButtonx_, -0x10000);
|
|
1096 | + glyphNavigationMapper_->setMapping(toM1000Buttonx_, -1000);
|
|
1097 | + glyphNavigationMapper_->setMapping(toM100Buttonx_, -100);
|
|
1098 | + glyphNavigationMapper_->setMapping(toM10Buttonx_, -10);
|
|
1099 | + glyphNavigationMapper_->setMapping(toM1Buttonx_, -1);
|
|
1100 | + glyphNavigationMapper_->setMapping(toP1Buttonx_, 1);
|
|
1101 | + glyphNavigationMapper_->setMapping(toP10Buttonx_, 10);
|
|
1102 | + glyphNavigationMapper_->setMapping(toP100Buttonx_, 100);
|
|
1103 | + glyphNavigationMapper_->setMapping(toP1000Buttonx_, 1000);
|
|
1104 | + glyphNavigationMapper_->setMapping(toEndButtonx_, 0x10000);
|
|
1109 | 1105 | }
|
1110 | 1106 | |
1111 | 1107 | |
1112 | 1108 | void
|
1113 | 1109 | MainGUI::createActions()
|
1114 | 1110 | {
|
1115 | - loadFontsAct = new QAction(tr("&Load Fonts"), this);
|
|
1116 | - loadFontsAct->setShortcuts(QKeySequence::Open);
|
|
1117 | - connect(loadFontsAct, SIGNAL(triggered()), SLOT(loadFonts()));
|
|
1111 | + loadFontsAct_ = new QAction(tr("&Load Fonts"), this);
|
|
1112 | + loadFontsAct_->setShortcuts(QKeySequence::Open);
|
|
1113 | + connect(loadFontsAct_, SIGNAL(triggered()), SLOT(loadFonts()));
|
|
1118 | 1114 | |
1119 | - closeFontAct = new QAction(tr("&Close Font"), this);
|
|
1120 | - closeFontAct->setShortcuts(QKeySequence::Close);
|
|
1121 | - connect(closeFontAct, SIGNAL(triggered()), SLOT(closeFont()));
|
|
1115 | + closeFontAct_ = new QAction(tr("&Close Font"), this);
|
|
1116 | + closeFontAct_->setShortcuts(QKeySequence::Close);
|
|
1117 | + connect(closeFontAct_, SIGNAL(triggered()), SLOT(closeFont()));
|
|
1122 | 1118 | |
1123 | - exitAct = new QAction(tr("E&xit"), this);
|
|
1124 | - exitAct->setShortcuts(QKeySequence::Quit);
|
|
1125 | - connect(exitAct, SIGNAL(triggered()), SLOT(close()));
|
|
1119 | + exitAct_ = new QAction(tr("E&xit"), this);
|
|
1120 | + exitAct_->setShortcuts(QKeySequence::Quit);
|
|
1121 | + connect(exitAct_, SIGNAL(triggered()), SLOT(close()));
|
|
1126 | 1122 | |
1127 | - aboutAct = new QAction(tr("&About"), this);
|
|
1128 | - connect(aboutAct, SIGNAL(triggered()), SLOT(about()));
|
|
1123 | + aboutAct_ = new QAction(tr("&About"), this);
|
|
1124 | + connect(aboutAct_, SIGNAL(triggered()), SLOT(about()));
|
|
1129 | 1125 | |
1130 | - aboutQtAct = new QAction(tr("About &Qt"), this);
|
|
1131 | - connect(aboutQtAct, SIGNAL(triggered()), SLOT(aboutQt()));
|
|
1126 | + aboutQtAct_ = new QAction(tr("About &Qt"), this);
|
|
1127 | + connect(aboutQtAct_, SIGNAL(triggered()), SLOT(aboutQt()));
|
|
1132 | 1128 | }
|
1133 | 1129 | |
1134 | 1130 | |
1135 | 1131 | void
|
1136 | 1132 | MainGUI::createMenus()
|
1137 | 1133 | {
|
1138 | - menuFile = menuBar()->addMenu(tr("&File"));
|
|
1139 | - menuFile->addAction(loadFontsAct);
|
|
1140 | - menuFile->addAction(closeFontAct);
|
|
1141 | - menuFile->addAction(exitAct);
|
|
1142 | - |
|
1143 | - menuHelp = menuBar()->addMenu(tr("&Help"));
|
|
1144 | - menuHelp->addAction(aboutAct);
|
|
1145 | - menuHelp->addAction(aboutQtAct);
|
|
1134 | + menuFile_ = menuBar()->addMenu(tr("&File"));
|
|
1135 | + menuFile_->addAction(loadFontsAct_);
|
|
1136 | + menuFile_->addAction(closeFontAct_);
|
|
1137 | + menuFile_->addAction(exitAct_);
|
|
1138 | + |
|
1139 | + menuHelp_ = menuBar()->addMenu(tr("&Help"));
|
|
1140 | + menuHelp_->addAction(aboutAct_);
|
|
1141 | + menuHelp_->addAction(aboutQtAct_);
|
|
1146 | 1142 | }
|
1147 | 1143 | |
1148 | 1144 | |
... | ... | @@ -1153,80 +1149,49 @@ MainGUI::createStatusBar() |
1153 | 1149 | }
|
1154 | 1150 | |
1155 | 1151 | |
1156 | -void
|
|
1157 | -MainGUI::clearStatusBar()
|
|
1158 | -{
|
|
1159 | - statusBar()->clearMessage();
|
|
1160 | - statusBar()->setStyleSheet("");
|
|
1161 | -}
|
|
1162 | - |
|
1163 | - |
|
1164 | 1152 | void
|
1165 | 1153 | MainGUI::setDefaults()
|
1166 | 1154 | {
|
1167 | - // set up mappings between property values and combo box indices
|
|
1168 | - hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_35] = HintingMode_TrueType_v35;
|
|
1169 | - hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_38] = HintingMode_TrueType_v38;
|
|
1170 | - hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_40] = HintingMode_TrueType_v40;
|
|
1171 | - |
|
1172 | - hintingModesCFFHash[FT_HINTING_FREETYPE] = HintingMode_CFF_FreeType;
|
|
1173 | - hintingModesCFFHash[FT_HINTING_ADOBE] = HintingMode_CFF_Adobe;
|
|
1174 | - |
|
1175 | - lcdFilterHash[FT_LCD_FILTER_DEFAULT] = LCDFilter_Default;
|
|
1176 | - lcdFilterHash[FT_LCD_FILTER_LIGHT] = LCDFilter_Light;
|
|
1177 | - lcdFilterHash[FT_LCD_FILTER_NONE] = LCDFilter_None;
|
|
1178 | - lcdFilterHash[FT_LCD_FILTER_LEGACY] = LCDFilter_Legacy;
|
|
1179 | - |
|
1180 | - // make copies and remove existing elements...
|
|
1181 | - QHash<int, int> hmTTHash = hintingModesTrueTypeHash;
|
|
1182 | - if (hmTTHash.contains(engine->ttInterpreterVersionDefault))
|
|
1183 | - hmTTHash.remove(engine->ttInterpreterVersionDefault);
|
|
1184 | - if (hmTTHash.contains(engine->ttInterpreterVersionOther))
|
|
1185 | - hmTTHash.remove(engine->ttInterpreterVersionOther);
|
|
1186 | - if (hmTTHash.contains(engine->ttInterpreterVersionOther1))
|
|
1187 | - hmTTHash.remove(engine->ttInterpreterVersionOther1);
|
|
1188 | - |
|
1189 | - QHash<int, int> hmCFFHash = hintingModesCFFHash;
|
|
1190 | - if (hmCFFHash.contains(engine->cffHintingEngineDefault))
|
|
1191 | - hmCFFHash.remove(engine->cffHintingEngineDefault);
|
|
1192 | - if (hmCFFHash.contains(engine->cffHintingEngineOther))
|
|
1193 | - hmCFFHash.remove(engine->cffHintingEngineOther);
|
|
1194 | - |
|
1195 | - // ... to construct a list of always disabled hinting mode combo box items
|
|
1196 | - hintingModesAlwaysDisabled = hmTTHash.values();
|
|
1197 | - hintingModesAlwaysDisabled += hmCFFHash.values();
|
|
1198 | - |
|
1199 | - for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++)
|
|
1200 | - hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i],
|
|
1201 | - false);
|
|
1155 | + Engine::EngineDefaultValues& defaults = engine_->engineDefaults();
|
|
1202 | 1156 | |
1203 | - // the next four values always non-negative
|
|
1204 | - currentFontIndex = 0;
|
|
1205 | - currentFaceIndex = 0;
|
|
1206 | - currentNamedInstanceIndex = 0;
|
|
1207 | - currentGlyphIndex = 0;
|
|
1208 | - |
|
1209 | - currentCFFHintingMode
|
|
1210 | - = hintingModesCFFHash[engine->cffHintingEngineDefault];
|
|
1211 | - currentTTInterpreterVersion
|
|
1212 | - = hintingModesTrueTypeHash[engine->ttInterpreterVersionDefault];
|
|
1213 | - |
|
1214 | - hintingCheckBox->setChecked(true);
|
|
1215 | - |
|
1216 | - antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal);
|
|
1217 | - lcdFilterComboBox->setCurrentIndex(LCDFilter_Light);
|
|
1157 | + hintingModeComboBoxModel_->setSupportedModes(
|
|
1158 | + { defaults.ttInterpreterVersionDefault,
|
|
1159 | + defaults.ttInterpreterVersionOther,
|
|
1160 | + defaults.ttInterpreterVersionOther1 },
|
|
1161 | + { defaults.cffHintingEngineDefault,
|
|
1162 | + defaults.cffHintingEngineOther });
|
|
1218 | 1163 | |
1219 | - horizontalHintingCheckBox->setChecked(true);
|
|
1220 | - verticalHintingCheckBox->setChecked(true);
|
|
1221 | - blueZoneHintingCheckBox->setChecked(true);
|
|
1222 | - |
|
1223 | - showBitmapCheckBox->setChecked(true);
|
|
1224 | - showOutlinesCheckBox->setChecked(true);
|
|
1225 | - |
|
1226 | - gammaSlider->setValue(18); // 1.8
|
|
1227 | - sizeDoubleSpinBox->setValue(20);
|
|
1228 | - dpiSpinBox->setValue(96);
|
|
1229 | - zoomSpinBox->setValue(20);
|
|
1164 | + // the next four values always non-negative
|
|
1165 | + currentFontIndex_ = 0;
|
|
1166 | + currentFaceIndex_ = 0;
|
|
1167 | + currentNamedInstanceIndex_ = 0;
|
|
1168 | + currentGlyphIndex_ = 0;
|
|
1169 | + |
|
1170 | + currentCFFHintingMode_
|
|
1171 | + = hintingModeComboBoxModel_->cffModeToIndex(
|
|
1172 | + defaults.cffHintingEngineDefault);
|
|
1173 | + currentTTInterpreterVersion_
|
|
1174 | + = hintingModeComboBoxModel_->ttInterpreterVersionToIndex(
|
|
1175 | + defaults.ttInterpreterVersionDefault);
|
|
1176 | + |
|
1177 | + hintingCheckBox_->setChecked(true);
|
|
1178 | + |
|
1179 | + antiAliasingComboBox_->setCurrentIndex(
|
|
1180 | + AntiAliasingComboBoxModel::AntiAliasing_Normal);
|
|
1181 | + lcdFilterComboBox_->setCurrentIndex(
|
|
1182 | + LCDFilterComboBoxModel::LCDFilter_Light);
|
|
1183 | + |
|
1184 | + horizontalHintingCheckBox_->setChecked(true);
|
|
1185 | + verticalHintingCheckBox_->setChecked(true);
|
|
1186 | + blueZoneHintingCheckBox_->setChecked(true);
|
|
1187 | + |
|
1188 | + showBitmapCheckBox_->setChecked(true);
|
|
1189 | + showOutlinesCheckBox_->setChecked(true);
|
|
1190 | + |
|
1191 | + gammaSlider_->setValue(18); // 1.8
|
|
1192 | + sizeDoubleSpinBox_->setValue(20);
|
|
1193 | + dpiSpinBox_->setValue(96);
|
|
1194 | + zoomSpinBox_->setValue(20);
|
|
1230 | 1195 | |
1231 | 1196 | checkHinting();
|
1232 | 1197 | checkHintingMode();
|
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #include "widgets/qgraphicsviewx.hpp"
|
15 | 15 | #include "widgets/qpushbuttonx.hpp"
|
16 | 16 | #include "widgets/qspinboxx.hpp"
|
17 | +#include "models/ttsettingscomboboxmodel.hpp"
|
|
17 | 18 | |
18 | 19 | #include <QAction>
|
19 | 20 | #include <QCheckBox>
|
... | ... | @@ -94,188 +95,161 @@ private slots: |
94 | 95 | void zoom();
|
95 | 96 | |
96 | 97 | private:
|
97 | - Engine* engine;
|
|
98 | + Engine* engine_;
|
|
99 | +
|
|
100 | + int currentFontIndex_;
|
|
98 | 101 | |
99 | - QStringList fontList;
|
|
100 | - int currentFontIndex;
|
|
102 | + long currentNumberOfFaces_;
|
|
103 | + long currentFaceIndex_;
|
|
101 | 104 | |
102 | - long currentNumberOfFaces;
|
|
103 | - long currentFaceIndex;
|
|
105 | + int currentNumberOfNamedInstances_;
|
|
106 | + int currentNamedInstanceIndex_;
|
|
104 | 107 | |
105 | - int currentNumberOfNamedInstances;
|
|
106 | - int currentNamedInstanceIndex;
|
|
108 | + int currentNumberOfGlyphs_;
|
|
109 | + int currentGlyphIndex_;
|
|
107 | 110 | |
108 | - int currentNumberOfGlyphs;
|
|
109 | - int currentGlyphIndex;
|
|
110 | - |
|
111 | - int currentCFFHintingMode;
|
|
112 | - int currentTTInterpreterVersion;
|
|
111 | + int currentCFFHintingMode_;
|
|
112 | + int currentTTInterpreterVersion_;
|
|
113 | 113 | |
114 | 114 | // layout related stuff
|
115 | - GlyphOutline *currentGlyphOutlineItem;
|
|
116 | - GlyphPoints *currentGlyphPointsItem;
|
|
117 | - GlyphPointNumbers *currentGlyphPointNumbersItem;
|
|
118 | - GlyphBitmap *currentGlyphBitmapItem;
|
|
119 | - |
|
120 | - QAction *aboutAct;
|
|
121 | - QAction *aboutQtAct;
|
|
122 | - QAction *closeFontAct;
|
|
123 | - QAction *exitAct;
|
|
124 | - QAction *loadFontsAct;
|
|
125 | - |
|
126 | - QCheckBox *autoHintingCheckBox;
|
|
127 | - QCheckBox *blueZoneHintingCheckBox;
|
|
128 | - QCheckBox *hintingCheckBox;
|
|
129 | - QCheckBox *horizontalHintingCheckBox;
|
|
130 | - QCheckBox *segmentDrawingCheckBox;
|
|
131 | - QCheckBox *showBitmapCheckBox;
|
|
132 | - QCheckBox *showOutlinesCheckBox;
|
|
133 | - QCheckBox *showPointNumbersCheckBox;
|
|
134 | - QCheckBox *showPointsCheckBox;
|
|
135 | - QCheckBox *verticalHintingCheckBox;
|
|
136 | - |
|
137 | - QComboBoxx *antiAliasingComboBoxx;
|
|
138 | - QComboBoxx *hintingModeComboBoxx;
|
|
139 | - QComboBox *lcdFilterComboBox;
|
|
140 | - QComboBox *unitsComboBox;
|
|
141 | - |
|
142 | - QDoubleSpinBox *sizeDoubleSpinBox;
|
|
143 | - |
|
144 | - QFileSystemWatcher *fontWatcher;
|
|
145 | - |
|
146 | - QGraphicsScene *glyphScene;
|
|
147 | - QGraphicsViewx *glyphView;
|
|
115 | + GlyphOutline *currentGlyphOutlineItem_;
|
|
116 | + GlyphPoints *currentGlyphPointsItem_;
|
|
117 | + GlyphPointNumbers *currentGlyphPointNumbersItem_;
|
|
118 | + GlyphBitmap *currentGlyphBitmapItem_;
|
|
119 | + |
|
120 | + QAction *aboutAct_;
|
|
121 | + QAction *aboutQtAct_;
|
|
122 | + QAction *closeFontAct_;
|
|
123 | + QAction *exitAct_;
|
|
124 | + QAction *loadFontsAct_;
|
|
125 | + |
|
126 | + QCheckBox *autoHintingCheckBox_;
|
|
127 | + QCheckBox *blueZoneHintingCheckBox_;
|
|
128 | + QCheckBox *hintingCheckBox_;
|
|
129 | + QCheckBox *horizontalHintingCheckBox_;
|
|
130 | + QCheckBox *segmentDrawingCheckBox_;
|
|
131 | + QCheckBox *showBitmapCheckBox_;
|
|
132 | + QCheckBox *showOutlinesCheckBox_;
|
|
133 | + QCheckBox *showPointNumbersCheckBox_;
|
|
134 | + QCheckBox *showPointsCheckBox_;
|
|
135 | + QCheckBox *verticalHintingCheckBox_;
|
|
136 | + |
|
137 | + AntiAliasingComboBoxModel* antiAliasingComboBoxModel_;
|
|
138 | + HintingModeComboBoxModel* hintingModeComboBoxModel_;
|
|
139 | + LCDFilterComboBoxModel* lcdFilterComboboxModel_;
|
|
140 | + |
|
141 | + QComboBox *antiAliasingComboBox_;
|
|
142 | + QComboBox *hintingModeComboBox_;
|
|
143 | + QComboBox *lcdFilterComboBox_;
|
|
144 | + QComboBox *unitsComboBox_;
|
|
145 | + |
|
146 | + QDoubleSpinBox *sizeDoubleSpinBox_;
|
|
147 | + |
|
148 | + QGraphicsScene *glyphScene_;
|
|
149 | + QGraphicsViewx *glyphView_;
|
|
148 | 150 | |
149 | 151 | QGridLayout *fontLayout;
|
150 | 152 | QGridLayout *infoRightLayout;
|
151 | 153 | |
152 | - QHash<int, int> hintingModesTrueTypeHash;
|
|
153 | - QHash<int, int> hintingModesCFFHash;
|
|
154 | - QHash<FT_LcdFilter, int> lcdFilterHash;
|
|
155 | - |
|
156 | - QHBoxLayout *antiAliasingLayout;
|
|
157 | - QHBoxLayout *blueZoneHintingLayout;
|
|
158 | - QHBoxLayout *ftinspectLayout;
|
|
159 | - QHBoxLayout *gammaLayout;
|
|
160 | - QHBoxLayout *hintingModeLayout;
|
|
161 | - QHBoxLayout *horizontalHintingLayout;
|
|
162 | - QHBoxLayout *infoLeftLayout;
|
|
163 | - QHBoxLayout *lcdFilterLayout;
|
|
164 | - QHBoxLayout *navigationLayout;
|
|
165 | - QHBoxLayout *pointNumbersLayout;
|
|
166 | - QHBoxLayout *segmentDrawingLayout;
|
|
167 | - QHBoxLayout *sizeLayout;
|
|
168 | - QHBoxLayout *verticalHintingLayout;
|
|
169 | - |
|
170 | - QLabel *antiAliasingLabel;
|
|
171 | - QLabel *dpiLabel;
|
|
172 | - QLabel *fontFilenameLabel;
|
|
173 | - QLabel *fontNameLabel;
|
|
174 | - QLabel *gammaLabel;
|
|
175 | - QLabel *glyphIndexLabel;
|
|
176 | - QLabel *glyphNameLabel;
|
|
177 | - QLabel *hintingModeLabel;
|
|
178 | - QLabel *lcdFilterLabel;
|
|
179 | - QLabel *sizeLabel;
|
|
180 | - QLabel *zoomLabel;
|
|
181 | - |
|
182 | - QList<int> hintingModesAlwaysDisabled;
|
|
183 | - |
|
184 | - QLocale *locale;
|
|
185 | - |
|
186 | - QMenu *menuFile;
|
|
187 | - QMenu *menuHelp;
|
|
188 | - |
|
189 | - QPen axisPen;
|
|
190 | - QPen blueZonePen;
|
|
191 | - QPen gridPen;
|
|
192 | - QPen offPen;
|
|
193 | - QPen onPen;
|
|
194 | - QPen outlinePen;
|
|
195 | - QPen segmentPen;
|
|
196 | - |
|
197 | - QPushButton *nextFaceButton;
|
|
198 | - QPushButton *nextFontButton;
|
|
199 | - QPushButton *nextNamedInstanceButton;
|
|
200 | - QPushButton *previousFaceButton;
|
|
201 | - QPushButton *previousFontButton;
|
|
202 | - QPushButton *previousNamedInstanceButton;
|
|
203 | - |
|
204 | - QPushButtonx *toEndButtonx;
|
|
205 | - QPushButtonx *toM1000Buttonx;
|
|
206 | - QPushButtonx *toM100Buttonx;
|
|
207 | - QPushButtonx *toM10Buttonx;
|
|
208 | - QPushButtonx *toM1Buttonx;
|
|
209 | - QPushButtonx *toP1000Buttonx;
|
|
210 | - QPushButtonx *toP100Buttonx;
|
|
211 | - QPushButtonx *toP10Buttonx;
|
|
212 | - QPushButtonx *toP1Buttonx;
|
|
213 | - QPushButtonx *toStartButtonx;
|
|
214 | - |
|
215 | - QSignalMapper *glyphNavigationMapper;
|
|
216 | - |
|
217 | - QSlider *gammaSlider;
|
|
218 | - |
|
219 | - QSpinBox *dpiSpinBox;
|
|
220 | - QSpinBoxx *zoomSpinBox;
|
|
221 | - |
|
222 | - QTabWidget *tabWidget;
|
|
223 | - |
|
224 | - QTimer *timer;
|
|
225 | - |
|
226 | - QVBoxLayout *generalTabLayout;
|
|
227 | - QVBoxLayout *leftLayout;
|
|
228 | - QVBoxLayout *rightLayout;
|
|
229 | - |
|
230 | - QVector<QRgb> grayColorTable;
|
|
231 | - QVector<QRgb> monoColorTable;
|
|
232 | - |
|
233 | - QWidget *ftinspectWidget;
|
|
234 | - QWidget *generalTabWidget;
|
|
235 | - QWidget *leftWidget;
|
|
236 | - QWidget *rightWidget;
|
|
237 | - QWidget *mmgxTabWidget;
|
|
238 | - |
|
239 | - enum AntiAliasing
|
|
240 | - {
|
|
241 | - AntiAliasing_None,
|
|
242 | - AntiAliasing_Normal,
|
|
243 | - AntiAliasing_Light,
|
|
244 | - AntiAliasing_LCD,
|
|
245 | - AntiAliasing_LCD_BGR,
|
|
246 | - AntiAliasing_LCD_Vertical,
|
|
247 | - AntiAliasing_LCD_Vertical_BGR
|
|
248 | - };
|
|
249 | - enum HintingMode
|
|
250 | - {
|
|
251 | - HintingMode_TrueType_v35,
|
|
252 | - HintingMode_TrueType_v38,
|
|
253 | - HintingMode_TrueType_v40,
|
|
254 | - HintingMode_CFF_FreeType,
|
|
255 | - HintingMode_CFF_Adobe
|
|
256 | - };
|
|
257 | - enum LCDFilter
|
|
258 | - {
|
|
259 | - LCDFilter_Default,
|
|
260 | - LCDFilter_Light,
|
|
261 | - LCDFilter_None,
|
|
262 | - LCDFilter_Legacy
|
|
263 | - };
|
|
154 | + QHBoxLayout *antiAliasingLayout_;
|
|
155 | + QHBoxLayout *blueZoneHintingLayout_;
|
|
156 | + QHBoxLayout *ftinspectLayout_;
|
|
157 | + QHBoxLayout *gammaLayout_;
|
|
158 | + QHBoxLayout *hintingModeLayout_;
|
|
159 | + QHBoxLayout *horizontalHintingLayout_;
|
|
160 | + QHBoxLayout *infoLeftLayout_;
|
|
161 | + QHBoxLayout *lcdFilterLayout_;
|
|
162 | + QHBoxLayout *navigationLayout_;
|
|
163 | + QHBoxLayout *pointNumbersLayout_;
|
|
164 | + QHBoxLayout *segmentDrawingLayout_;
|
|
165 | + QHBoxLayout *sizeLayout_;
|
|
166 | + QHBoxLayout *verticalHintingLayout_;
|
|
167 | + |
|
168 | + QLabel *antiAliasingLabel_;
|
|
169 | + QLabel *dpiLabel_;
|
|
170 | + QLabel *fontFilenameLabel_;
|
|
171 | + QLabel *fontNameLabel_;
|
|
172 | + QLabel *gammaLabel_;
|
|
173 | + QLabel *glyphIndexLabel_;
|
|
174 | + QLabel *glyphNameLabel_;
|
|
175 | + QLabel *hintingModeLabel_;
|
|
176 | + QLabel *lcdFilterLabel_;
|
|
177 | + QLabel *sizeLabel_;
|
|
178 | + QLabel *zoomLabel_;
|
|
179 | + |
|
180 | + QList<int> hintingModesAlwaysDisabled_;
|
|
181 | + |
|
182 | + QLocale *locale_;
|
|
183 | + |
|
184 | + QMenu *menuFile_;
|
|
185 | + QMenu *menuHelp_;
|
|
186 | + |
|
187 | + QPen axisPen_;
|
|
188 | + QPen blueZonePen_;
|
|
189 | + QPen gridPen_;
|
|
190 | + QPen offPen_;
|
|
191 | + QPen onPen_;
|
|
192 | + QPen outlinePen_;
|
|
193 | + QPen segmentPen_;
|
|
194 | + |
|
195 | + QPushButton *nextFaceButton_;
|
|
196 | + QPushButton *nextFontButton_;
|
|
197 | + QPushButton *nextNamedInstanceButton_;
|
|
198 | + QPushButton *previousFaceButton_;
|
|
199 | + QPushButton *previousFontButton_;
|
|
200 | + QPushButton *previousNamedInstanceButton_;
|
|
201 | + |
|
202 | + QPushButtonx *toEndButtonx_;
|
|
203 | + QPushButtonx *toM1000Buttonx_;
|
|
204 | + QPushButtonx *toM100Buttonx_;
|
|
205 | + QPushButtonx *toM10Buttonx_;
|
|
206 | + QPushButtonx *toM1Buttonx_;
|
|
207 | + QPushButtonx *toP1000Buttonx_;
|
|
208 | + QPushButtonx *toP100Buttonx_;
|
|
209 | + QPushButtonx *toP10Buttonx_;
|
|
210 | + QPushButtonx *toP1Buttonx_;
|
|
211 | + QPushButtonx *toStartButtonx_;
|
|
212 | + |
|
213 | + QSignalMapper *glyphNavigationMapper_;
|
|
214 | + |
|
215 | + QSlider *gammaSlider_;
|
|
216 | + |
|
217 | + QSpinBox *dpiSpinBox_;
|
|
218 | + QSpinBoxx *zoomSpinBox_;
|
|
219 | + |
|
220 | + QTabWidget *tabWidget_;
|
|
221 | + |
|
222 | + QVBoxLayout *generalTabLayout_;
|
|
223 | + QVBoxLayout *leftLayout_;
|
|
224 | + QVBoxLayout *rightLayout_;
|
|
225 | + |
|
226 | + QVector<QRgb> grayColorTable_;
|
|
227 | + QVector<QRgb> monoColorTable_;
|
|
228 | + |
|
229 | + QWidget *ftinspectWidget_;
|
|
230 | + QWidget *generalTabWidget_;
|
|
231 | + QWidget *leftWidget_;
|
|
232 | + QWidget *rightWidget_;
|
|
233 | + QWidget *mmgxTabWidget_;
|
|
234 | + |
|
264 | 235 | enum Units
|
265 | 236 | {
|
266 | 237 | Units_px,
|
267 | 238 | Units_pt
|
268 | 239 | };
|
269 | 240 | |
241 | + void showFont();
|
|
242 | + void syncSettings();
|
|
243 | + void clearStatusBar();
|
|
244 | + |
|
270 | 245 | void createActions();
|
271 | 246 | void createConnections();
|
272 | 247 | void createLayout();
|
273 | 248 | void createMenus();
|
274 | - void clearStatusBar();
|
|
275 | 249 | void createStatusBar();
|
276 | - void readSettings();
|
|
277 | 250 | void setGraphicsDefaults();
|
278 | - void showFont();
|
|
251 | + |
|
252 | + void readSettings();
|
|
279 | 253 | void writeSettings();
|
280 | 254 | };
|
281 | 255 |
... | ... | @@ -21,18 +21,24 @@ qt5_dep = dependency('qt5', |
21 | 21 | if qt5_dep.found()
|
22 | 22 | sources = files([
|
23 | 23 | 'engine/engine.cpp',
|
24 | + 'engine/fontfilemanager.cpp',
|
|
25 | + |
|
24 | 26 | 'rendering/glyphbitmap.cpp',
|
25 | 27 | 'rendering/glyphoutline.cpp',
|
26 | 28 | 'rendering/glyphpointnumbers.cpp',
|
27 | 29 | 'rendering/glyphpoints.cpp',
|
28 | 30 | 'rendering/grid.cpp',
|
31 | + |
|
29 | 32 | 'widgets/qcomboboxx.cpp',
|
30 | 33 | 'widgets/qgraphicsviewx.cpp',
|
31 | 34 | 'widgets/qpushbuttonx.cpp',
|
32 | 35 | 'widgets/qspinboxx.cpp',
|
36 | + |
|
37 | + 'models/ttsettingscomboboxmodel.cpp',
|
|
38 | + |
|
33 | 39 | 'ftinspect.cpp',
|
34 | 40 | 'maingui.cpp',
|
35 | - ])
|
|
41 | +])
|
|
36 | 42 | |
37 | 43 | moc_files = qt5.preprocess(
|
38 | 44 | moc_headers: [
|
... | ... | @@ -41,6 +47,7 @@ if qt5_dep.found() |
41 | 47 | 'widgets/qpushbuttonx.hpp',
|
42 | 48 | 'widgets/qspinboxx.hpp',
|
43 | 49 | 'maingui.hpp',
|
50 | + 'models/ttsettingscomboboxmodel.cpp',
|
|
44 | 51 | ],
|
45 | 52 | dependencies: qt5_dep)
|
46 | 53 |
1 | +// ttsettingscomboboxmodel.cpp
|
|
2 | + |
|
3 | +// Copyright (C) 2022 by Charlie Jiang.
|
|
4 | + |
|
5 | + |
|
6 | +#include "ttsettingscomboboxmodel.hpp"
|
|
7 | + |
|
8 | +#include <QApplication>
|
|
9 | +#include <QPalette>
|
|
10 | +#include <freetype/ftdriver.h>
|
|
11 | +#include <freetype/ftlcdfil.h>
|
|
12 | + |
|
13 | + |
|
14 | +/////////////////////////////////////////////////////////////////////////////
|
|
15 | +//
|
|
16 | +// HintingModeComboBoxModel
|
|
17 | +//
|
|
18 | +/////////////////////////////////////////////////////////////////////////////
|
|
19 | + |
|
20 | +HintingModeComboBoxModel::HintingModeComboBoxModel()
|
|
21 | +{
|
|
22 | + items_[HintingMode_TrueType_v35] = {
|
|
23 | + HintingEngineType_TrueType,
|
|
24 | + HintingMode_TrueType_v35,
|
|
25 | + TT_INTERPRETER_VERSION_35,
|
|
26 | + false, false,
|
|
27 | + "TrueType v35"
|
|
28 | + };
|
|
29 | + items_[HintingMode_TrueType_v38] = {
|
|
30 | + HintingEngineType_TrueType,
|
|
31 | + HintingMode_TrueType_v38,
|
|
32 | + TT_INTERPRETER_VERSION_38,
|
|
33 | + false, false,
|
|
34 | + "TrueType v38"
|
|
35 | + };
|
|
36 | + items_[HintingMode_TrueType_v40] = {
|
|
37 | + HintingEngineType_TrueType,
|
|
38 | + HintingMode_TrueType_v40,
|
|
39 | + TT_INTERPRETER_VERSION_40,
|
|
40 | + false, false,
|
|
41 | + "TrueType v40"
|
|
42 | + };
|
|
43 | + |
|
44 | + items_[HintingMode_CFF_FreeType] = {
|
|
45 | + HintingEngineType_CFF,
|
|
46 | + HintingMode_CFF_FreeType,
|
|
47 | + FT_HINTING_FREETYPE,
|
|
48 | + false, false,
|
|
49 | + "CFF (FreeType)"
|
|
50 | + };
|
|
51 | + items_[HintingMode_CFF_Adobe] = {
|
|
52 | + HintingEngineType_CFF,
|
|
53 | + HintingMode_CFF_Adobe,
|
|
54 | + FT_HINTING_ADOBE,
|
|
55 | + false, false,
|
|
56 | + "CFF (Adobe)"
|
|
57 | + };
|
|
58 | +}
|
|
59 | + |
|
60 | + |
|
61 | +int
|
|
62 | +HintingModeComboBoxModel::rowCount(const QModelIndex& parent) const
|
|
63 | +{
|
|
64 | + return items_.size();
|
|
65 | +}
|
|
66 | + |
|
67 | + |
|
68 | +QVariant
|
|
69 | +HintingModeComboBoxModel::data(const QModelIndex& index,
|
|
70 | + int role) const
|
|
71 | +{
|
|
72 | + int r = index.row();
|
|
73 | + if (r < 0 || r >= items_.size())
|
|
74 | + return QVariant {};
|
|
75 | + HintingModeItem const& item = items_[r];
|
|
76 | + |
|
77 | + switch (role)
|
|
78 | + {
|
|
79 | + case Qt::DisplayRole:
|
|
80 | + return item.displayName;
|
|
81 | + case Qt::ForegroundRole:
|
|
82 | + if (item.enabled && item.supported)
|
|
83 | + return QVariant {};
|
|
84 | + else
|
|
85 | + return QApplication::palette().color(QPalette::Disabled,
|
|
86 | + QPalette::Text);
|
|
87 | + default:
|
|
88 | + return QVariant {};
|
|
89 | + }
|
|
90 | +}
|
|
91 | + |
|
92 | + |
|
93 | +Qt::ItemFlags
|
|
94 | +HintingModeComboBoxModel::flags(const QModelIndex& index) const
|
|
95 | +{
|
|
96 | + int r = index.row();
|
|
97 | + if (r < 0 || r >= items_.size())
|
|
98 | + return Qt::ItemFlags {}; // not selectable, not enabled
|
|
99 | + HintingModeItem const& item = items_[r];
|
|
100 | + |
|
101 | + if (item.enabled && item.supported)
|
|
102 | + return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
|
103 | + |
|
104 | + return Qt::ItemFlags {};
|
|
105 | +}
|
|
106 | + |
|
107 | + |
|
108 | +int
|
|
109 | +HintingModeComboBoxModel::indexToValueForType(int index,
|
|
110 | + HintingEngineType type) const
|
|
111 | +{
|
|
112 | + if (index < 0 || index >= items_.size())
|
|
113 | + return -1;
|
|
114 | + HintingModeItem const& item = items_[index];
|
|
115 | + if (!item.supported || !item.enabled || item.type != type)
|
|
116 | + return -1;
|
|
117 | + return item.value;
|
|
118 | +}
|
|
119 | + |
|
120 | + |
|
121 | +int
|
|
122 | +HintingModeComboBoxModel::valueToIndexForType(int value,
|
|
123 | + HintingEngineType type) const
|
|
124 | +{
|
|
125 | + for (auto it = items_.begin();
|
|
126 | + it != items_.end();
|
|
127 | + ++it)
|
|
128 | + {
|
|
129 | + if (it->type == type && it->value == value)
|
|
130 | + return it->key;
|
|
131 | + }
|
|
132 | + return -1;
|
|
133 | +}
|
|
134 | + |
|
135 | + |
|
136 | +int
|
|
137 | +HintingModeComboBoxModel::indexToTTInterpreterVersion(int index) const
|
|
138 | +{
|
|
139 | + return indexToValueForType(index, HintingEngineType_TrueType);
|
|
140 | +}
|
|
141 | + |
|
142 | + |
|
143 | +int
|
|
144 | +HintingModeComboBoxModel::indexToCFFMode(int index) const
|
|
145 | +{
|
|
146 | + return indexToValueForType(index, HintingEngineType_CFF);
|
|
147 | +}
|
|
148 | + |
|
149 | + |
|
150 | +int
|
|
151 | +HintingModeComboBoxModel::cffModeToIndex(int mode) const
|
|
152 | +{
|
|
153 | + return valueToIndexForType(mode, HintingEngineType_CFF);
|
|
154 | +}
|
|
155 | + |
|
156 | + |
|
157 | +int
|
|
158 | +HintingModeComboBoxModel::ttInterpreterVersionToIndex(int version) const
|
|
159 | +{
|
|
160 | + return valueToIndexForType(version, HintingEngineType_TrueType);
|
|
161 | +}
|
|
162 | + |
|
163 | + |
|
164 | +void
|
|
165 | +HintingModeComboBoxModel::setSupportedModes(QList<int> supportedTTIVersions,
|
|
166 | + QList<int> supportedCFFModes)
|
|
167 | +{
|
|
168 | + for (auto it = items_.begin();
|
|
169 | + it != items_.end();
|
|
170 | + ++it)
|
|
171 | + {
|
|
172 | + if (it->type == HintingEngineType_TrueType)
|
|
173 | + it->supported = supportedTTIVersions.contains(it->value);
|
|
174 | + else if (it->type == HintingEngineType_CFF)
|
|
175 | + it->supported = supportedCFFModes.contains(it->value);
|
|
176 | + else
|
|
177 | + it->supported = false;
|
|
178 | + }
|
|
179 | +}
|
|
180 | + |
|
181 | + |
|
182 | +void
|
|
183 | +HintingModeComboBoxModel::setCurrentEngineType(HintingEngineType type)
|
|
184 | +{
|
|
185 | + for (auto it = items_.begin();
|
|
186 | + it != items_.end();
|
|
187 | + ++it)
|
|
188 | + it->enabled = it->supported && it->type == type;
|
|
189 | +}
|
|
190 | + |
|
191 | + |
|
192 | +/////////////////////////////////////////////////////////////////////////////
|
|
193 | +//
|
|
194 | +// SimpleComboBoxModel
|
|
195 | +//
|
|
196 | +/////////////////////////////////////////////////////////////////////////////
|
|
197 | + |
|
198 | + |
|
199 | +int
|
|
200 | +SimpleComboBoxModel::rowCount(const QModelIndex& parent) const
|
|
201 | +{
|
|
202 | + return items_.size();
|
|
203 | +}
|
|
204 | + |
|
205 | + |
|
206 | +QVariant
|
|
207 | +SimpleComboBoxModel::data(const QModelIndex& index, int role) const
|
|
208 | +{
|
|
209 | + if (role != Qt::DisplayRole)
|
|
210 | + return QVariant {};
|
|
211 | + |
|
212 | + int r = index.row();
|
|
213 | + if (r < 0 || r >= items_.size())
|
|
214 | + return QVariant {};
|
|
215 | + return items_[r].displayName;
|
|
216 | +}
|
|
217 | + |
|
218 | + |
|
219 | +int
|
|
220 | +SimpleComboBoxModel::indexToValue(int index)
|
|
221 | +{
|
|
222 | + if (index < 0 || index >= items_.size())
|
|
223 | + return -1;
|
|
224 | + return items_[index].value;
|
|
225 | +}
|
|
226 | + |
|
227 | + |
|
228 | +/////////////////////////////////////////////////////////////////////////////
|
|
229 | +//
|
|
230 | +// LCDFilterComboBoxModel
|
|
231 | +//
|
|
232 | +/////////////////////////////////////////////////////////////////////////////
|
|
233 | + |
|
234 | + |
|
235 | +LCDFilterComboBoxModel::LCDFilterComboBoxModel()
|
|
236 | +{
|
|
237 | + items_[LCDFilter_Default] = {
|
|
238 | + FT_LCD_FILTER_DEFAULT,
|
|
239 | + "Default"
|
|
240 | + };
|
|
241 | + items_[LCDFilter_Light] = {
|
|
242 | + FT_LCD_FILTER_LIGHT,
|
|
243 | + "Light"
|
|
244 | + };
|
|
245 | + items_[LCDFilter_None] = {
|
|
246 | + FT_LCD_FILTER_NONE,
|
|
247 | + "None"
|
|
248 | + };
|
|
249 | + items_[LCDFilter_Legacy] = {
|
|
250 | + FT_LCD_FILTER_LEGACY,
|
|
251 | + "Legacy"
|
|
252 | + };
|
|
253 | +}
|
|
254 | + |
|
255 | + |
|
256 | +/////////////////////////////////////////////////////////////////////////////
|
|
257 | +//
|
|
258 | +// AntiAliasingComboBoxModel
|
|
259 | +//
|
|
260 | +/////////////////////////////////////////////////////////////////////////////
|
|
261 | + |
|
262 | + |
|
263 | +AntiAliasingComboBoxModel::AntiAliasingComboBoxModel()
|
|
264 | +{
|
|
265 | + items_[AntiAliasing_None] = {
|
|
266 | + FT_LOAD_TARGET_MONO,
|
|
267 | + "None"
|
|
268 | + };
|
|
269 | + items_[AntiAliasing_Normal] = {
|
|
270 | + FT_LOAD_TARGET_NORMAL,
|
|
271 | + "Normal"
|
|
272 | + };
|
|
273 | + items_[AntiAliasing_Light] = {
|
|
274 | + FT_LOAD_TARGET_LIGHT,
|
|
275 | + "Light"
|
|
276 | + };
|
|
277 | + items_[AntiAliasing_LCD] = {
|
|
278 | + FT_LOAD_TARGET_LCD,
|
|
279 | + "LCD (RGB)"
|
|
280 | + };
|
|
281 | + items_[AntiAliasing_LCD_BGR] = {
|
|
282 | + FT_LOAD_TARGET_LCD,
|
|
283 | + "LCD (BGR)"
|
|
284 | + };
|
|
285 | + items_[AntiAliasing_LCD_Vertical] = {
|
|
286 | + FT_LOAD_TARGET_LCD_V,
|
|
287 | + "LCD (vert. RGB)"
|
|
288 | + };
|
|
289 | + items_[AntiAliasing_LCD_Vertical_BGR] = {
|
|
290 | + FT_LOAD_TARGET_LCD_V, // XXX Bug: No difference between RGB and BGR?
|
|
291 | + "LCD (vert. BGR)"
|
|
292 | + };
|
|
293 | + |
|
294 | + lightAntiAliasingEnabled_ = true;
|
|
295 | +}
|
|
296 | + |
|
297 | + |
|
298 | +QVariant
|
|
299 | +AntiAliasingComboBoxModel::data(const QModelIndex& index,
|
|
300 | + int role) const
|
|
301 | +{
|
|
302 | + if (role == Qt::ForegroundRole)
|
|
303 | + if (index.row() == AntiAliasing_Light && !lightAntiAliasingEnabled_)
|
|
304 | + return QApplication::palette().color(QPalette::Disabled,
|
|
305 | + QPalette::Text);
|
|
306 | + return SimpleComboBoxModel::data(index, role);
|
|
307 | +}
|
|
308 | + |
|
309 | + |
|
310 | +Qt::ItemFlags
|
|
311 | +AntiAliasingComboBoxModel::flags(const QModelIndex& index) const
|
|
312 | +{
|
|
313 | + if (index.row() == AntiAliasing_Light && !lightAntiAliasingEnabled_)
|
|
314 | + return Qt::ItemFlags {};
|
|
315 | + return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
|
316 | +}
|
|
317 | + |
|
318 | + |
|
319 | +// end of ttsettingscomboboxmodel.cpp |
1 | +// ttsettingscomboboxmodel.hpp
|
|
2 | + |
|
3 | +// Copyright (C) 2022 by Charlie Jiang.
|
|
4 | + |
|
5 | + |
|
6 | +#pragma once
|
|
7 | + |
|
8 | +#include <QAbstractListModel>
|
|
9 | +#include <QHash>
|
|
10 | + |
|
11 | +class HintingModeComboBoxModel
|
|
12 | +: public QAbstractListModel
|
|
13 | +{
|
|
14 | + Q_OBJECT
|
|
15 | +public:
|
|
16 | + enum HintingEngineType : int;
|
|
17 | + enum HintingMode : int;
|
|
18 | + struct HintingModeItem
|
|
19 | + {
|
|
20 | + HintingEngineType type;
|
|
21 | + HintingMode key;
|
|
22 | + int value;
|
|
23 | + bool enabled;
|
|
24 | + bool supported;
|
|
25 | + QString displayName;
|
|
26 | + };
|
|
27 | + |
|
28 | + HintingModeComboBoxModel();
|
|
29 | + ~HintingModeComboBoxModel() = default;
|
|
30 | + |
|
31 | + int rowCount(const QModelIndex& parent) const;
|
|
32 | + QVariant data(const QModelIndex& index,
|
|
33 | + int role) const;
|
|
34 | + Qt::ItemFlags flags(const QModelIndex& index) const;
|
|
35 | + |
|
36 | + int indexToTTInterpreterVersion(int index) const;
|
|
37 | + int indexToCFFMode(int index) const;
|
|
38 | + int cffModeToIndex(int mode) const;
|
|
39 | + int ttInterpreterVersionToIndex(int version) const;
|
|
40 | + |
|
41 | + void setSupportedModes(QList<int> supportedTTIVersions,
|
|
42 | + QList<int> supportedCFFModes);
|
|
43 | + void setCurrentEngineType(HintingEngineType type);
|
|
44 | + |
|
45 | +private:
|
|
46 | + QHash<int, HintingModeItem> items_;
|
|
47 | + |
|
48 | + int indexToValueForType(int index,
|
|
49 | + HintingEngineType type) const;
|
|
50 | + int valueToIndexForType(int value,
|
|
51 | + HintingEngineType type) const;
|
|
52 | + |
|
53 | +public:
|
|
54 | + // Note: Ensure related funcs are also changed when
|
|
55 | + // these enums are changed!
|
|
56 | + enum HintingEngineType
|
|
57 | + {
|
|
58 | + HintingEngineType_TrueType,
|
|
59 | + HintingEngineType_CFF
|
|
60 | + };
|
|
61 | + |
|
62 | + enum HintingMode
|
|
63 | + {
|
|
64 | + HintingMode_TrueType_v35 = 0,
|
|
65 | + HintingMode_TrueType_v38,
|
|
66 | + HintingMode_TrueType_v40,
|
|
67 | + HintingMode_CFF_FreeType,
|
|
68 | + HintingMode_CFF_Adobe
|
|
69 | + };
|
|
70 | +};
|
|
71 | + |
|
72 | + |
|
73 | +// A simple key-displayName-value model for QComboBox.
|
|
74 | +class SimpleComboBoxModel
|
|
75 | +: public QAbstractListModel
|
|
76 | +{
|
|
77 | + Q_OBJECT
|
|
78 | +public:
|
|
79 | + struct ComboBoxItem
|
|
80 | + {
|
|
81 | + int value;
|
|
82 | + QString displayName;
|
|
83 | + };
|
|
84 | + |
|
85 | + SimpleComboBoxModel() {}
|
|
86 | + ~SimpleComboBoxModel() = default;
|
|
87 | + |
|
88 | + int rowCount(const QModelIndex& parent) const;
|
|
89 | + QVariant data(const QModelIndex& index,
|
|
90 | + int role) const;
|
|
91 | + |
|
92 | + int indexToValue(int index);
|
|
93 | + |
|
94 | +protected:
|
|
95 | + QHash<int, ComboBoxItem> items_;
|
|
96 | +};
|
|
97 | + |
|
98 | + |
|
99 | +class LCDFilterComboBoxModel
|
|
100 | +: public SimpleComboBoxModel
|
|
101 | +{
|
|
102 | +public:
|
|
103 | + enum LCDFilter : int;
|
|
104 | + struct LCDFilterItem
|
|
105 | + {
|
|
106 | + int value;
|
|
107 | + QString displayName;
|
|
108 | + };
|
|
109 | + |
|
110 | + LCDFilterComboBoxModel();
|
|
111 | + ~LCDFilterComboBoxModel() = default;
|
|
112 | + |
|
113 | +public:
|
|
114 | + enum LCDFilter
|
|
115 | + {
|
|
116 | + LCDFilter_Default,
|
|
117 | + LCDFilter_Light,
|
|
118 | + LCDFilter_None,
|
|
119 | + LCDFilter_Legacy
|
|
120 | + };
|
|
121 | +};
|
|
122 | + |
|
123 | + |
|
124 | +class AntiAliasingComboBoxModel
|
|
125 | +: public SimpleComboBoxModel
|
|
126 | +{
|
|
127 | +public:
|
|
128 | + enum AntiAliasing : int;
|
|
129 | + |
|
130 | + AntiAliasingComboBoxModel();
|
|
131 | + ~AntiAliasingComboBoxModel() = default;
|
|
132 | +
|
|
133 | + QVariant data(const QModelIndex& index,
|
|
134 | + int role) const;
|
|
135 | + Qt::ItemFlags flags(const QModelIndex& index) const;
|
|
136 | + |
|
137 | + void setLightAntiAliasingEnabled(bool enabled)
|
|
138 | + {
|
|
139 | + lightAntiAliasingEnabled_ = enabled;
|
|
140 | + }
|
|
141 | + |
|
142 | +private:
|
|
143 | + bool lightAntiAliasingEnabled_;
|
|
144 | + |
|
145 | +public:
|
|
146 | + enum AntiAliasing
|
|
147 | + {
|
|
148 | + AntiAliasing_None,
|
|
149 | + AntiAliasing_Normal,
|
|
150 | + AntiAliasing_Light,
|
|
151 | + AntiAliasing_LCD,
|
|
152 | + AntiAliasing_LCD_BGR,
|
|
153 | + AntiAliasing_LCD_Vertical,
|
|
154 | + AntiAliasing_LCD_Vertical_BGR
|
|
155 | + };
|
|
156 | +};
|
|
157 | + |
|
158 | + |
|
159 | +// end of ttsettingscomboboxmodel.hpp |
... | ... | @@ -15,17 +15,17 @@ GlyphBitmap::GlyphBitmap(FT_Outline* outline, |
15 | 15 | FT_Pixel_Mode pxlMode,
|
16 | 16 | const QVector<QRgb>& monoColorTbl,
|
17 | 17 | const QVector<QRgb>& grayColorTbl)
|
18 | -: library(lib),
|
|
19 | - pixelMode(pxlMode),
|
|
20 | - monoColorTable(monoColorTbl),
|
|
21 | - grayColorTable(grayColorTbl)
|
|
18 | +: library_(lib),
|
|
19 | + pixelMode_(pxlMode),
|
|
20 | + monoColorTable_(monoColorTbl),
|
|
21 | + grayColorTable_(grayColorTbl)
|
|
22 | 22 | {
|
23 | 23 | // make a copy of the outline since we are going to manipulate it
|
24 | - FT_Outline_New(library,
|
|
24 | + FT_Outline_New(library_,
|
|
25 | 25 | static_cast<unsigned int>(outline->n_points),
|
26 | 26 | outline->n_contours,
|
27 | - &transformed);
|
|
28 | - FT_Outline_Copy(outline, &transformed);
|
|
27 | + &transformed_);
|
|
28 | + FT_Outline_Copy(outline, &transformed_);
|
|
29 | 29 | |
30 | 30 | FT_BBox cbox;
|
31 | 31 | FT_Outline_Get_CBox(outline, &cbox);
|
... | ... | @@ -36,22 +36,22 @@ GlyphBitmap::GlyphBitmap(FT_Outline* outline, |
36 | 36 | cbox.yMax = (cbox.yMax + 63) & ~63;
|
37 | 37 | |
38 | 38 | // we shift the outline to the origin for rendering later on
|
39 | - FT_Outline_Translate(&transformed, -cbox.xMin, -cbox.yMin);
|
|
39 | + FT_Outline_Translate(&transformed_, -cbox.xMin, -cbox.yMin);
|
|
40 | 40 | |
41 | - bRect.setCoords(cbox.xMin / 64, -cbox.yMax / 64,
|
|
41 | + boundingRect_.setCoords(cbox.xMin / 64, -cbox.yMax / 64,
|
|
42 | 42 | cbox.xMax / 64, -cbox.yMin / 64);
|
43 | 43 | }
|
44 | 44 | |
45 | 45 | |
46 | 46 | GlyphBitmap::~GlyphBitmap()
|
47 | 47 | {
|
48 | - FT_Outline_Done(library, &transformed);
|
|
48 | + FT_Outline_Done(library_, &transformed_);
|
|
49 | 49 | }
|
50 | 50 | |
51 | 51 | QRectF
|
52 | 52 | GlyphBitmap::boundingRect() const
|
53 | 53 | {
|
54 | - return bRect;
|
|
54 | + return boundingRect_;
|
|
55 | 55 | }
|
56 | 56 | |
57 | 57 | |
... | ... | @@ -62,20 +62,20 @@ GlyphBitmap::paint(QPainter* painter, |
62 | 62 | {
|
63 | 63 | FT_Bitmap bitmap;
|
64 | 64 | |
65 | - int height = static_cast<int>(ceil(bRect.height()));
|
|
66 | - int width = static_cast<int>(ceil(bRect.width()));
|
|
65 | + int height = static_cast<int>(ceil(boundingRect_.height()));
|
|
66 | + int width = static_cast<int>(ceil(boundingRect_.width()));
|
|
67 | 67 | QImage::Format format = QImage::Format_Indexed8;
|
68 | 68 | |
69 | 69 | // XXX cover LCD and color
|
70 | - if (pixelMode == FT_PIXEL_MODE_MONO)
|
|
70 | + if (pixelMode_ == FT_PIXEL_MODE_MONO)
|
|
71 | 71 | format = QImage::Format_Mono;
|
72 | 72 | |
73 | 73 | QImage image(QSize(width, height), format);
|
74 | 74 | |
75 | - if (pixelMode == FT_PIXEL_MODE_MONO)
|
|
76 | - image.setColorTable(monoColorTable);
|
|
75 | + if (pixelMode_ == FT_PIXEL_MODE_MONO)
|
|
76 | + image.setColorTable(monoColorTable_);
|
|
77 | 77 | else
|
78 | - image.setColorTable(grayColorTable);
|
|
78 | + image.setColorTable(grayColorTable_);
|
|
79 | 79 | |
80 | 80 | image.fill(0);
|
81 | 81 | |
... | ... | @@ -83,10 +83,10 @@ GlyphBitmap::paint(QPainter* painter, |
83 | 83 | bitmap.width = static_cast<unsigned int>(width);
|
84 | 84 | bitmap.buffer = image.bits();
|
85 | 85 | bitmap.pitch = image.bytesPerLine();
|
86 | - bitmap.pixel_mode = pixelMode;
|
|
86 | + bitmap.pixel_mode = pixelMode_;
|
|
87 | 87 | |
88 | - FT_Error error = FT_Outline_Get_Bitmap(library,
|
|
89 | - &transformed,
|
|
88 | + FT_Error error = FT_Outline_Get_Bitmap(library_,
|
|
89 | + &transformed_,
|
|
90 | 90 | &bitmap);
|
91 | 91 | if (error)
|
92 | 92 | {
|
... | ... | @@ -112,8 +112,8 @@ GlyphBitmap::paint(QPainter* painter, |
112 | 112 | {
|
113 | 113 | // be careful not to lose the alpha channel
|
114 | 114 | QRgb p = image.pixel(x, y);
|
115 | - painter->fillRect(QRectF(x + bRect.left() - 1 / lod / 2,
|
|
116 | - y + bRect.top() - 1 / lod / 2,
|
|
115 | + painter->fillRect(QRectF(x + boundingRect_.left() - 1 / lod / 2,
|
|
116 | + y + boundingRect_.top() - 1 / lod / 2,
|
|
117 | 117 | 1 + 1 / lod,
|
118 | 118 | 1 + 1 / lod),
|
119 | 119 | QColor(qRed(p),
|
... | ... | @@ -29,12 +29,12 @@ public: |
29 | 29 | QWidget* widget);
|
30 | 30 | |
31 | 31 | private:
|
32 | - FT_Outline transformed;
|
|
33 | - FT_Library library;
|
|
34 | - unsigned char pixelMode;
|
|
35 | - const QVector<QRgb>& monoColorTable;
|
|
36 | - const QVector<QRgb>& grayColorTable;
|
|
37 | - QRectF bRect;
|
|
32 | + FT_Outline transformed_;
|
|
33 | + FT_Library library_;
|
|
34 | + unsigned char pixelMode_;
|
|
35 | + const QVector<QRgb>& monoColorTable_;
|
|
36 | + const QVector<QRgb>& grayColorTable_;
|
|
37 | + QRectF boundingRect_;
|
|
38 | 38 | };
|
39 | 39 | |
40 | 40 |
... | ... | @@ -89,16 +89,16 @@ static FT_Outline_Funcs outlineFuncs = |
89 | 89 | |
90 | 90 | GlyphOutline::GlyphOutline(const QPen& outlineP,
|
91 | 91 | FT_Outline* outln)
|
92 | -: outlinePen(outlineP),
|
|
93 | - outline(outln)
|
|
92 | +: outlinePen_(outlineP),
|
|
93 | + outline_(outln)
|
|
94 | 94 | {
|
95 | 95 | FT_BBox cbox;
|
96 | 96 | |
97 | - qreal halfPenWidth = outlinePen.widthF();
|
|
97 | + qreal halfPenWidth = outlinePen_.widthF();
|
|
98 | 98 | |
99 | - FT_Outline_Get_CBox(outline, &cbox);
|
|
99 | + FT_Outline_Get_CBox(outline_, &cbox);
|
|
100 | 100 | |
101 | - bRect.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth,
|
|
101 | + boundingRect_.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth,
|
|
102 | 102 | -qreal(cbox.yMax) / 64 - halfPenWidth,
|
103 | 103 | qreal(cbox.xMax) / 64 + halfPenWidth,
|
104 | 104 | -qreal(cbox.yMin) / 64 + halfPenWidth);
|
... | ... | @@ -108,7 +108,7 @@ GlyphOutline::GlyphOutline(const QPen& outlineP, |
108 | 108 | QRectF
|
109 | 109 | GlyphOutline::boundingRect() const
|
110 | 110 | {
|
111 | - return bRect;
|
|
111 | + return boundingRect_;
|
|
112 | 112 | }
|
113 | 113 | |
114 | 114 | |
... | ... | @@ -117,10 +117,10 @@ GlyphOutline::paint(QPainter* painter, |
117 | 117 | const QStyleOptionGraphicsItem*,
|
118 | 118 | QWidget*)
|
119 | 119 | {
|
120 | - painter->setPen(outlinePen);
|
|
120 | + painter->setPen(outlinePen_);
|
|
121 | 121 | |
122 | 122 | QPainterPath path;
|
123 | - FT_Outline_Decompose(outline, &outlineFuncs, &path);
|
|
123 | + FT_Outline_Decompose(outline_, &outlineFuncs, &path);
|
|
124 | 124 | |
125 | 125 | painter->drawPath(path);
|
126 | 126 | }
|
... | ... | @@ -25,9 +25,9 @@ public: |
25 | 25 | QWidget* widget);
|
26 | 26 | |
27 | 27 | private:
|
28 | - QPen outlinePen;
|
|
29 | - FT_Outline* outline;
|
|
30 | - QRectF bRect;
|
|
28 | + QPen outlinePen_;
|
|
29 | + FT_Outline* outline_;
|
|
30 | + QRectF boundingRect_;
|
|
31 | 31 | };
|
32 | 32 | |
33 | 33 |
... | ... | @@ -13,16 +13,16 @@ |
13 | 13 | GlyphPointNumbers::GlyphPointNumbers(const QPen& onP,
|
14 | 14 | const QPen& offP,
|
15 | 15 | FT_Outline* outln)
|
16 | -: onPen(onP),
|
|
17 | - offPen(offP),
|
|
18 | - outline(outln)
|
|
16 | +: onPen_(onP),
|
|
17 | + offPen_(offP),
|
|
18 | + outline_(outln)
|
|
19 | 19 | {
|
20 | 20 | FT_BBox cbox;
|
21 | 21 | |
22 | - FT_Outline_Get_CBox(outline, &cbox);
|
|
22 | + FT_Outline_Get_CBox(outline_, &cbox);
|
|
23 | 23 | |
24 | 24 | // XXX fix bRect size
|
25 | - bRect.setCoords(qreal(cbox.xMin) / 64,
|
|
25 | + boundingRect_.setCoords(qreal(cbox.xMin) / 64,
|
|
26 | 26 | -qreal(cbox.yMax) / 64,
|
27 | 27 | qreal(cbox.xMax) / 64,
|
28 | 28 | -qreal(cbox.yMin) / 64);
|
... | ... | @@ -32,7 +32,7 @@ GlyphPointNumbers::GlyphPointNumbers(const QPen& onP, |
32 | 32 | QRectF
|
33 | 33 | GlyphPointNumbers::boundingRect() const
|
34 | 34 | {
|
35 | - return bRect;
|
|
35 | + return boundingRect_;
|
|
36 | 36 | }
|
37 | 37 | |
38 | 38 | |
... | ... | @@ -60,15 +60,15 @@ GlyphPointNumbers::paint(QPainter* painter, |
60 | 60 | font.setPointSizeF(font.pointSizeF() * 3 / 4);
|
61 | 61 | painter->setFont(font);
|
62 | 62 | |
63 | - QBrush onBrush(onPen.color());
|
|
64 | - QBrush offBrush(offPen.color());
|
|
63 | + QBrush onBrush(onPen_.color());
|
|
64 | + QBrush offBrush(offPen_.color());
|
|
65 | 65 | |
66 | 66 | painter->scale(1 / lod, 1 / lod);
|
67 | 67 | #endif
|
68 | 68 | |
69 | - FT_Vector* points = outline->points;
|
|
70 | - FT_Short* contours = outline->contours;
|
|
71 | - char* tags = outline->tags;
|
|
69 | + FT_Vector* points = outline_->points;
|
|
70 | + FT_Short* contours = outline_->contours;
|
|
71 | + char* tags = outline_->tags;
|
|
72 | 72 | |
73 | 73 | QVector2D octants[8] = { QVector2D(1, 0),
|
74 | 74 | QVector2D(0.707f, -0.707f),
|
... | ... | @@ -81,7 +81,7 @@ GlyphPointNumbers::paint(QPainter* painter, |
81 | 81 | |
82 | 82 | |
83 | 83 | short ptIdx = 0;
|
84 | - for (int contIdx = 0; contIdx < outline->n_contours; contIdx++ )
|
|
84 | + for (int contIdx = 0; contIdx < outline_->n_contours; contIdx++ )
|
|
85 | 85 | {
|
86 | 86 | for (;;)
|
87 | 87 | {
|
... | ... | @@ -26,10 +26,10 @@ public: |
26 | 26 | QWidget* widget);
|
27 | 27 | |
28 | 28 | private:
|
29 | - QPen onPen;
|
|
30 | - QPen offPen;
|
|
31 | - FT_Outline* outline;
|
|
32 | - QRectF bRect;
|
|
29 | + QPen onPen_;
|
|
30 | + QPen offPen_;
|
|
31 | + FT_Outline* outline_;
|
|
32 | + QRectF boundingRect_;
|
|
33 | 33 | };
|
34 | 34 | |
35 | 35 |
... | ... | @@ -12,17 +12,17 @@ |
12 | 12 | GlyphPoints::GlyphPoints(const QPen& onP,
|
13 | 13 | const QPen& offP,
|
14 | 14 | FT_Outline* outln)
|
15 | -: onPen(onP),
|
|
16 | - offPen(offP),
|
|
17 | - outline(outln)
|
|
15 | +: onPen_(onP),
|
|
16 | + offPen_(offP),
|
|
17 | + outline_(outln)
|
|
18 | 18 | {
|
19 | 19 | FT_BBox cbox;
|
20 | 20 | |
21 | - qreal halfPenWidth = qMax(onPen.widthF(), offPen.widthF()) / 2;
|
|
21 | + qreal halfPenWidth = qMax(onPen_.widthF(), offPen_.widthF()) / 2;
|
|
22 | 22 | |
23 | - FT_Outline_Get_CBox(outline, &cbox);
|
|
23 | + FT_Outline_Get_CBox(outline_, &cbox);
|
|
24 | 24 | |
25 | - bRect.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth,
|
|
25 | + boundingRect_.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth,
|
|
26 | 26 | -qreal(cbox.yMax) / 64 - halfPenWidth,
|
27 | 27 | qreal(cbox.xMax) / 64 + halfPenWidth,
|
28 | 28 | -qreal(cbox.yMin) / 64 + halfPenWidth);
|
... | ... | @@ -32,7 +32,7 @@ GlyphPoints::GlyphPoints(const QPen& onP, |
32 | 32 | QRectF
|
33 | 33 | GlyphPoints::boundingRect() const
|
34 | 34 | {
|
35 | - return bRect;
|
|
35 | + return boundingRect_;
|
|
36 | 36 | }
|
37 | 37 | |
38 | 38 | |
... | ... | @@ -73,29 +73,29 @@ GlyphPoints::paint(QPainter* painter, |
73 | 73 | onPen.setWidthF(origOnPenWidth);
|
74 | 74 | offPen.setWidthF(origOffPenWidth);
|
75 | 75 | #else
|
76 | - QBrush onBrush(onPen.color());
|
|
77 | - QBrush offBrush(offPen.color());
|
|
76 | + QBrush onBrush(onPen_.color());
|
|
77 | + QBrush offBrush(offPen_.color());
|
|
78 | 78 | |
79 | 79 | painter->setPen(Qt::NoPen);
|
80 | 80 | |
81 | - qreal onRadius = onPen.widthF() / lod;
|
|
82 | - qreal offRadius = offPen.widthF() / lod;
|
|
81 | + qreal onRadius = onPen_.widthF() / lod;
|
|
82 | + qreal offRadius = offPen_.widthF() / lod;
|
|
83 | 83 | |
84 | - for (int i = 0; i < outline->n_points; i++)
|
|
84 | + for (int i = 0; i < outline_->n_points; i++)
|
|
85 | 85 | {
|
86 | - if (outline->tags[i] & FT_CURVE_TAG_ON)
|
|
86 | + if (outline_->tags[i] & FT_CURVE_TAG_ON)
|
|
87 | 87 | {
|
88 | 88 | painter->setBrush(onBrush);
|
89 | - painter->drawEllipse(QPointF(qreal(outline->points[i].x) / 64,
|
|
90 | - -qreal(outline->points[i].y) / 64),
|
|
89 | + painter->drawEllipse(QPointF(qreal(outline_->points[i].x) / 64,
|
|
90 | + -qreal(outline_->points[i].y) / 64),
|
|
91 | 91 | onRadius,
|
92 | 92 | onRadius);
|
93 | 93 | }
|
94 | 94 | else
|
95 | 95 | {
|
96 | 96 | painter->setBrush(offBrush);
|
97 | - painter->drawEllipse(QPointF(qreal(outline->points[i].x) / 64,
|
|
98 | - -qreal(outline->points[i].y) / 64),
|
|
97 | + painter->drawEllipse(QPointF(qreal(outline_->points[i].x) / 64,
|
|
98 | + -qreal(outline_->points[i].y) / 64),
|
|
99 | 99 | offRadius,
|
100 | 100 | offRadius);
|
101 | 101 | }
|
... | ... | @@ -26,10 +26,10 @@ public: |
26 | 26 | QWidget* widget);
|
27 | 27 | |
28 | 28 | private:
|
29 | - QPen onPen;
|
|
30 | - QPen offPen;
|
|
31 | - FT_Outline* outline;
|
|
32 | - QRectF bRect;
|
|
29 | + QPen onPen_;
|
|
30 | + QPen offPen_;
|
|
31 | + FT_Outline* outline_;
|
|
32 | + QRectF boundingRect_;
|
|
33 | 33 | };
|
34 | 34 | |
35 | 35 |
... | ... | @@ -11,8 +11,8 @@ |
11 | 11 | |
12 | 12 | Grid::Grid(const QPen& gridP,
|
13 | 13 | const QPen& axisP)
|
14 | -: gridPen(gridP),
|
|
15 | - axisPen(axisP)
|
|
14 | +: gridPen_(gridP),
|
|
15 | + axisPen_(axisP)
|
|
16 | 16 | {
|
17 | 17 | // empty
|
18 | 18 | }
|
... | ... | @@ -40,7 +40,7 @@ Grid::paint(QPainter* painter, |
40 | 40 | const qreal lod = option->levelOfDetailFromTransform(
|
41 | 41 | painter->worldTransform());
|
42 | 42 | |
43 | - painter->setPen(gridPen);
|
|
43 | + painter->setPen(gridPen_);
|
|
44 | 44 | |
45 | 45 | // don't mark pixel center with a cross if magnification is too small
|
46 | 46 | if (lod > 20)
|
... | ... | @@ -81,7 +81,7 @@ Grid::paint(QPainter* painter, |
81 | 81 | 100, y);
|
82 | 82 | }
|
83 | 83 | |
84 | - painter->setPen(axisPen);
|
|
84 | + painter->setPen(axisPen_);
|
|
85 | 85 | |
86 | 86 | painter->drawLine(0, -100,
|
87 | 87 | 0, 100);
|
... | ... | @@ -21,8 +21,8 @@ public: |
21 | 21 | QWidget* widget);
|
22 | 22 | |
23 | 23 | private:
|
24 | - QPen gridPen;
|
|
25 | - QPen axisPen;
|
|
24 | + QPen gridPen_;
|
|
25 | + QPen axisPen_;
|
|
26 | 26 | };
|
27 | 27 | |
28 | 28 |
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | |
10 | 10 | |
11 | 11 | QGraphicsViewx::QGraphicsViewx()
|
12 | -: lastBottomLeftPointInitialized(false)
|
|
12 | +: lastBottomLeftPointInitialized_(false)
|
|
13 | 13 | {
|
14 | 14 | // empty
|
15 | 15 | }
|
... | ... | @@ -20,7 +20,7 @@ QGraphicsViewx::scrollContentsBy(int dx, |
20 | 20 | int dy)
|
21 | 21 | {
|
22 | 22 | QGraphicsView::scrollContentsBy(dx, dy);
|
23 | - lastBottomLeftPoint = viewport()->rect().bottomLeft();
|
|
23 | + lastBottomLeftPoint_ = viewport()->rect().bottomLeft();
|
|
24 | 24 | }
|
25 | 25 | |
26 | 26 | |
... | ... | @@ -31,10 +31,10 @@ QGraphicsViewx::resizeEvent(QResizeEvent* event) |
31 | 31 | |
32 | 32 | // XXX I don't know how to properly initialize this value,
|
33 | 33 | // thus the hack with the boolean
|
34 | - if (!lastBottomLeftPointInitialized)
|
|
34 | + if (!lastBottomLeftPointInitialized_)
|
|
35 | 35 | {
|
36 | - lastBottomLeftPoint = viewport()->rect().bottomLeft();
|
|
37 | - lastBottomLeftPointInitialized = true;
|
|
36 | + lastBottomLeftPoint_ = viewport()->rect().bottomLeft();
|
|
37 | + lastBottomLeftPointInitialized_ = true;
|
|
38 | 38 | }
|
39 | 39 | |
40 | 40 | QPointF currentBottomLeftPoint = viewport()->rect().bottomLeft();
|
... | ... | @@ -42,7 +42,7 @@ QGraphicsViewx::resizeEvent(QResizeEvent* event) |
42 | 42 | verticalScrollBar()->setValue(static_cast<int>(
|
43 | 43 | verticalPosition
|
44 | 44 | - (currentBottomLeftPoint.y()
|
45 | - - lastBottomLeftPoint.y())));
|
|
45 | + - lastBottomLeftPoint_.y())));
|
|
46 | 46 | }
|
47 | 47 | |
48 | 48 |