freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][reorg-maingui] 3 commits: [ftinspect] Mov


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][reorg-maingui] 3 commits: [ftinspect] Move out font file managing/watching out to a new class.
Date: Wed, 29 Jun 2022 15:00:43 +0000

Charlie Jiang pushed to branch reorg-maingui at FreeType / FreeType Demo Programs

Commits:

  • 600a9006
    by Charlie Jiang at 2022-06-29T22:57:23+08:00
    [ftinspect] Move out font file managing/watching out to a new class.
    
    * src/ftinspect/CMakeLists.txt: Add `fontfilemanager.cpp`.
    
    * src/ftinspect/meson.build: Add `fontfilemanager.cpp`.
    
    * src/ftinspect/fontfilemanager.hpp: Font file managing/watching goes here.
    
    * src/ftinspect/fontfilemanager.cpp: Font file managing/watching goes here.
    
    * src/ftinspect/maingui.hpp: Remove `fontList`, `fontWatcher` and `timer`..
    
    * src/ftinspect/maingui.cpp: Remove code related to font file managing, they
    were all moved to `FontFileManager` class.
    
    * src/ftinspect/engine.hpp: `Engine` class now holds `FontFileManager`. Also,
    `MainGUI` will open and close fonts indirectly via `Engine`.
    
    * src/ftinspect/engine.cpp: Same as `engine.hpp`.
    
    TODO: Maybe we should remove dependency against `FontFileManager` from
    `MainGUI`?
    
  • 19ad7297
    by Charlie Jiang at 2022-06-29T22:58:06+08:00
    [ftinspect] Decouple `Engine` from `MainGUI`.
    
    Relevant info can be found in #13. This commit removes dependency against
    `MainGUI` from `Engine` class. All settings will be explicitly passed via
    setters of `Engine`. Also see `MainGUI::syncSettings` and simplified
    `Engine::update`.
    
    This commit removes friend relation between the two classes.
    
    TODO: Some GUI components in MainGUI lacks proper connections. When changing
    their value, the glyph isn't updated in time.
    
    * src/ftinspect/ftinspect.cpp: No longer need to pass GUI when constructing
    `Engine`.
    
    * src/ftinspect/maingui.hpp: Move `AntiAliasing` enum to `Engine` class, add
    `syncSettings` function, reorder some functions.
    
    * src/ftinspect/maingui.cpp: Because of the removal of friend relationship,
    change all access to private fields of `Engine` to getter/setter call.
    Add implementation of `syncSettings`, and make sure it's called before
    loading font and rendering. Moving of `AntiAliasing` enum is also taken care
    of.
    
    * src/ftinspect/engine/engine.hpp: Removed dependency against `MainGUI`.
    Added getters/setters and reordered some functions. The default values
    queried from engine are all grouped together into `EngineDefaultValues`
    struct.
    Added `queryEngine` function (see below).
    New `setSizeByPoint` and `setSizeByPoint` lifted the branch to `MainGUI`.
    Note: Setters of LCD filter mode, CFF mode and TTI version now accepts the
    actual values of FreeType instead of values of enums in `MainGUI` used to
    initialize combo boxes.
    However, `antiAliasingMode` is still using enum values (but moved into
    `Engine`) because it's complex to convert to FreeType value.
    
    * src/ftinspect/engine/engine.cpp: `faceRequester` now use the `Engine`
    object instead of `MainGUI` as `requestData`.
    Moved code preparing engine default values to the `queryEngine` function.
    Moved some single-line getters to the header file to benefit from inlineing.
    Simplified `update` function since we no longer need to actively fetch
    settings.
    `usingPixelSize` is used to determine if pixel or point unit is used. This
    flag is updated by `setSizeByPixel` and `setSizeByPoint` functions.
    
  • 7d0d3a57
    by Charlie Jiang at 2022-06-29T22:59:12+08:00
    [ftinspect] Rename all private member variables with an underscore suffix.
    
    (pure mechnical commit)
    
    * src/ftinspect/**: Renaming. Also some variables with abbreviations
    were renamed.
    
    This will enable nicer getter/setters, as discussed in #13.
    

21 changed files:

Changes:

  • src/ftinspect/CMakeLists.txt
    ... ... @@ -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"
    

  • src/ftinspect/engine/engine.cpp
    ... ... @@ -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 327
     
    
    422
    -
    
    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)
    
    405
    +{
    
    406
    +  this->pixelSize_ = pixelSize;
    
    407
    +  pointSize_ = pixelSize * 72.0 / dpi_;
    
    408
    +  usingPixelSize_ = true;
    
    409
    +}
    
    410
    +
    
    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)
    
    495 422
     {
    
    496
    -  int index = gui->hintingModesCFFHash.key(mode);
    
    423
    +  FT_Library_SetLcdFilter(library_, filter);
    
    424
    +}
    
    497 425
     
    
    498
    -  FT_Error error = FT_Property_Set(library,
    
    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,58 +457,32 @@ 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)
    
    534
    -  {
    
    535
    -    pixelSize = gui->sizeDoubleSpinBox->value();
    
    536
    -    pointSize = pixelSize * 72.0 / dpi;
    
    537
    -  }
    
    538
    -  else
    
    539
    -  {
    
    540
    -    pointSize = gui->sizeDoubleSpinBox->value();
    
    541
    -    pixelSize = pointSize * dpi / 72.0;
    
    542
    -  }
    
    543
    -
    
    544
    -  doHinting = gui->hintingCheckBox->isChecked();
    
    545
    -
    
    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();
    
    551
    -
    
    552
    -  gamma = gui->gammaSlider->value();
    
    553
    -
    
    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
    -
    
    559
    -  int index = gui->antiAliasingComboBoxx->currentIndex();
    
    560
    -
    
    561
    -  if (doHinting)
    
    465
    +  if (doHinting_)
    
    562 466
       {
    
    563 467
         unsigned long target;
    
    564 468
     
    
    565
    -    if (index == MainGUI::AntiAliasing_None)
    
    469
    +    if (antiAliasingMode_ == AntiAliasing_None)
    
    566 470
           target = FT_LOAD_TARGET_MONO;
    
    567 471
         else
    
    568 472
         {
    
    569
    -      switch (index)
    
    473
    +      switch (antiAliasingMode_)
    
    570 474
           {
    
    571
    -      case MainGUI::AntiAliasing_Light:
    
    475
    +      case AntiAliasing_Light:
    
    572 476
             target = FT_LOAD_TARGET_LIGHT;
    
    573 477
             break;
    
    574 478
     
    
    575
    -      case MainGUI::AntiAliasing_LCD:
    
    576
    -      case MainGUI::AntiAliasing_LCD_BGR:
    
    479
    +      case AntiAliasing_LCD:
    
    480
    +      case AntiAliasing_LCD_BGR: // TODO Differenate RGB/BGR here?
    
    577 481
             target = FT_LOAD_TARGET_LCD;
    
    578 482
             break;
    
    579 483
     
    
    580
    -      case MainGUI::AntiAliasing_LCD_Vertical:
    
    581
    -      case MainGUI::AntiAliasing_LCD_Vertical_BGR:
    
    484
    +      case AntiAliasing_LCD_Vertical:
    
    485
    +      case AntiAliasing_LCD_Vertical_BGR:
    
    582 486
             target = FT_LOAD_TARGET_LCD_V;
    
    583 487
             break;
    
    584 488
     
    
    ... ... @@ -587,35 +491,134 @@ Engine::update()
    587 491
           }
    
    588 492
         }
    
    589 493
     
    
    590
    -    loadFlags |= target;
    
    494
    +    loadFlags_ |= target;
    
    591 495
       }
    
    592 496
       else
    
    593 497
       {
    
    594
    -    loadFlags |= FT_LOAD_NO_HINTING;
    
    498
    +    loadFlags_ |= FT_LOAD_NO_HINTING;
    
    595 499
     
    
    596
    -    if (index == MainGUI::AntiAliasing_None)
    
    597
    -      loadFlags |= FT_LOAD_MONOCHROME;
    
    500
    +    if (antiAliasingMode_ == AntiAliasing_None)
    
    501
    +      loadFlags_ |= FT_LOAD_MONOCHROME;
    
    598 502
       }
    
    599 503
     
    
    600 504
       // XXX handle color fonts also
    
    601 505
     
    
    602
    -  scaler.pixel = 0; // use 26.6 format
    
    506
    +  scaler_.pixel = 0; // use 26.6 format
    
    603 507
     
    
    604
    -  if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px)
    
    508
    +  if (usingPixelSize_)
    
    605 509
       {
    
    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;
    
    510
    +    scaler_.width = static_cast<unsigned int>(pixelSize_ * 64.0);
    
    511
    +    scaler_.height = static_cast<unsigned int>(pixelSize_ * 64.0);
    
    512
    +    scaler_.x_res = 0;
    
    513
    +    scaler_.y_res = 0;
    
    610 514
       }
    
    611 515
       else
    
    612 516
       {
    
    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;
    
    517
    +    scaler_.width = static_cast<unsigned int>(pointSize_ * 64.0);
    
    518
    +    scaler_.height = static_cast<unsigned int>(pointSize_ * 64.0);
    
    519
    +    scaler_.x_res = dpi_;
    
    520
    +    scaler_.y_res = dpi_;
    
    617 521
       }
    
    618 522
     }
    
    619 523
     
    
    620 524
     
    
    525
    +void
    
    526
    +Engine::queryEngine()
    
    527
    +{
    
    528
    +  FT_Error error;
    
    529
    +
    
    530
    +  // query engines and check for alternatives
    
    531
    +
    
    532
    +  // CFF
    
    533
    +  error = FT_Property_Get(library_,
    
    534
    +                          "cff",
    
    535
    +                          "hinting-engine",
    
    536
    +                          &engineDefaults_.cffHintingEngineDefault);
    
    537
    +  if (error)
    
    538
    +  {
    
    539
    +    // no CFF engine
    
    540
    +    engineDefaults_.cffHintingEngineDefault = -1;
    
    541
    +    engineDefaults_.cffHintingEngineOther = -1;
    
    542
    +  }
    
    543
    +  else
    
    544
    +  {
    
    545
    +    int engines[] =
    
    546
    +    {
    
    547
    +      FT_HINTING_FREETYPE,
    
    548
    +      FT_HINTING_ADOBE
    
    549
    +    };
    
    550
    +
    
    551
    +    int i;
    
    552
    +    for (i = 0; i < 2; i++)
    
    553
    +      if (engineDefaults_.cffHintingEngineDefault == engines[i])
    
    554
    +        break;
    
    555
    +
    
    556
    +    engineDefaults_.cffHintingEngineOther = engines[(i + 1) % 2];
    
    557
    +
    
    558
    +    error = FT_Property_Set(library_,
    
    559
    +                            "cff",
    
    560
    +                            "hinting-engine",
    
    561
    +                            &engineDefaults_.cffHintingEngineOther);
    
    562
    +    if (error)
    
    563
    +      engineDefaults_.cffHintingEngineOther = -1;
    
    564
    +
    
    565
    +    // reset
    
    566
    +    FT_Property_Set(library_,
    
    567
    +                    "cff",
    
    568
    +                    "hinting-engine",
    
    569
    +                    &engineDefaults_.cffHintingEngineDefault);
    
    570
    +  }
    
    571
    +
    
    572
    +  // TrueType
    
    573
    +  error = FT_Property_Get(library_,
    
    574
    +                          "truetype",
    
    575
    +                          "interpreter-version",
    
    576
    +                          &engineDefaults_.ttInterpreterVersionDefault);
    
    577
    +  if (error)
    
    578
    +  {
    
    579
    +    // no TrueType engine
    
    580
    +    engineDefaults_.ttInterpreterVersionDefault = -1;
    
    581
    +    engineDefaults_.ttInterpreterVersionOther = -1;
    
    582
    +    engineDefaults_.ttInterpreterVersionOther1 = -1;
    
    583
    +  }
    
    584
    +  else
    
    585
    +  {
    
    586
    +    int interpreters[] =
    
    587
    +    {
    
    588
    +      TT_INTERPRETER_VERSION_35,
    
    589
    +      TT_INTERPRETER_VERSION_38,
    
    590
    +      TT_INTERPRETER_VERSION_40
    
    591
    +    };
    
    592
    +
    
    593
    +    int i;
    
    594
    +    for (i = 0; i < 3; i++)
    
    595
    +      if (engineDefaults_.ttInterpreterVersionDefault == interpreters[i])
    
    596
    +        break;
    
    597
    +
    
    598
    +    engineDefaults_.ttInterpreterVersionOther = interpreters[(i + 1) % 3];
    
    599
    +
    
    600
    +    error = FT_Property_Set(library_,
    
    601
    +                            "truetype",
    
    602
    +                            "interpreter-version",
    
    603
    +                            &engineDefaults_.ttInterpreterVersionOther);
    
    604
    +    if (error)
    
    605
    +      engineDefaults_.ttInterpreterVersionOther = -1;
    
    606
    +
    
    607
    +    engineDefaults_.ttInterpreterVersionOther1 = interpreters[(i + 2) % 3];
    
    608
    +
    
    609
    +    error = FT_Property_Set(library_,
    
    610
    +                            "truetype",
    
    611
    +                            "interpreter-version",
    
    612
    +                            &engineDefaults_.ttInterpreterVersionOther1);
    
    613
    +    if (error)
    
    614
    +      engineDefaults_.ttInterpreterVersionOther1 = -1;
    
    615
    +
    
    616
    +    // reset
    
    617
    +    FT_Property_Set(library_,
    
    618
    +                    "truetype",
    
    619
    +                    "interpreter-version",
    
    620
    +                    &engineDefaults_.ttInterpreterVersionDefault);
    
    621
    +  }
    
    622
    +}
    
    623
    +
    
    621 624
     // end of engine.cpp

  • src/ftinspect/engine/engine.hpp
    ... ... @@ -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,165 @@ 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
    +
    
    46
    +  // TODO these would be dropped with custom QAbstractItemModel
    
    47
    +  enum AntiAliasing : int;
    
    48
    +  enum FontType : int;
    
    49
    +
    
    50
    +  struct EngineDefaultValues
    
    51
    +  {
    
    52
    +    int cffHintingEngineDefault;
    
    53
    +    int cffHintingEngineOther;
    
    54
    +
    
    55
    +    int ttInterpreterVersionDefault;
    
    56
    +    int ttInterpreterVersionOther;
    
    57
    +    int ttInterpreterVersionOther1;
    
    58
    +  };
    
    59
    +
    
    60
    +  //////// Ctors & Dtors
    
    61
    +
    
    62
    +  Engine();
    
    45 63
       ~Engine();
    
    46 64
     
    
    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);
    
    65
    +  // Disable copying
    
    66
    +  Engine(const Engine& other) = delete;
    
    67
    +  Engine& operator=(const Engine& other) = delete;
    
    68
    +
    
    69
    +  //////// Actions
    
    70
    +
    
    53 71
       int loadFont(int fontIndex,
    
    54 72
                    long faceIndex,
    
    55 73
                    int namedInstanceIndex); // return number of glyphs
    
    56 74
       FT_Outline* loadOutline(int glyphIndex);
    
    57
    -  void removeFont(int fontIndex);
    
    75
    +
    
    76
    +  void openFonts(QStringList fontFileNames);
    
    77
    +  void removeFont(int fontIndex, bool closeFile = true);
    
    78
    +  
    
    79
    +  void update();
    
    80
    +
    
    81
    +  //////// Getters
    
    82
    +
    
    83
    +  FT_Library ftLibrary() const { return library_; }
    
    84
    +  int currentFontType() const { return fontType_; }
    
    85
    +  const QString& currentFamilyName() { return curFamilyName_; }
    
    86
    +  const QString& currentStyleName() { return curStyleName_; }
    
    87
    +  int numberOfOpenedFonts();
    
    88
    +  QString glyphName(int glyphIndex);
    
    89
    +  long numberOfFaces(int fontIndex);
    
    90
    +  int numberOfNamedInstances(int fontIndex,
    
    91
    +                             long faceIndex);
    
    92
    +
    
    93
    +  // XXX We should prepend '_' to all private member variable so we can create
    
    94
    +  // getter without naming conflict... e.g. var named _fontFileManager while
    
    95
    +  // getter named fontFileManager
    
    96
    +  FontFileManager& fontFileManager() { return fontFileManager_; }
    
    97
    +  EngineDefaultValues& engineDefaults() { return engineDefaults_; }
    
    98
    +
    
    99
    +  //////// Setters (direct or indirect)
    
    100
    +
    
    101
    +  void setDPI(int d) { dpi_ = d; }
    
    102
    +  void setSizeByPixel(double pixelSize);
    
    103
    +  void setSizeByPoint(double pointSize);
    
    104
    +  void setHinting(bool hinting) { doHinting_ = hinting; }
    
    105
    +  void setAutoHinting(bool autoHinting) { doAutoHinting_ = autoHinting; }
    
    106
    +  void setHorizontalHinting(bool horHinting)
    
    107
    +  {
    
    108
    +    doHorizontalHinting_ = horHinting;
    
    109
    +  }
    
    110
    +  void setVerticalHinting(bool verticalHinting)
    
    111
    +  {
    
    112
    +    doVerticalHinting_ = verticalHinting;
    
    113
    +  }
    
    114
    +  void setBlueZoneHinting(bool blueZoneHinting)
    
    115
    +  {
    
    116
    +    doBlueZoneHinting_ = blueZoneHinting;
    
    117
    +  }
    
    118
    +  void setShowSegments(bool showSegments) { showSegments_ = showSegments; }
    
    119
    +  void setGamma(double gamma) { gamma_ = gamma; }
    
    120
    +  void setAntiAliasingMode(AntiAliasing mode) { antiAliasingMode_ = mode; }
    
    121
    +
    
    122
    +  // Note: These 3 functions now takes actual mode/version from FreeType,
    
    123
    +  // instead of values from enum in MainGUI!
    
    124
    +  void setLcdFilter(FT_LcdFilter filter);
    
    58 125
       void setCFFHintingMode(int mode);
    
    59 126
       void setTTInterpreterVersion(int version);
    
    60
    -  void update();
    
    61 127
     
    
    62
    -  friend class MainGUI;
    
    128
    +  //////// Misc
    
    129
    +
    
    63 130
       friend FT_Error faceRequester(FTC_FaceID,
    
    64 131
                                     FT_Library,
    
    65 132
                                     FT_Pointer,
    
    66 133
                                     FT_Face*);
    
    67 134
     
    
    68
    -  // XXX cover all available modules
    
    69
    -  enum FontType
    
    70
    -  {
    
    71
    -    FontType_CFF,
    
    72
    -    FontType_TrueType,
    
    73
    -    FontType_Other
    
    74
    -  };
    
    75
    -
    
    76 135
     private:
    
    77
    -  MainGUI* gui;
    
    78
    -
    
    79 136
       using FTC_IDType = uintptr_t;
    
    80
    -  FTC_IDType faceCounter; // a running number used to initialize `faceIDMap'
    
    81
    -  QMap<FaceID, FTC_IDType> faceIDMap;
    
    137
    +  FTC_IDType faceCounter_; // a running number used to initialize `faceIDMap'
    
    138
    +  QMap<FaceID, FTC_IDType> faceIDMap_;
    
    139
    +
    
    140
    +  FontFileManager fontFileManager_;
    
    82 141
     
    
    83
    -  QString curFamilyName;
    
    84
    -  QString curStyleName;
    
    142
    +  QString curFamilyName_;
    
    143
    +  QString curStyleName_;
    
    85 144
     
    
    86
    -  FT_Library library;
    
    87
    -  FTC_Manager cacheManager;
    
    88
    -  FTC_ImageCache imageCache;
    
    89
    -  FTC_SBitCache sbitsCache;
    
    145
    +  FT_Library library_;
    
    146
    +  FTC_Manager cacheManager_;
    
    147
    +  FTC_ImageCache imageCache_;
    
    148
    +  FTC_SBitCache sbitsCache_;
    
    90 149
     
    
    91
    -  FTC_ScalerRec scaler;
    
    92
    -  FT_Size ftSize;
    
    150
    +  FTC_ScalerRec scaler_;
    
    151
    +  FT_Size ftSize_;
    
    93 152
     
    
    94
    -  int cffHintingEngineDefault;
    
    95
    -  int cffHintingEngineOther;
    
    153
    +  EngineDefaultValues engineDefaults_;
    
    96 154
     
    
    97
    -  int ttInterpreterVersionDefault;
    
    98
    -  int ttInterpreterVersionOther;
    
    99
    -  int ttInterpreterVersionOther1;
    
    155
    +  int fontType_;
    
    100 156
     
    
    101
    -  int fontType;
    
    157
    +  bool usingPixelSize_ = false;
    
    158
    +  double pointSize_;
    
    159
    +  double pixelSize_;
    
    160
    +  unsigned int dpi_;
    
    102 161
     
    
    103
    -  double pointSize;
    
    104
    -  double pixelSize;
    
    105
    -  unsigned int dpi;
    
    162
    +  bool doHinting_;
    
    163
    +  bool doAutoHinting_;
    
    164
    +  bool doHorizontalHinting_;
    
    165
    +  bool doVerticalHinting_;
    
    166
    +  bool doBlueZoneHinting_;
    
    167
    +  bool showSegments_;
    
    168
    +  AntiAliasing antiAliasingMode_;
    
    106 169
     
    
    107
    -  bool doHinting;
    
    108
    -  bool doAutoHinting;
    
    109
    -  bool doHorizontalHinting;
    
    110
    -  bool doVerticalHinting;
    
    111
    -  bool doBlueZoneHinting;
    
    112
    -  bool showSegments;
    
    170
    +  double gamma_;
    
    113 171
     
    
    114
    -  double gamma;
    
    172
    +  unsigned long loadFlags_;
    
    115 173
     
    
    116
    -  unsigned long loadFlags;
    
    174
    +  void queryEngine();
    
    175
    +
    
    176
    +public:
    
    177
    +
    
    178
    +  /// Actual definition
    
    179
    +  
    
    180
    +  enum AntiAliasing
    
    181
    +  {
    
    182
    +    AntiAliasing_None,
    
    183
    +    AntiAliasing_Normal,
    
    184
    +    AntiAliasing_Light,
    
    185
    +    AntiAliasing_LCD,
    
    186
    +    AntiAliasing_LCD_BGR,
    
    187
    +    AntiAliasing_LCD_Vertical,
    
    188
    +    AntiAliasing_LCD_Vertical_BGR
    
    189
    +  };
    
    190
    +
    
    191
    +  // XXX cover all available modules
    
    192
    +  enum FontType
    
    193
    +  {
    
    194
    +    FontType_CFF,
    
    195
    +    FontType_TrueType,
    
    196
    +    FontType_Other
    
    197
    +  };
    
    117 198
     };
    
    118 199
     
    
    119 200
     
    

  • src/ftinspect/engine/fontfilemanager.cpp
    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

  • src/ftinspect/engine/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

  • src/ftinspect/ftinspect.cpp
    ... ... @@ -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();
    

  • src/ftinspect/maingui.cpp
    ... ... @@ -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,93 @@ 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_->setAntiAliasingMode(static_cast<Engine::AntiAliasing>(
    
    234
    +      antiAliasingComboBoxx_->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++)
    
    253
    +      for (int i = 0; i < hintingModeComboBoxx_->count(); i++)
    
    229 254
           {
    
    230
    -        if (hintingModesCFFHash.key(i, -1) != -1)
    
    231
    -          hintingModeComboBoxx->setItemEnabled(i, true);
    
    255
    +        if (hintingModesCFFHash_.key(i, -1) != -1)
    
    256
    +          hintingModeComboBoxx_->setItemEnabled(i, true);
    
    232 257
             else
    
    233
    -          hintingModeComboBoxx->setItemEnabled(i, false);
    
    258
    +          hintingModeComboBoxx_->setItemEnabled(i, false);
    
    234 259
           }
    
    235 260
     
    
    236
    -      hintingModeComboBoxx->setCurrentIndex(currentCFFHintingMode);
    
    261
    +      hintingModeComboBoxx_->setCurrentIndex(currentCFFHintingMode_);
    
    237 262
         }
    
    238
    -    else if (engine->fontType == Engine::FontType_TrueType)
    
    263
    +    else if (engine_->currentFontType() == Engine::FontType_TrueType)
    
    239 264
         {
    
    240
    -      for (int i = 0; i < hintingModeComboBoxx->count(); i++)
    
    265
    +      for (int i = 0; i < hintingModeComboBoxx_->count(); i++)
    
    241 266
           {
    
    242
    -        if (hintingModesTrueTypeHash.key(i, -1) != -1)
    
    243
    -          hintingModeComboBoxx->setItemEnabled(i, true);
    
    267
    +        if (hintingModesTrueTypeHash_.key(i, -1) != -1)
    
    268
    +          hintingModeComboBoxx_->setItemEnabled(i, true);
    
    244 269
             else
    
    245
    -          hintingModeComboBoxx->setItemEnabled(i, false);
    
    270
    +          hintingModeComboBoxx_->setItemEnabled(i, false);
    
    246 271
           }
    
    247 272
     
    
    248
    -      hintingModeComboBoxx->setCurrentIndex(currentTTInterpreterVersion);
    
    273
    +      hintingModeComboBoxx_->setCurrentIndex(currentTTInterpreterVersion_);
    
    249 274
         }
    
    250 275
         else
    
    251 276
         {
    
    252
    -      hintingModeLabel->setEnabled(false);
    
    253
    -      hintingModeComboBoxx->setEnabled(false);
    
    277
    +      hintingModeLabel_->setEnabled(false);
    
    278
    +      hintingModeComboBoxx_->setEnabled(false);
    
    254 279
         }
    
    255 280
     
    
    256
    -    for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++)
    
    257
    -      hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i],
    
    281
    +    for (int i = 0; i < hintingModesAlwaysDisabled_.size(); i++)
    
    282
    +      hintingModeComboBoxx_->setItemEnabled(hintingModesAlwaysDisabled_[i],
    
    258 283
                                                false);
    
    259 284
     
    
    260
    -    autoHintingCheckBox->setEnabled(true);
    
    285
    +    autoHintingCheckBox_->setEnabled(true);
    
    261 286
         checkAutoHinting();
    
    262 287
       }
    
    263 288
       else
    
    264 289
       {
    
    265
    -    hintingModeLabel->setEnabled(false);
    
    266
    -    hintingModeComboBoxx->setEnabled(false);
    
    290
    +    hintingModeLabel_->setEnabled(false);
    
    291
    +    hintingModeComboBoxx_->setEnabled(false);
    
    267 292
     
    
    268
    -    autoHintingCheckBox->setEnabled(false);
    
    269
    -    horizontalHintingCheckBox->setEnabled(false);
    
    270
    -    verticalHintingCheckBox->setEnabled(false);
    
    271
    -    blueZoneHintingCheckBox->setEnabled(false);
    
    272
    -    segmentDrawingCheckBox->setEnabled(false);
    
    293
    +    autoHintingCheckBox_->setEnabled(false);
    
    294
    +    horizontalHintingCheckBox_->setEnabled(false);
    
    295
    +    verticalHintingCheckBox_->setEnabled(false);
    
    296
    +    blueZoneHintingCheckBox_->setEnabled(false);
    
    297
    +    segmentDrawingCheckBox_->setEnabled(false);
    
    273 298
     
    
    274
    -    antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, false);
    
    299
    +    antiAliasingComboBoxx_->setItemEnabled(Engine::AntiAliasing_Light, false);
    
    275 300
       }
    
    276 301
     
    
    277 302
       drawGlyph();
    
    ... ... @@ -281,17 +306,17 @@ MainGUI::checkHinting()
    281 306
     void
    
    282 307
     MainGUI::checkHintingMode()
    
    283 308
     {
    
    284
    -  int index = hintingModeComboBoxx->currentIndex();
    
    309
    +  int index = hintingModeComboBoxx_->currentIndex();
    
    285 310
     
    
    286
    -  if (engine->fontType == Engine::FontType_CFF)
    
    311
    +  if (engine_->currentFontType() == Engine::FontType_CFF)
    
    287 312
       {
    
    288
    -    engine->setCFFHintingMode(index);
    
    289
    -    currentCFFHintingMode = index;
    
    313
    +    engine_->setCFFHintingMode(hintingModesCFFHash_.key(index));
    
    314
    +    currentCFFHintingMode_ = index;
    
    290 315
       }
    
    291
    -  else if (engine->fontType == Engine::FontType_TrueType)
    
    316
    +  else if (engine_->currentFontType() == Engine::FontType_TrueType)
    
    292 317
       {
    
    293
    -    engine->setTTInterpreterVersion(index);
    
    294
    -    currentTTInterpreterVersion = index;
    
    318
    +    engine_->setTTInterpreterVersion(hintingModesTrueTypeHash_.key(index));
    
    319
    +    currentTTInterpreterVersion_ = index;
    
    295 320
       }
    
    296 321
     
    
    297 322
       // this enforces reloading of the font
    
    ... ... @@ -302,36 +327,36 @@ MainGUI::checkHintingMode()
    302 327
     void
    
    303 328
     MainGUI::checkAutoHinting()
    
    304 329
     {
    
    305
    -  if (autoHintingCheckBox->isChecked())
    
    330
    +  if (autoHintingCheckBox_->isChecked())
    
    306 331
       {
    
    307
    -    hintingModeLabel->setEnabled(false);
    
    308
    -    hintingModeComboBoxx->setEnabled(false);
    
    332
    +    hintingModeLabel_->setEnabled(false);
    
    333
    +    hintingModeComboBoxx_->setEnabled(false);
    
    309 334
     
    
    310
    -    horizontalHintingCheckBox->setEnabled(true);
    
    311
    -    verticalHintingCheckBox->setEnabled(true);
    
    312
    -    blueZoneHintingCheckBox->setEnabled(true);
    
    313
    -    segmentDrawingCheckBox->setEnabled(true);
    
    335
    +    horizontalHintingCheckBox_->setEnabled(true);
    
    336
    +    verticalHintingCheckBox_->setEnabled(true);
    
    337
    +    blueZoneHintingCheckBox_->setEnabled(true);
    
    338
    +    segmentDrawingCheckBox_->setEnabled(true);
    
    314 339
     
    
    315
    -    antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, true);
    
    340
    +    antiAliasingComboBoxx_->setItemEnabled(Engine::AntiAliasing_Light, true);
    
    316 341
       }
    
    317 342
       else
    
    318 343
       {
    
    319
    -    if (engine->fontType == Engine::FontType_CFF
    
    320
    -        || engine->fontType == Engine::FontType_TrueType)
    
    344
    +    if (engine_->currentFontType() == Engine::FontType_CFF
    
    345
    +        || engine_->currentFontType() == Engine::FontType_TrueType)
    
    321 346
         {
    
    322
    -      hintingModeLabel->setEnabled(true);
    
    323
    -      hintingModeComboBoxx->setEnabled(true);
    
    347
    +      hintingModeLabel_->setEnabled(true);
    
    348
    +      hintingModeComboBoxx_->setEnabled(true);
    
    324 349
         }
    
    325 350
     
    
    326
    -    horizontalHintingCheckBox->setEnabled(false);
    
    327
    -    verticalHintingCheckBox->setEnabled(false);
    
    328
    -    blueZoneHintingCheckBox->setEnabled(false);
    
    329
    -    segmentDrawingCheckBox->setEnabled(false);
    
    351
    +    horizontalHintingCheckBox_->setEnabled(false);
    
    352
    +    verticalHintingCheckBox_->setEnabled(false);
    
    353
    +    blueZoneHintingCheckBox_->setEnabled(false);
    
    354
    +    segmentDrawingCheckBox_->setEnabled(false);
    
    330 355
     
    
    331
    -    antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, false);
    
    356
    +    antiAliasingComboBoxx_->setItemEnabled(Engine::AntiAliasing_Light, false);
    
    332 357
     
    
    333
    -    if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_Light)
    
    334
    -      antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal);
    
    358
    +    if (antiAliasingComboBoxx_->currentIndex() == Engine::AntiAliasing_Light)
    
    359
    +      antiAliasingComboBoxx_->setCurrentIndex(Engine::AntiAliasing_Normal);
    
    335 360
       }
    
    336 361
     
    
    337 362
       drawGlyph();
    
    ... ... @@ -341,19 +366,19 @@ MainGUI::checkAutoHinting()
    341 366
     void
    
    342 367
     MainGUI::checkAntiAliasing()
    
    343 368
     {
    
    344
    -  int index = antiAliasingComboBoxx->currentIndex();
    
    369
    +  int index = antiAliasingComboBoxx_->currentIndex();
    
    345 370
     
    
    346
    -  if (index == AntiAliasing_None
    
    347
    -      || index == AntiAliasing_Normal
    
    348
    -      || index == AntiAliasing_Light)
    
    371
    +  if (index == Engine::AntiAliasing_None
    
    372
    +      || index == Engine::AntiAliasing::AntiAliasing_Normal
    
    373
    +      || index == Engine::AntiAliasing_Light)
    
    349 374
       {
    
    350
    -    lcdFilterLabel->setEnabled(false);
    
    351
    -    lcdFilterComboBox->setEnabled(false);
    
    375
    +    lcdFilterLabel_->setEnabled(false);
    
    376
    +    lcdFilterComboBox_->setEnabled(false);
    
    352 377
       }
    
    353 378
       else
    
    354 379
       {
    
    355
    -    lcdFilterLabel->setEnabled(true);
    
    356
    -    lcdFilterComboBox->setEnabled(true);
    
    380
    +    lcdFilterLabel_->setEnabled(true);
    
    381
    +    lcdFilterComboBox_->setEnabled(true);
    
    357 382
       }
    
    358 383
     
    
    359 384
       drawGlyph();
    
    ... ... @@ -363,18 +388,18 @@ MainGUI::checkAntiAliasing()
    363 388
     void
    
    364 389
     MainGUI::checkLcdFilter()
    
    365 390
     {
    
    366
    -  int index = lcdFilterComboBox->currentIndex();
    
    367
    -  FT_Library_SetLcdFilter(engine->library, lcdFilterHash.key(index));
    
    391
    +  int index = lcdFilterComboBox_->currentIndex();
    
    392
    +  engine_->setLcdFilter(lcdFilterHash_.key(index));
    
    368 393
     }
    
    369 394
     
    
    370 395
     
    
    371 396
     void
    
    372 397
     MainGUI::checkShowPoints()
    
    373 398
     {
    
    374
    -  if (showPointsCheckBox->isChecked())
    
    375
    -    showPointNumbersCheckBox->setEnabled(true);
    
    399
    +  if (showPointsCheckBox_->isChecked())
    
    400
    +    showPointNumbersCheckBox_->setEnabled(true);
    
    376 401
       else
    
    377
    -    showPointNumbersCheckBox->setEnabled(false);
    
    402
    +    showPointNumbersCheckBox_->setEnabled(false);
    
    378 403
     
    
    379 404
       drawGlyph();
    
    380 405
     }
    
    ... ... @@ -383,20 +408,20 @@ MainGUI::checkShowPoints()
    383 408
     void
    
    384 409
     MainGUI::checkUnits()
    
    385 410
     {
    
    386
    -  int index = unitsComboBox->currentIndex();
    
    411
    +  int index = unitsComboBox_->currentIndex();
    
    387 412
     
    
    388 413
       if (index == Units_px)
    
    389 414
       {
    
    390
    -    dpiLabel->setEnabled(false);
    
    391
    -    dpiSpinBox->setEnabled(false);
    
    392
    -    sizeDoubleSpinBox->setSingleStep(1);
    
    393
    -    sizeDoubleSpinBox->setValue(qRound(sizeDoubleSpinBox->value()));
    
    415
    +    dpiLabel_->setEnabled(false);
    
    416
    +    dpiSpinBox_->setEnabled(false);
    
    417
    +    sizeDoubleSpinBox_->setSingleStep(1);
    
    418
    +    sizeDoubleSpinBox_->setValue(qRound(sizeDoubleSpinBox_->value()));
    
    394 419
       }
    
    395 420
       else
    
    396 421
       {
    
    397
    -    dpiLabel->setEnabled(true);
    
    398
    -    dpiSpinBox->setEnabled(true);
    
    399
    -    sizeDoubleSpinBox->setSingleStep(0.5);
    
    422
    +    dpiLabel_->setEnabled(true);
    
    423
    +    dpiSpinBox_->setEnabled(true);
    
    424
    +    sizeDoubleSpinBox_->setSingleStep(0.5);
    
    400 425
       }
    
    401 426
     
    
    402 427
       drawGlyph();
    
    ... ... @@ -407,19 +432,19 @@ void
    407 432
     MainGUI::adjustGlyphIndex(int delta)
    
    408 433
     {
    
    409 434
       // only adjust current glyph index if we have a valid font
    
    410
    -  if (currentNumberOfGlyphs > 0)
    
    435
    +  if (currentNumberOfGlyphs_ > 0)
    
    411 436
       {
    
    412
    -    currentGlyphIndex += delta;
    
    413
    -    currentGlyphIndex = qBound(0,
    
    414
    -                               currentGlyphIndex,
    
    415
    -                               currentNumberOfGlyphs - 1);
    
    437
    +    currentGlyphIndex_ += delta;
    
    438
    +    currentGlyphIndex_ = qBound(0,
    
    439
    +                               currentGlyphIndex_,
    
    440
    +                               currentNumberOfGlyphs_ - 1);
    
    416 441
       }
    
    417 442
     
    
    418
    -  QString upperHex = QString::number(currentGlyphIndex, 16).toUpper();
    
    419
    -  glyphIndexLabel->setText(QString("%1 (0x%2)")
    
    420
    -                                   .arg(currentGlyphIndex)
    
    443
    +  QString upperHex = QString::number(currentGlyphIndex_, 16).toUpper();
    
    444
    +  glyphIndexLabel_->setText(QString("%1 (0x%2)")
    
    445
    +                                   .arg(currentGlyphIndex_)
    
    421 446
                                        .arg(upperHex));
    
    422
    -  glyphNameLabel->setText(engine->glyphName(currentGlyphIndex));
    
    447
    +  glyphNameLabel_->setText(engine_->glyphName(currentGlyphIndex_));
    
    423 448
     
    
    424 449
       drawGlyph();
    
    425 450
     }
    
    ... ... @@ -428,25 +453,25 @@ MainGUI::adjustGlyphIndex(int delta)
    428 453
     void
    
    429 454
     MainGUI::checkCurrentFontIndex()
    
    430 455
     {
    
    431
    -  if (fontList.size() < 2)
    
    456
    +  if (engine_->numberOfOpenedFonts() < 2)
    
    432 457
       {
    
    433
    -    previousFontButton->setEnabled(false);
    
    434
    -    nextFontButton->setEnabled(false);
    
    458
    +    previousFontButton_->setEnabled(false);
    
    459
    +    nextFontButton_->setEnabled(false);
    
    435 460
       }
    
    436
    -  else if (currentFontIndex == 0)
    
    461
    +  else if (currentFontIndex_ == 0)
    
    437 462
       {
    
    438
    -    previousFontButton->setEnabled(false);
    
    439
    -    nextFontButton->setEnabled(true);
    
    463
    +    previousFontButton_->setEnabled(false);
    
    464
    +    nextFontButton_->setEnabled(true);
    
    440 465
       }
    
    441
    -  else if (currentFontIndex >= fontList.size() - 1)
    
    466
    +  else if (currentFontIndex_ >= engine_->numberOfOpenedFonts() - 1)
    
    442 467
       {
    
    443
    -    previousFontButton->setEnabled(true);
    
    444
    -    nextFontButton->setEnabled(false);
    
    468
    +    previousFontButton_->setEnabled(true);
    
    469
    +    nextFontButton_->setEnabled(false);
    
    445 470
       }
    
    446 471
       else
    
    447 472
       {
    
    448
    -    previousFontButton->setEnabled(true);
    
    449
    -    nextFontButton->setEnabled(true);
    
    473
    +    previousFontButton_->setEnabled(true);
    
    474
    +    nextFontButton_->setEnabled(true);
    
    450 475
       }
    
    451 476
     }
    
    452 477
     
    
    ... ... @@ -454,25 +479,25 @@ MainGUI::checkCurrentFontIndex()
    454 479
     void
    
    455 480
     MainGUI::checkCurrentFaceIndex()
    
    456 481
     {
    
    457
    -  if (currentNumberOfFaces < 2)
    
    482
    +  if (currentNumberOfFaces_ < 2)
    
    458 483
       {
    
    459
    -    previousFaceButton->setEnabled(false);
    
    460
    -    nextFaceButton->setEnabled(false);
    
    484
    +    previousFaceButton_->setEnabled(false);
    
    485
    +    nextFaceButton_->setEnabled(false);
    
    461 486
       }
    
    462
    -  else if (currentFaceIndex == 0)
    
    487
    +  else if (currentFaceIndex_ == 0)
    
    463 488
       {
    
    464
    -    previousFaceButton->setEnabled(false);
    
    465
    -    nextFaceButton->setEnabled(true);
    
    489
    +    previousFaceButton_->setEnabled(false);
    
    490
    +    nextFaceButton_->setEnabled(true);
    
    466 491
       }
    
    467
    -  else if (currentFaceIndex >= currentNumberOfFaces - 1)
    
    492
    +  else if (currentFaceIndex_ >= currentNumberOfFaces_ - 1)
    
    468 493
       {
    
    469
    -    previousFaceButton->setEnabled(true);
    
    470
    -    nextFaceButton->setEnabled(false);
    
    494
    +    previousFaceButton_->setEnabled(true);
    
    495
    +    nextFaceButton_->setEnabled(false);
    
    471 496
       }
    
    472 497
       else
    
    473 498
       {
    
    474
    -    previousFaceButton->setEnabled(true);
    
    475
    -    nextFaceButton->setEnabled(true);
    
    499
    +    previousFaceButton_->setEnabled(true);
    
    500
    +    nextFaceButton_->setEnabled(true);
    
    476 501
       }
    
    477 502
     }
    
    478 503
     
    
    ... ... @@ -480,25 +505,25 @@ MainGUI::checkCurrentFaceIndex()
    480 505
     void
    
    481 506
     MainGUI::checkCurrentNamedInstanceIndex()
    
    482 507
     {
    
    483
    -  if (currentNumberOfNamedInstances < 2)
    
    508
    +  if (currentNumberOfNamedInstances_ < 2)
    
    484 509
       {
    
    485
    -    previousNamedInstanceButton->setEnabled(false);
    
    486
    -    nextNamedInstanceButton->setEnabled(false);
    
    510
    +    previousNamedInstanceButton_->setEnabled(false);
    
    511
    +    nextNamedInstanceButton_->setEnabled(false);
    
    487 512
       }
    
    488
    -  else if (currentNamedInstanceIndex == 0)
    
    513
    +  else if (currentNamedInstanceIndex_ == 0)
    
    489 514
       {
    
    490
    -    previousNamedInstanceButton->setEnabled(false);
    
    491
    -    nextNamedInstanceButton->setEnabled(true);
    
    515
    +    previousNamedInstanceButton_->setEnabled(false);
    
    516
    +    nextNamedInstanceButton_->setEnabled(true);
    
    492 517
       }
    
    493
    -  else if (currentNamedInstanceIndex >= currentNumberOfNamedInstances - 1)
    
    518
    +  else if (currentNamedInstanceIndex_ >= currentNumberOfNamedInstances_ - 1)
    
    494 519
       {
    
    495
    -    previousNamedInstanceButton->setEnabled(true);
    
    496
    -    nextNamedInstanceButton->setEnabled(false);
    
    520
    +    previousNamedInstanceButton_->setEnabled(true);
    
    521
    +    nextNamedInstanceButton_->setEnabled(false);
    
    497 522
       }
    
    498 523
       else
    
    499 524
       {
    
    500
    -    previousNamedInstanceButton->setEnabled(true);
    
    501
    -    nextNamedInstanceButton->setEnabled(true);
    
    525
    +    previousNamedInstanceButton_->setEnabled(true);
    
    526
    +    nextNamedInstanceButton_->setEnabled(true);
    
    502 527
       }
    
    503 528
     }
    
    504 529
     
    
    ... ... @@ -506,11 +531,11 @@ MainGUI::checkCurrentNamedInstanceIndex()
    506 531
     void
    
    507 532
     MainGUI::previousFont()
    
    508 533
     {
    
    509
    -  if (currentFontIndex > 0)
    
    534
    +  if (currentFontIndex_ > 0)
    
    510 535
       {
    
    511
    -    currentFontIndex--;
    
    512
    -    currentFaceIndex = 0;
    
    513
    -    currentNamedInstanceIndex = 0;
    
    536
    +    currentFontIndex_--;
    
    537
    +    currentFaceIndex_ = 0;
    
    538
    +    currentNamedInstanceIndex_ = 0;
    
    514 539
         showFont();
    
    515 540
       }
    
    516 541
     }
    
    ... ... @@ -519,11 +544,11 @@ MainGUI::previousFont()
    519 544
     void
    
    520 545
     MainGUI::nextFont()
    
    521 546
     {
    
    522
    -  if (currentFontIndex < fontList.size() - 1)
    
    547
    +  if (currentFontIndex_ < engine_->numberOfOpenedFonts() - 1)
    
    523 548
       {
    
    524
    -    currentFontIndex++;
    
    525
    -    currentFaceIndex = 0;
    
    526
    -    currentNamedInstanceIndex = 0;
    
    549
    +    currentFontIndex_++;
    
    550
    +    currentFaceIndex_ = 0;
    
    551
    +    currentNamedInstanceIndex_ = 0;
    
    527 552
         showFont();
    
    528 553
       }
    
    529 554
     }
    
    ... ... @@ -532,10 +557,10 @@ MainGUI::nextFont()
    532 557
     void
    
    533 558
     MainGUI::previousFace()
    
    534 559
     {
    
    535
    -  if (currentFaceIndex > 0)
    
    560
    +  if (currentFaceIndex_ > 0)
    
    536 561
       {
    
    537
    -    currentFaceIndex--;
    
    538
    -    currentNamedInstanceIndex = 0;
    
    562
    +    currentFaceIndex_--;
    
    563
    +    currentNamedInstanceIndex_ = 0;
    
    539 564
         showFont();
    
    540 565
       }
    
    541 566
     }
    
    ... ... @@ -544,10 +569,10 @@ MainGUI::previousFace()
    544 569
     void
    
    545 570
     MainGUI::nextFace()
    
    546 571
     {
    
    547
    -  if (currentFaceIndex < currentNumberOfFaces - 1)
    
    572
    +  if (currentFaceIndex_ < currentNumberOfFaces_ - 1)
    
    548 573
       {
    
    549
    -    currentFaceIndex++;
    
    550
    -    currentNamedInstanceIndex = 0;
    
    574
    +    currentFaceIndex_++;
    
    575
    +    currentNamedInstanceIndex_ = 0;
    
    551 576
         showFont();
    
    552 577
       }
    
    553 578
     }
    
    ... ... @@ -556,9 +581,9 @@ MainGUI::nextFace()
    556 581
     void
    
    557 582
     MainGUI::previousNamedInstance()
    
    558 583
     {
    
    559
    -  if (currentNamedInstanceIndex > 0)
    
    584
    +  if (currentNamedInstanceIndex_ > 0)
    
    560 585
       {
    
    561
    -    currentNamedInstanceIndex--;
    
    586
    +    currentNamedInstanceIndex_--;
    
    562 587
         showFont();
    
    563 588
       }
    
    564 589
     }
    
    ... ... @@ -567,9 +592,9 @@ MainGUI::previousNamedInstance()
    567 592
     void
    
    568 593
     MainGUI::nextNamedInstance()
    
    569 594
     {
    
    570
    -  if (currentNamedInstanceIndex < currentNumberOfNamedInstances - 1)
    
    595
    +  if (currentNamedInstanceIndex_ < currentNumberOfNamedInstances_ - 1)
    
    571 596
       {
    
    572
    -    currentNamedInstanceIndex++;
    
    597
    +    currentNamedInstanceIndex_++;
    
    573 598
         showFont();
    
    574 599
       }
    
    575 600
     }
    
    ... ... @@ -578,7 +603,7 @@ MainGUI::nextNamedInstance()
    578 603
     void
    
    579 604
     MainGUI::zoom()
    
    580 605
     {
    
    581
    -  int scale = zoomSpinBox->value();
    
    606
    +  int scale = zoomSpinBox_->value();
    
    582 607
     
    
    583 608
       QTransform transform;
    
    584 609
       transform.scale(scale, scale);
    
    ... ... @@ -589,7 +614,7 @@ MainGUI::zoom()
    589 614
       qreal shift = 0.5 / scale;
    
    590 615
       transform.translate(shift, shift);
    
    591 616
     
    
    592
    -  glyphView->setTransform(transform);
    
    617
    +  glyphView_->setTransform(transform);
    
    593 618
     }
    
    594 619
     
    
    595 620
     
    
    ... ... @@ -598,28 +623,28 @@ MainGUI::setGraphicsDefaults()
    598 623
     {
    
    599 624
       // color tables (with suitable opacity values) for converting
    
    600 625
       // FreeType's pixmaps to something Qt understands
    
    601
    -  monoColorTable.append(QColor(Qt::transparent).rgba());
    
    602
    -  monoColorTable.append(QColor(Qt::black).rgba());
    
    626
    +  monoColorTable_.append(QColor(Qt::transparent).rgba());
    
    627
    +  monoColorTable_.append(QColor(Qt::black).rgba());
    
    603 628
     
    
    604 629
       for (int i = 0xFF; i >= 0; i--)
    
    605
    -    grayColorTable.append(qRgba(i, i, i, 0xFF - i));
    
    630
    +    grayColorTable_.append(qRgba(i, i, i, 0xFF - i));
    
    606 631
     
    
    607 632
       // XXX make this user-configurable
    
    608 633
     
    
    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);
    
    634
    +  axisPen_.setColor(Qt::black);
    
    635
    +  axisPen_.setWidth(0);
    
    636
    +  blueZonePen_.setColor(QColor(64, 64, 255, 64)); // light blue
    
    637
    +  blueZonePen_.setWidth(0);
    
    638
    +  gridPen_.setColor(Qt::lightGray);
    
    639
    +  gridPen_.setWidth(0);
    
    640
    +  offPen_.setColor(Qt::darkGreen);
    
    641
    +  offPen_.setWidth(3);
    
    642
    +  onPen_.setColor(Qt::red);
    
    643
    +  onPen_.setWidth(3);
    
    644
    +  outlinePen_.setColor(Qt::red);
    
    645
    +  outlinePen_.setWidth(0);
    
    646
    +  segmentPen_.setColor(QColor(64, 255, 128, 64)); // light green
    
    647
    +  segmentPen_.setWidth(0);
    
    623 648
     }
    
    624 649
     
    
    625 650
     
    
    ... ... @@ -628,81 +653,82 @@ MainGUI::drawGlyph()
    628 653
     {
    
    629 654
       // the call to `engine->loadOutline' updates FreeType's load flags
    
    630 655
     
    
    631
    -  if (!engine)
    
    656
    +  if (!engine_)
    
    632 657
         return;
    
    633 658
     
    
    634
    -  if (currentGlyphBitmapItem)
    
    659
    +  if (currentGlyphBitmapItem_)
    
    635 660
       {
    
    636
    -    glyphScene->removeItem(currentGlyphBitmapItem);
    
    637
    -    delete currentGlyphBitmapItem;
    
    661
    +    glyphScene_->removeItem(currentGlyphBitmapItem_);
    
    662
    +    delete currentGlyphBitmapItem_;
    
    638 663
     
    
    639
    -    currentGlyphBitmapItem = NULL;
    
    664
    +    currentGlyphBitmapItem_ = NULL;
    
    640 665
       }
    
    641 666
     
    
    642
    -  if (currentGlyphOutlineItem)
    
    667
    +  if (currentGlyphOutlineItem_)
    
    643 668
       {
    
    644
    -    glyphScene->removeItem(currentGlyphOutlineItem);
    
    645
    -    delete currentGlyphOutlineItem;
    
    669
    +    glyphScene_->removeItem(currentGlyphOutlineItem_);
    
    670
    +    delete currentGlyphOutlineItem_;
    
    646 671
     
    
    647
    -    currentGlyphOutlineItem = NULL;
    
    672
    +    currentGlyphOutlineItem_ = NULL;
    
    648 673
       }
    
    649 674
     
    
    650
    -  if (currentGlyphPointsItem)
    
    675
    +  if (currentGlyphPointsItem_)
    
    651 676
       {
    
    652
    -    glyphScene->removeItem(currentGlyphPointsItem);
    
    653
    -    delete currentGlyphPointsItem;
    
    677
    +    glyphScene_->removeItem(currentGlyphPointsItem_);
    
    678
    +    delete currentGlyphPointsItem_;
    
    654 679
     
    
    655
    -    currentGlyphPointsItem = NULL;
    
    680
    +    currentGlyphPointsItem_ = NULL;
    
    656 681
       }
    
    657 682
     
    
    658
    -  if (currentGlyphPointNumbersItem)
    
    683
    +  if (currentGlyphPointNumbersItem_)
    
    659 684
       {
    
    660
    -    glyphScene->removeItem(currentGlyphPointNumbersItem);
    
    661
    -    delete currentGlyphPointNumbersItem;
    
    685
    +    glyphScene_->removeItem(currentGlyphPointNumbersItem_);
    
    686
    +    delete currentGlyphPointNumbersItem_;
    
    662 687
     
    
    663
    -    currentGlyphPointNumbersItem = NULL;
    
    688
    +    currentGlyphPointNumbersItem_ = NULL;
    
    664 689
       }
    
    665 690
     
    
    666
    -  FT_Outline* outline = engine->loadOutline(currentGlyphIndex);
    
    691
    +  syncSettings();
    
    692
    +  FT_Outline* outline = engine_->loadOutline(currentGlyphIndex_);
    
    667 693
       if (outline)
    
    668 694
       {
    
    669
    -    if (showBitmapCheckBox->isChecked())
    
    695
    +    if (showBitmapCheckBox_->isChecked())
    
    670 696
         {
    
    671 697
           // XXX support LCD
    
    672 698
           FT_Pixel_Mode pixelMode = FT_PIXEL_MODE_GRAY;
    
    673
    -      if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_None)
    
    699
    +      if (antiAliasingComboBoxx_->currentIndex() == Engine::AntiAliasing_None)
    
    674 700
             pixelMode = FT_PIXEL_MODE_MONO;
    
    675 701
     
    
    676
    -      currentGlyphBitmapItem = new GlyphBitmap(outline,
    
    677
    -                                               engine->library,
    
    702
    +      currentGlyphBitmapItem_ = new GlyphBitmap(outline,
    
    703
    +                                               engine_->ftLibrary(),
    
    678 704
                                                    pixelMode,
    
    679
    -                                               monoColorTable,
    
    680
    -                                               grayColorTable);
    
    681
    -      glyphScene->addItem(currentGlyphBitmapItem);
    
    705
    +                                               monoColorTable_,
    
    706
    +                                               grayColorTable_);
    
    707
    +      glyphScene_->addItem(currentGlyphBitmapItem_);
    
    682 708
         }
    
    683 709
     
    
    684
    -    if (showOutlinesCheckBox->isChecked())
    
    710
    +    if (showOutlinesCheckBox_->isChecked())
    
    685 711
         {
    
    686
    -      currentGlyphOutlineItem = new GlyphOutline(outlinePen, outline);
    
    687
    -      glyphScene->addItem(currentGlyphOutlineItem);
    
    712
    +      currentGlyphOutlineItem_ = new GlyphOutline(outlinePen_, outline);
    
    713
    +      glyphScene_->addItem(currentGlyphOutlineItem_);
    
    688 714
         }
    
    689 715
     
    
    690
    -    if (showPointsCheckBox->isChecked())
    
    716
    +    if (showPointsCheckBox_->isChecked())
    
    691 717
         {
    
    692
    -      currentGlyphPointsItem = new GlyphPoints(onPen, offPen, outline);
    
    693
    -      glyphScene->addItem(currentGlyphPointsItem);
    
    718
    +      currentGlyphPointsItem_ = new GlyphPoints(onPen_, offPen_, outline);
    
    719
    +      glyphScene_->addItem(currentGlyphPointsItem_);
    
    694 720
     
    
    695
    -      if (showPointNumbersCheckBox->isChecked())
    
    721
    +      if (showPointNumbersCheckBox_->isChecked())
    
    696 722
           {
    
    697
    -        currentGlyphPointNumbersItem = new GlyphPointNumbers(onPen,
    
    698
    -                                                             offPen,
    
    723
    +        currentGlyphPointNumbersItem_ = new GlyphPointNumbers(onPen_,
    
    724
    +                                                             offPen_,
    
    699 725
                                                                  outline);
    
    700
    -        glyphScene->addItem(currentGlyphPointNumbersItem);
    
    726
    +        glyphScene_->addItem(currentGlyphPointNumbersItem_);
    
    701 727
           }
    
    702 728
         }
    
    703 729
       }
    
    704 730
     
    
    705
    -  glyphScene->update();
    
    731
    +  glyphScene_->update();
    
    706 732
     }
    
    707 733
     
    
    708 734
     
    
    ... ... @@ -712,309 +738,309 @@ void
    712 738
     MainGUI::createLayout()
    
    713 739
     {
    
    714 740
       // left side
    
    715
    -  fontFilenameLabel = new QLabel;
    
    741
    +  fontFilenameLabel_ = new QLabel;
    
    716 742
     
    
    717
    -  hintingCheckBox = new QCheckBox(tr("Hinting"));
    
    743
    +  hintingCheckBox_ = new QCheckBox(tr("Hinting"));
    
    718 744
     
    
    719
    -  hintingModeLabel = new QLabel(tr("Hinting Mode"));
    
    720
    -  hintingModeLabel->setAlignment(Qt::AlignRight);
    
    721
    -  hintingModeComboBoxx = new QComboBoxx;
    
    722
    -  hintingModeComboBoxx->insertItem(HintingMode_TrueType_v35,
    
    745
    +  hintingModeLabel_ = new QLabel(tr("Hinting Mode"));
    
    746
    +  hintingModeLabel_->setAlignment(Qt::AlignRight);
    
    747
    +  hintingModeComboBoxx_ = new QComboBoxx;
    
    748
    +  hintingModeComboBoxx_->insertItem(HintingMode_TrueType_v35,
    
    723 749
                                        tr("TrueType v35"));
    
    724
    -  hintingModeComboBoxx->insertItem(HintingMode_TrueType_v38,
    
    750
    +  hintingModeComboBoxx_->insertItem(HintingMode_TrueType_v38,
    
    725 751
                                        tr("TrueType v38"));
    
    726
    -  hintingModeComboBoxx->insertItem(HintingMode_TrueType_v40,
    
    752
    +  hintingModeComboBoxx_->insertItem(HintingMode_TrueType_v40,
    
    727 753
                                        tr("TrueType v40"));
    
    728
    -  hintingModeComboBoxx->insertItem(HintingMode_CFF_FreeType,
    
    754
    +  hintingModeComboBoxx_->insertItem(HintingMode_CFF_FreeType,
    
    729 755
                                        tr("CFF (FreeType)"));
    
    730
    -  hintingModeComboBoxx->insertItem(HintingMode_CFF_Adobe,
    
    756
    +  hintingModeComboBoxx_->insertItem(HintingMode_CFF_Adobe,
    
    731 757
                                        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,
    
    758
    +  hintingModeLabel_->setBuddy(hintingModeComboBoxx_);
    
    759
    +
    
    760
    +  autoHintingCheckBox_ = new QCheckBox(tr("Auto-Hinting"));
    
    761
    +  horizontalHintingCheckBox_ = new QCheckBox(tr("Horizontal Hinting"));
    
    762
    +  verticalHintingCheckBox_ = new QCheckBox(tr("Vertical Hinting"));
    
    763
    +  blueZoneHintingCheckBox_ = new QCheckBox(tr("Blue-Zone Hinting"));
    
    764
    +  segmentDrawingCheckBox_ = new QCheckBox(tr("Segment Drawing"));
    
    765
    +
    
    766
    +  antiAliasingLabel_ = new QLabel(tr("Anti-Aliasing"));
    
    767
    +  antiAliasingLabel_->setAlignment(Qt::AlignRight);
    
    768
    +  antiAliasingComboBoxx_ = new QComboBoxx;
    
    769
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_None,
    
    744 770
                                         tr("None"));
    
    745
    -  antiAliasingComboBoxx->insertItem(AntiAliasing_Normal,
    
    771
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_Normal,
    
    746 772
                                         tr("Normal"));
    
    747
    -  antiAliasingComboBoxx->insertItem(AntiAliasing_Light,
    
    773
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_Light,
    
    748 774
                                         tr("Light"));
    
    749
    -  antiAliasingComboBoxx->insertItem(AntiAliasing_LCD,
    
    775
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_LCD,
    
    750 776
                                         tr("LCD (RGB)"));
    
    751
    -  antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_BGR,
    
    777
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_LCD_BGR,
    
    752 778
                                         tr("LCD (BGR)"));
    
    753
    -  antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical,
    
    779
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_LCD_Vertical,
    
    754 780
                                         tr("LCD (vert. RGB)"));
    
    755
    -  antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical_BGR,
    
    781
    +  antiAliasingComboBoxx_->insertItem(Engine::AntiAliasing_LCD_Vertical_BGR,
    
    756 782
                                         tr("LCD (vert. BGR)"));
    
    757
    -  antiAliasingLabel->setBuddy(antiAliasingComboBoxx);
    
    783
    +  antiAliasingLabel_->setBuddy(antiAliasingComboBoxx_);
    
    758 784
     
    
    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);
    
    785
    +  lcdFilterLabel_ = new QLabel(tr("LCD Filter"));
    
    786
    +  lcdFilterLabel_->setAlignment(Qt::AlignRight);
    
    787
    +  lcdFilterComboBox_ = new QComboBox;
    
    788
    +  lcdFilterComboBox_->insertItem(LCDFilter_Default, tr("Default"));
    
    789
    +  lcdFilterComboBox_->insertItem(LCDFilter_Light, tr("Light"));
    
    790
    +  lcdFilterComboBox_->insertItem(LCDFilter_None, tr("None"));
    
    791
    +  lcdFilterComboBox_->insertItem(LCDFilter_Legacy, tr("Legacy"));
    
    792
    +  lcdFilterLabel_->setBuddy(lcdFilterComboBox_);
    
    767 793
     
    
    768 794
       int width;
    
    769 795
       // 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);
    
    796
    +  width = hintingModeLabel_->minimumSizeHint().width();
    
    797
    +  width = qMax(antiAliasingLabel_->minimumSizeHint().width(), width);
    
    798
    +  width = qMax(lcdFilterLabel_->minimumSizeHint().width(), width);
    
    799
    +  hintingModeLabel_->setMinimumWidth(width);
    
    800
    +  antiAliasingLabel_->setMinimumWidth(width);
    
    801
    +  lcdFilterLabel_->setMinimumWidth(width);
    
    776 802
     
    
    777 803
       // ensure that all items in combo boxes fit completely;
    
    778 804
       // 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);
    
    805
    +  width = hintingModeComboBoxx_->minimumSizeHint().width();
    
    806
    +  width = qMax(antiAliasingComboBoxx_->minimumSizeHint().width(), width);
    
    807
    +  width = qMax(lcdFilterComboBox_->minimumSizeHint().width(), width);
    
    808
    +  hintingModeComboBoxx_->setMinimumWidth(width);
    
    809
    +  antiAliasingComboBoxx_->setMinimumWidth(width);
    
    810
    +  lcdFilterComboBox_->setMinimumWidth(width);
    
    811
    +
    
    812
    +  gammaLabel_ = new QLabel(tr("Gamma"));
    
    813
    +  gammaLabel_->setAlignment(Qt::AlignRight);
    
    814
    +  gammaSlider_ = new QSlider(Qt::Horizontal);
    
    815
    +  gammaSlider_->setRange(0, 30); // in 1/10th
    
    816
    +  gammaSlider_->setTickPosition(QSlider::TicksBelow);
    
    817
    +  gammaSlider_->setTickInterval(5);
    
    818
    +  gammaLabel_->setBuddy(gammaSlider_);
    
    819
    +
    
    820
    +  showBitmapCheckBox_ = new QCheckBox(tr("Show Bitmap"));
    
    821
    +  showPointsCheckBox_ = new QCheckBox(tr("Show Points"));
    
    822
    +  showPointNumbersCheckBox_ = new QCheckBox(tr("Show Point Numbers"));
    
    823
    +  showOutlinesCheckBox_ = new QCheckBox(tr("Show Outlines"));
    
    824
    +
    
    825
    +  infoLeftLayout_ = new QHBoxLayout;
    
    826
    +  infoLeftLayout_->addWidget(fontFilenameLabel_);
    
    827
    +
    
    828
    +  hintingModeLayout_ = new QHBoxLayout;
    
    829
    +  hintingModeLayout_->addWidget(hintingModeLabel_);
    
    830
    +  hintingModeLayout_->addWidget(hintingModeComboBoxx_);
    
    831
    +
    
    832
    +  horizontalHintingLayout_ = new QHBoxLayout;
    
    833
    +  horizontalHintingLayout_->addSpacing(20); // XXX px
    
    834
    +  horizontalHintingLayout_->addWidget(horizontalHintingCheckBox_);
    
    835
    +
    
    836
    +  verticalHintingLayout_ = new QHBoxLayout;
    
    837
    +  verticalHintingLayout_->addSpacing(20); // XXX px
    
    838
    +  verticalHintingLayout_->addWidget(verticalHintingCheckBox_);
    
    839
    +
    
    840
    +  blueZoneHintingLayout_ = new QHBoxLayout;
    
    841
    +  blueZoneHintingLayout_->addSpacing(20); // XXX px
    
    842
    +  blueZoneHintingLayout_->addWidget(blueZoneHintingCheckBox_);
    
    843
    +
    
    844
    +  segmentDrawingLayout_ = new QHBoxLayout;
    
    845
    +  segmentDrawingLayout_->addSpacing(20); // XXX px
    
    846
    +  segmentDrawingLayout_->addWidget(segmentDrawingCheckBox_);
    
    847
    +
    
    848
    +  antiAliasingLayout_ = new QHBoxLayout;
    
    849
    +  antiAliasingLayout_->addWidget(antiAliasingLabel_);
    
    850
    +  antiAliasingLayout_->addWidget(antiAliasingComboBoxx_);
    
    851
    +
    
    852
    +  lcdFilterLayout_ = new QHBoxLayout;
    
    853
    +  lcdFilterLayout_->addWidget(lcdFilterLabel_);
    
    854
    +  lcdFilterLayout_->addWidget(lcdFilterComboBox_);
    
    855
    +
    
    856
    +  gammaLayout_ = new QHBoxLayout;
    
    857
    +  gammaLayout_->addWidget(gammaLabel_);
    
    858
    +  gammaLayout_->addWidget(gammaSlider_);
    
    859
    +
    
    860
    +  pointNumbersLayout_ = new QHBoxLayout;
    
    861
    +  pointNumbersLayout_->addSpacing(20); // XXX px
    
    862
    +  pointNumbersLayout_->addWidget(showPointNumbersCheckBox_);
    
    863
    +
    
    864
    +  generalTabLayout_ = new QVBoxLayout;
    
    865
    +  generalTabLayout_->addWidget(hintingCheckBox_);
    
    866
    +  generalTabLayout_->addLayout(hintingModeLayout_);
    
    867
    +  generalTabLayout_->addWidget(autoHintingCheckBox_);
    
    868
    +  generalTabLayout_->addLayout(horizontalHintingLayout_);
    
    869
    +  generalTabLayout_->addLayout(verticalHintingLayout_);
    
    870
    +  generalTabLayout_->addLayout(blueZoneHintingLayout_);
    
    871
    +  generalTabLayout_->addLayout(segmentDrawingLayout_);
    
    872
    +  generalTabLayout_->addSpacing(20); // XXX px
    
    873
    +  generalTabLayout_->addStretch(1);
    
    874
    +  generalTabLayout_->addLayout(antiAliasingLayout_);
    
    875
    +  generalTabLayout_->addLayout(lcdFilterLayout_);
    
    876
    +  generalTabLayout_->addSpacing(20); // XXX px
    
    877
    +  generalTabLayout_->addStretch(1);
    
    878
    +  generalTabLayout_->addLayout(gammaLayout_);
    
    879
    +  generalTabLayout_->addSpacing(20); // XXX px
    
    880
    +  generalTabLayout_->addStretch(1);
    
    881
    +  generalTabLayout_->addWidget(showBitmapCheckBox_);
    
    882
    +  generalTabLayout_->addWidget(showPointsCheckBox_);
    
    883
    +  generalTabLayout_->addLayout(pointNumbersLayout_);
    
    884
    +  generalTabLayout_->addWidget(showOutlinesCheckBox_);
    
    885
    +
    
    886
    +  generalTabWidget_ = new QWidget;
    
    887
    +  generalTabWidget_->setLayout(generalTabLayout_);
    
    888
    +
    
    889
    +  mmgxTabWidget_ = new QWidget;
    
    890
    +
    
    891
    +  tabWidget_ = new QTabWidget;
    
    892
    +  tabWidget_->addTab(generalTabWidget_, tr("General"));
    
    893
    +  tabWidget_->addTab(mmgxTabWidget_, tr("MM/GX"));
    
    894
    +
    
    895
    +  leftLayout_ = new QVBoxLayout;
    
    896
    +  leftLayout_->addLayout(infoLeftLayout_);
    
    897
    +  leftLayout_->addWidget(tabWidget_);
    
    872 898
     
    
    873 899
       // we don't want to expand the left side horizontally;
    
    874 900
       // to change the policy we have to use a widget wrapper
    
    875
    -  leftWidget = new QWidget;
    
    876
    -  leftWidget->setLayout(leftLayout);
    
    901
    +  leftWidget_ = new QWidget;
    
    902
    +  leftWidget_->setLayout(leftLayout_);
    
    877 903
     
    
    878 904
       QSizePolicy leftWidgetPolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    
    879 905
       leftWidgetPolicy.setHorizontalStretch(0);
    
    880
    -  leftWidgetPolicy.setVerticalPolicy(leftWidget->sizePolicy().verticalPolicy());
    
    881
    -  leftWidgetPolicy.setHeightForWidth(leftWidget->sizePolicy().hasHeightForWidth());
    
    906
    +  leftWidgetPolicy.setVerticalPolicy(leftWidget_->sizePolicy().verticalPolicy());
    
    907
    +  leftWidgetPolicy.setHeightForWidth(leftWidget_->sizePolicy().hasHeightForWidth());
    
    882 908
     
    
    883
    -  leftWidget->setSizePolicy(leftWidgetPolicy);
    
    909
    +  leftWidget_->setSizePolicy(leftWidgetPolicy);
    
    884 910
     
    
    885 911
       // right side
    
    886
    -  glyphIndexLabel = new QLabel;
    
    887
    -  glyphNameLabel = new QLabel;
    
    888
    -  fontNameLabel = new QLabel;
    
    912
    +  glyphIndexLabel_ = new QLabel;
    
    913
    +  glyphNameLabel_ = new QLabel;
    
    914
    +  fontNameLabel_ = new QLabel;
    
    889 915
     
    
    890
    -  glyphScene = new QGraphicsScene;
    
    891
    -  glyphScene->addItem(new Grid(gridPen, axisPen));
    
    916
    +  glyphScene_ = new QGraphicsScene;
    
    917
    +  glyphScene_->addItem(new Grid(gridPen_, axisPen_));
    
    892 918
     
    
    893
    -  currentGlyphBitmapItem = NULL;
    
    894
    -  currentGlyphOutlineItem = NULL;
    
    895
    -  currentGlyphPointsItem = NULL;
    
    896
    -  currentGlyphPointNumbersItem = NULL;
    
    919
    +  currentGlyphBitmapItem_ = NULL;
    
    920
    +  currentGlyphOutlineItem_ = NULL;
    
    921
    +  currentGlyphPointsItem_ = NULL;
    
    922
    +  currentGlyphPointNumbersItem_ = NULL;
    
    897 923
       drawGlyph();
    
    898 924
     
    
    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"));
    
    925
    +  glyphView_ = new QGraphicsViewx;
    
    926
    +  glyphView_->setRenderHint(QPainter::Antialiasing, true);
    
    927
    +  glyphView_->setDragMode(QGraphicsView::ScrollHandDrag);
    
    928
    +  glyphView_->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    
    929
    +  glyphView_->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    
    930
    +  glyphView_->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
    
    931
    +  glyphView_->setScene(glyphScene_);
    
    932
    +
    
    933
    +  sizeLabel_ = new QLabel(tr("Size "));
    
    934
    +  sizeLabel_->setAlignment(Qt::AlignRight);
    
    935
    +  sizeDoubleSpinBox_ = new QDoubleSpinBox;
    
    936
    +  sizeDoubleSpinBox_->setAlignment(Qt::AlignRight);
    
    937
    +  sizeDoubleSpinBox_->setDecimals(1);
    
    938
    +  sizeDoubleSpinBox_->setRange(1, 500);
    
    939
    +  sizeLabel_->setBuddy(sizeDoubleSpinBox_);
    
    940
    +
    
    941
    +  unitsComboBox_ = new QComboBox;
    
    942
    +  unitsComboBox_->insertItem(Units_px, "px");
    
    943
    +  unitsComboBox_->insertItem(Units_pt, "pt");
    
    944
    +
    
    945
    +  dpiLabel_ = new QLabel(tr("DPI "));
    
    946
    +  dpiLabel_->setAlignment(Qt::AlignRight);
    
    947
    +  dpiSpinBox_ = new QSpinBox;
    
    948
    +  dpiSpinBox_->setAlignment(Qt::AlignRight);
    
    949
    +  dpiSpinBox_->setRange(10, 600);
    
    950
    +  dpiLabel_->setBuddy(dpiSpinBox_);
    
    951
    +
    
    952
    +  toStartButtonx_ = new QPushButtonx("|<");
    
    953
    +  toM1000Buttonx_ = new QPushButtonx("-1000");
    
    954
    +  toM100Buttonx_ = new QPushButtonx("-100");
    
    955
    +  toM10Buttonx_ = new QPushButtonx("-10");
    
    956
    +  toM1Buttonx_ = new QPushButtonx("-1");
    
    957
    +  toP1Buttonx_ = new QPushButtonx("+1");
    
    958
    +  toP10Buttonx_ = new QPushButtonx("+10");
    
    959
    +  toP100Buttonx_ = new QPushButtonx("+100");
    
    960
    +  toP1000Buttonx_ = new QPushButtonx("+1000");
    
    961
    +  toEndButtonx_ = new QPushButtonx(">|");
    
    962
    +
    
    963
    +  zoomLabel_ = new QLabel(tr("Zoom Factor"));
    
    964
    +  zoomLabel_->setAlignment(Qt::AlignRight);
    
    965
    +  zoomSpinBox_ = new QSpinBoxx;
    
    966
    +  zoomSpinBox_->setAlignment(Qt::AlignRight);
    
    967
    +  zoomSpinBox_->setRange(1, 1000 - 1000 % 64);
    
    968
    +  zoomSpinBox_->setKeyboardTracking(false);
    
    969
    +  zoomLabel_->setBuddy(zoomSpinBox_);
    
    970
    +
    
    971
    +  previousFontButton_ = new QPushButton(tr("Previous Font"));
    
    972
    +  nextFontButton_ = new QPushButton(tr("Next Font"));
    
    973
    +  previousFaceButton_ = new QPushButton(tr("Previous Face"));
    
    974
    +  nextFaceButton_ = new QPushButton(tr("Next Face"));
    
    975
    +  previousNamedInstanceButton_ = new QPushButton(tr("Previous Named Instance"));
    
    976
    +  nextNamedInstanceButton_ = new QPushButton(tr("Next Named Instance"));
    
    951 977
     
    
    952 978
       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);
    
    979
    +  infoRightLayout->addWidget(glyphIndexLabel_, 0, 0);
    
    980
    +  infoRightLayout->addWidget(glyphNameLabel_, 0, 1);
    
    981
    +  infoRightLayout->addWidget(fontNameLabel_, 0, 2);
    
    982
    +
    
    983
    +  navigationLayout_ = new QHBoxLayout;
    
    984
    +  navigationLayout_->setSpacing(0);
    
    985
    +  navigationLayout_->addStretch(1);
    
    986
    +  navigationLayout_->addWidget(toStartButtonx_);
    
    987
    +  navigationLayout_->addWidget(toM1000Buttonx_);
    
    988
    +  navigationLayout_->addWidget(toM100Buttonx_);
    
    989
    +  navigationLayout_->addWidget(toM10Buttonx_);
    
    990
    +  navigationLayout_->addWidget(toM1Buttonx_);
    
    991
    +  navigationLayout_->addWidget(toP1Buttonx_);
    
    992
    +  navigationLayout_->addWidget(toP10Buttonx_);
    
    993
    +  navigationLayout_->addWidget(toP100Buttonx_);
    
    994
    +  navigationLayout_->addWidget(toP1000Buttonx_);
    
    995
    +  navigationLayout_->addWidget(toEndButtonx_);
    
    996
    +  navigationLayout_->addStretch(1);
    
    997
    +
    
    998
    +  sizeLayout_ = new QHBoxLayout;
    
    999
    +  sizeLayout_->addStretch(2);
    
    1000
    +  sizeLayout_->addWidget(sizeLabel_);
    
    1001
    +  sizeLayout_->addWidget(sizeDoubleSpinBox_);
    
    1002
    +  sizeLayout_->addWidget(unitsComboBox_);
    
    1003
    +  sizeLayout_->addStretch(1);
    
    1004
    +  sizeLayout_->addWidget(dpiLabel_);
    
    1005
    +  sizeLayout_->addWidget(dpiSpinBox_);
    
    1006
    +  sizeLayout_->addStretch(1);
    
    1007
    +  sizeLayout_->addWidget(zoomLabel_);
    
    1008
    +  sizeLayout_->addWidget(zoomSpinBox_);
    
    1009
    +  sizeLayout_->addStretch(2);
    
    984 1010
     
    
    985 1011
       fontLayout = new QGridLayout;
    
    986 1012
       fontLayout->setColumnStretch(0, 2);
    
    987
    -  fontLayout->addWidget(nextFontButton, 0, 1);
    
    988
    -  fontLayout->addWidget(previousFontButton, 1, 1);
    
    1013
    +  fontLayout->addWidget(nextFontButton_, 0, 1);
    
    1014
    +  fontLayout->addWidget(previousFontButton_, 1, 1);
    
    989 1015
       fontLayout->setColumnStretch(2, 1);
    
    990
    -  fontLayout->addWidget(nextFaceButton, 0, 3);
    
    991
    -  fontLayout->addWidget(previousFaceButton, 1, 3);
    
    1016
    +  fontLayout->addWidget(nextFaceButton_, 0, 3);
    
    1017
    +  fontLayout->addWidget(previousFaceButton_, 1, 3);
    
    992 1018
       fontLayout->setColumnStretch(4, 1);
    
    993
    -  fontLayout->addWidget(nextNamedInstanceButton, 0, 5);
    
    994
    -  fontLayout->addWidget(previousNamedInstanceButton, 1, 5);
    
    1019
    +  fontLayout->addWidget(nextNamedInstanceButton_, 0, 5);
    
    1020
    +  fontLayout->addWidget(previousNamedInstanceButton_, 1, 5);
    
    995 1021
       fontLayout->setColumnStretch(6, 2);
    
    996 1022
     
    
    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);
    
    1023
    +  rightLayout_ = new QVBoxLayout;
    
    1024
    +  rightLayout_->addLayout(infoRightLayout);
    
    1025
    +  rightLayout_->addWidget(glyphView_);
    
    1026
    +  rightLayout_->addLayout(navigationLayout_);
    
    1027
    +  rightLayout_->addSpacing(10); // XXX px
    
    1028
    +  rightLayout_->addLayout(sizeLayout_);
    
    1029
    +  rightLayout_->addSpacing(10); // XXX px
    
    1030
    +  rightLayout_->addLayout(fontLayout);
    
    1005 1031
     
    
    1006 1032
       // for symmetry with the left side use a widget also
    
    1007
    -  rightWidget = new QWidget;
    
    1008
    -  rightWidget->setLayout(rightLayout);
    
    1033
    +  rightWidget_ = new QWidget;
    
    1034
    +  rightWidget_->setLayout(rightLayout_);
    
    1009 1035
     
    
    1010 1036
       // the whole thing
    
    1011
    -  ftinspectLayout = new QHBoxLayout;
    
    1012
    -  ftinspectLayout->addWidget(leftWidget);
    
    1013
    -  ftinspectLayout->addWidget(rightWidget);
    
    1037
    +  ftinspectLayout_ = new QHBoxLayout;
    
    1038
    +  ftinspectLayout_->addWidget(leftWidget_);
    
    1039
    +  ftinspectLayout_->addWidget(rightWidget_);
    
    1014 1040
     
    
    1015
    -  ftinspectWidget = new QWidget;
    
    1016
    -  ftinspectWidget->setLayout(ftinspectLayout);
    
    1017
    -  setCentralWidget(ftinspectWidget);
    
    1041
    +  ftinspectWidget_ = new QWidget;
    
    1042
    +  ftinspectWidget_->setLayout(ftinspectLayout_);
    
    1043
    +  setCentralWidget(ftinspectWidget_);
    
    1018 1044
       setWindowTitle("ftinspect");
    
    1019 1045
     }
    
    1020 1046
     
    
    ... ... @@ -1022,127 +1048,122 @@ MainGUI::createLayout()
    1022 1048
     void
    
    1023 1049
     MainGUI::createConnections()
    
    1024 1050
     {
    
    1025
    -  connect(hintingCheckBox, SIGNAL(clicked()),
    
    1051
    +  connect(hintingCheckBox_, SIGNAL(clicked()),
    
    1026 1052
               SLOT(checkHinting()));
    
    1027 1053
     
    
    1028
    -  connect(hintingModeComboBoxx, SIGNAL(currentIndexChanged(int)),
    
    1054
    +  connect(hintingModeComboBoxx_, SIGNAL(currentIndexChanged(int)),
    
    1029 1055
               SLOT(checkHintingMode()));
    
    1030
    -  connect(antiAliasingComboBoxx, SIGNAL(currentIndexChanged(int)),
    
    1056
    +  connect(antiAliasingComboBoxx_, SIGNAL(currentIndexChanged(int)),
    
    1031 1057
               SLOT(checkAntiAliasing()));
    
    1032
    -  connect(lcdFilterComboBox, SIGNAL(currentIndexChanged(int)),
    
    1058
    +  connect(lcdFilterComboBox_, SIGNAL(currentIndexChanged(int)),
    
    1033 1059
               SLOT(checkLcdFilter()));
    
    1034 1060
     
    
    1035
    -  connect(autoHintingCheckBox, SIGNAL(clicked()),
    
    1061
    +  connect(autoHintingCheckBox_, SIGNAL(clicked()),
    
    1036 1062
               SLOT(checkAutoHinting()));
    
    1037
    -  connect(showBitmapCheckBox, SIGNAL(clicked()),
    
    1063
    +  connect(showBitmapCheckBox_, SIGNAL(clicked()),
    
    1038 1064
               SLOT(drawGlyph()));
    
    1039
    -  connect(showPointsCheckBox, SIGNAL(clicked()),
    
    1065
    +  connect(showPointsCheckBox_, SIGNAL(clicked()),
    
    1040 1066
               SLOT(checkShowPoints()));
    
    1041
    -  connect(showPointNumbersCheckBox, SIGNAL(clicked()),
    
    1067
    +  connect(showPointNumbersCheckBox_, SIGNAL(clicked()),
    
    1042 1068
               SLOT(drawGlyph()));
    
    1043
    -  connect(showOutlinesCheckBox, SIGNAL(clicked()),
    
    1069
    +  connect(showOutlinesCheckBox_, SIGNAL(clicked()),
    
    1044 1070
               SLOT(drawGlyph()));
    
    1045 1071
     
    
    1046
    -  connect(sizeDoubleSpinBox, SIGNAL(valueChanged(double)),
    
    1072
    +  connect(sizeDoubleSpinBox_, SIGNAL(valueChanged(double)),
    
    1047 1073
               SLOT(drawGlyph()));
    
    1048
    -  connect(unitsComboBox, SIGNAL(currentIndexChanged(int)),
    
    1074
    +  connect(unitsComboBox_, SIGNAL(currentIndexChanged(int)),
    
    1049 1075
               SLOT(checkUnits()));
    
    1050
    -  connect(dpiSpinBox, SIGNAL(valueChanged(int)),
    
    1076
    +  connect(dpiSpinBox_, SIGNAL(valueChanged(int)),
    
    1051 1077
               SLOT(drawGlyph()));
    
    1052 1078
     
    
    1053
    -  connect(zoomSpinBox, SIGNAL(valueChanged(int)),
    
    1079
    +  connect(zoomSpinBox_, SIGNAL(valueChanged(int)),
    
    1054 1080
               SLOT(zoom()));
    
    1055 1081
     
    
    1056
    -  connect(previousFontButton, SIGNAL(clicked()),
    
    1082
    +  connect(previousFontButton_, SIGNAL(clicked()),
    
    1057 1083
               SLOT(previousFont()));
    
    1058
    -  connect(nextFontButton, SIGNAL(clicked()),
    
    1084
    +  connect(nextFontButton_, SIGNAL(clicked()),
    
    1059 1085
               SLOT(nextFont()));
    
    1060
    -  connect(previousFaceButton, SIGNAL(clicked()),
    
    1086
    +  connect(previousFaceButton_, SIGNAL(clicked()),
    
    1061 1087
               SLOT(previousFace()));
    
    1062
    -  connect(nextFaceButton, SIGNAL(clicked()),
    
    1088
    +  connect(nextFaceButton_, SIGNAL(clicked()),
    
    1063 1089
               SLOT(nextFace()));
    
    1064
    -  connect(previousNamedInstanceButton, SIGNAL(clicked()),
    
    1090
    +  connect(previousNamedInstanceButton_, SIGNAL(clicked()),
    
    1065 1091
               SLOT(previousNamedInstance()));
    
    1066
    -  connect(nextNamedInstanceButton, SIGNAL(clicked()),
    
    1092
    +  connect(nextNamedInstanceButton_, SIGNAL(clicked()),
    
    1067 1093
               SLOT(nextNamedInstance()));
    
    1068 1094
     
    
    1069
    -  glyphNavigationMapper = new QSignalMapper;
    
    1070
    -  connect(glyphNavigationMapper, SIGNAL(mapped(int)),
    
    1095
    +  glyphNavigationMapper_ = new QSignalMapper;
    
    1096
    +  connect(glyphNavigationMapper_, SIGNAL(mapped(int)),
    
    1071 1097
               SLOT(adjustGlyphIndex(int)));
    
    1072 1098
     
    
    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()));
    
    1099
    +  connect(toStartButtonx_, SIGNAL(clicked()),
    
    1100
    +          glyphNavigationMapper_, SLOT(map()));
    
    1101
    +  connect(toM1000Buttonx_, SIGNAL(clicked()),
    
    1102
    +          glyphNavigationMapper_, SLOT(map()));
    
    1103
    +  connect(toM100Buttonx_, SIGNAL(clicked()),
    
    1104
    +          glyphNavigationMapper_, SLOT(map()));
    
    1105
    +  connect(toM10Buttonx_, SIGNAL(clicked()),
    
    1106
    +          glyphNavigationMapper_, SLOT(map()));
    
    1107
    +  connect(toM1Buttonx_, SIGNAL(clicked()),
    
    1108
    +          glyphNavigationMapper_, SLOT(map()));
    
    1109
    +  connect(toP1Buttonx_, SIGNAL(clicked()),
    
    1110
    +          glyphNavigationMapper_, SLOT(map()));
    
    1111
    +  connect(toP10Buttonx_, SIGNAL(clicked()),
    
    1112
    +          glyphNavigationMapper_, SLOT(map()));
    
    1113
    +  connect(toP100Buttonx_, SIGNAL(clicked()),
    
    1114
    +          glyphNavigationMapper_, SLOT(map()));
    
    1115
    +  connect(toP1000Buttonx_, SIGNAL(clicked()),
    
    1116
    +          glyphNavigationMapper_, SLOT(map()));
    
    1117
    +  connect(toEndButtonx_, SIGNAL(clicked()),
    
    1118
    +          glyphNavigationMapper_, SLOT(map()));
    
    1119
    +
    
    1120
    +  glyphNavigationMapper_->setMapping(toStartButtonx_, -0x10000);
    
    1121
    +  glyphNavigationMapper_->setMapping(toM1000Buttonx_, -1000);
    
    1122
    +  glyphNavigationMapper_->setMapping(toM100Buttonx_, -100);
    
    1123
    +  glyphNavigationMapper_->setMapping(toM10Buttonx_, -10);
    
    1124
    +  glyphNavigationMapper_->setMapping(toM1Buttonx_, -1);
    
    1125
    +  glyphNavigationMapper_->setMapping(toP1Buttonx_, 1);
    
    1126
    +  glyphNavigationMapper_->setMapping(toP10Buttonx_, 10);
    
    1127
    +  glyphNavigationMapper_->setMapping(toP100Buttonx_, 100);
    
    1128
    +  glyphNavigationMapper_->setMapping(toP1000Buttonx_, 1000);
    
    1129
    +  glyphNavigationMapper_->setMapping(toEndButtonx_, 0x10000);
    
    1109 1130
     }
    
    1110 1131
     
    
    1111 1132
     
    
    1112 1133
     void
    
    1113 1134
     MainGUI::createActions()
    
    1114 1135
     {
    
    1115
    -  loadFontsAct = new QAction(tr("&Load Fonts"), this);
    
    1116
    -  loadFontsAct->setShortcuts(QKeySequence::Open);
    
    1117
    -  connect(loadFontsAct, SIGNAL(triggered()), SLOT(loadFonts()));
    
    1136
    +  loadFontsAct_ = new QAction(tr("&Load Fonts"), this);
    
    1137
    +  loadFontsAct_->setShortcuts(QKeySequence::Open);
    
    1138
    +  connect(loadFontsAct_, SIGNAL(triggered()), SLOT(loadFonts()));
    
    1118 1139
     
    
    1119
    -  closeFontAct = new QAction(tr("&Close Font"), this);
    
    1120
    -  closeFontAct->setShortcuts(QKeySequence::Close);
    
    1121
    -  connect(closeFontAct, SIGNAL(triggered()), SLOT(closeFont()));
    
    1140
    +  closeFontAct_ = new QAction(tr("&Close Font"), this);
    
    1141
    +  closeFontAct_->setShortcuts(QKeySequence::Close);
    
    1142
    +  connect(closeFontAct_, SIGNAL(triggered()), SLOT(closeFont()));
    
    1122 1143
     
    
    1123
    -  exitAct = new QAction(tr("E&xit"), this);
    
    1124
    -  exitAct->setShortcuts(QKeySequence::Quit);
    
    1125
    -  connect(exitAct, SIGNAL(triggered()), SLOT(close()));
    
    1144
    +  exitAct_ = new QAction(tr("E&xit"), this);
    
    1145
    +  exitAct_->setShortcuts(QKeySequence::Quit);
    
    1146
    +  connect(exitAct_, SIGNAL(triggered()), SLOT(close()));
    
    1126 1147
     
    
    1127
    -  aboutAct = new QAction(tr("&About"), this);
    
    1128
    -  connect(aboutAct, SIGNAL(triggered()), SLOT(about()));
    
    1148
    +  aboutAct_ = new QAction(tr("&About"), this);
    
    1149
    +  connect(aboutAct_, SIGNAL(triggered()), SLOT(about()));
    
    1129 1150
     
    
    1130
    -  aboutQtAct = new QAction(tr("About &Qt"), this);
    
    1131
    -  connect(aboutQtAct, SIGNAL(triggered()), SLOT(aboutQt()));
    
    1151
    +  aboutQtAct_ = new QAction(tr("About &Qt"), this);
    
    1152
    +  connect(aboutQtAct_, SIGNAL(triggered()), SLOT(aboutQt()));
    
    1132 1153
     }
    
    1133 1154
     
    
    1134 1155
     
    
    1135 1156
     void
    
    1136 1157
     MainGUI::createMenus()
    
    1137 1158
     {
    
    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);
    
    1159
    +  menuFile_ = menuBar()->addMenu(tr("&File"));
    
    1160
    +  menuFile_->addAction(loadFontsAct_);
    
    1161
    +  menuFile_->addAction(closeFontAct_);
    
    1162
    +  menuFile_->addAction(exitAct_);
    
    1163
    +
    
    1164
    +  menuHelp_ = menuBar()->addMenu(tr("&Help"));
    
    1165
    +  menuHelp_->addAction(aboutAct_);
    
    1166
    +  menuHelp_->addAction(aboutQtAct_);
    
    1146 1167
     }
    
    1147 1168
     
    
    1148 1169
     
    
    ... ... @@ -1153,80 +1174,74 @@ MainGUI::createStatusBar()
    1153 1174
     }
    
    1154 1175
     
    
    1155 1176
     
    
    1156
    -void
    
    1157
    -MainGUI::clearStatusBar()
    
    1158
    -{
    
    1159
    -  statusBar()->clearMessage();
    
    1160
    -  statusBar()->setStyleSheet("");
    
    1161
    -}
    
    1162
    -
    
    1163
    -
    
    1164 1177
     void
    
    1165 1178
     MainGUI::setDefaults()
    
    1166 1179
     {
    
    1167 1180
       // 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;
    
    1181
    +  hintingModesTrueTypeHash_[TT_INTERPRETER_VERSION_35] = HintingMode_TrueType_v35;
    
    1182
    +  hintingModesTrueTypeHash_[TT_INTERPRETER_VERSION_38] = HintingMode_TrueType_v38;
    
    1183
    +  hintingModesTrueTypeHash_[TT_INTERPRETER_VERSION_40] = HintingMode_TrueType_v40;
    
    1184
    +
    
    1185
    +  hintingModesCFFHash_[FT_HINTING_FREETYPE] = HintingMode_CFF_FreeType;
    
    1186
    +  hintingModesCFFHash_[FT_HINTING_ADOBE] = HintingMode_CFF_Adobe;
    
    1171 1187
     
    
    1172
    -  hintingModesCFFHash[FT_HINTING_FREETYPE] = HintingMode_CFF_FreeType;
    
    1173
    -  hintingModesCFFHash[FT_HINTING_ADOBE] = HintingMode_CFF_Adobe;
    
    1188
    +  lcdFilterHash_[FT_LCD_FILTER_DEFAULT] = LCDFilter_Default;
    
    1189
    +  lcdFilterHash_[FT_LCD_FILTER_LIGHT] = LCDFilter_Light;
    
    1190
    +  lcdFilterHash_[FT_LCD_FILTER_NONE] = LCDFilter_None;
    
    1191
    +  lcdFilterHash_[FT_LCD_FILTER_LEGACY] = LCDFilter_Legacy;
    
    1174 1192
     
    
    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;
    
    1193
    +  Engine::EngineDefaultValues& defaults = engine_->engineDefaults();
    
    1179 1194
     
    
    1180 1195
       // 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);
    
    1196
    +  QHash<int, int> hmTTHash = hintingModesTrueTypeHash_;
    
    1197
    +  if (hmTTHash.contains(defaults.ttInterpreterVersionDefault))
    
    1198
    +    hmTTHash.remove(defaults.ttInterpreterVersionDefault);
    
    1199
    +  if (hmTTHash.contains(defaults.ttInterpreterVersionOther))
    
    1200
    +    hmTTHash.remove(defaults.ttInterpreterVersionOther);
    
    1201
    +  if (hmTTHash.contains(defaults.ttInterpreterVersionOther1))
    
    1202
    +    hmTTHash.remove(defaults.ttInterpreterVersionOther1);
    
    1203
    +
    
    1204
    +  QHash<int, int> hmCFFHash = hintingModesCFFHash_;
    
    1205
    +  if (hmCFFHash.contains(defaults.cffHintingEngineDefault))
    
    1206
    +    hmCFFHash.remove(defaults.cffHintingEngineDefault);
    
    1207
    +  if (hmCFFHash.contains(defaults.cffHintingEngineOther))
    
    1208
    +    hmCFFHash.remove(defaults.cffHintingEngineOther);
    
    1194 1209
     
    
    1195 1210
       // ... to construct a list of always disabled hinting mode combo box items
    
    1196
    -  hintingModesAlwaysDisabled = hmTTHash.values();
    
    1197
    -  hintingModesAlwaysDisabled += hmCFFHash.values();
    
    1211
    +  hintingModesAlwaysDisabled_ = hmTTHash.values();
    
    1212
    +  hintingModesAlwaysDisabled_ += hmCFFHash.values();
    
    1198 1213
     
    
    1199
    -  for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++)
    
    1200
    -    hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i],
    
    1214
    +  for (int i = 0; i < hintingModesAlwaysDisabled_.size(); i++)
    
    1215
    +    hintingModeComboBoxx_->setItemEnabled(hintingModesAlwaysDisabled_[i],
    
    1201 1216
                                              false);
    
    1202 1217
     
    
    1203 1218
       // the next four values always non-negative
    
    1204
    -  currentFontIndex = 0;
    
    1205
    -  currentFaceIndex = 0;
    
    1206
    -  currentNamedInstanceIndex = 0;
    
    1207
    -  currentGlyphIndex = 0;
    
    1219
    +  currentFontIndex_ = 0;
    
    1220
    +  currentFaceIndex_ = 0;
    
    1221
    +  currentNamedInstanceIndex_ = 0;
    
    1222
    +  currentGlyphIndex_ = 0;
    
    1208 1223
     
    
    1209
    -  currentCFFHintingMode
    
    1210
    -    = hintingModesCFFHash[engine->cffHintingEngineDefault];
    
    1211
    -  currentTTInterpreterVersion
    
    1212
    -    = hintingModesTrueTypeHash[engine->ttInterpreterVersionDefault];
    
    1224
    +  currentCFFHintingMode_
    
    1225
    +    = hintingModesCFFHash_[defaults.cffHintingEngineDefault];
    
    1226
    +  currentTTInterpreterVersion_
    
    1227
    +    = hintingModesTrueTypeHash_[defaults.ttInterpreterVersionDefault];
    
    1213 1228
     
    
    1214
    -  hintingCheckBox->setChecked(true);
    
    1229
    +  hintingCheckBox_->setChecked(true);
    
    1215 1230
     
    
    1216
    -  antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal);
    
    1217
    -  lcdFilterComboBox->setCurrentIndex(LCDFilter_Light);
    
    1231
    +  antiAliasingComboBoxx_->setCurrentIndex(Engine::AntiAliasing_Normal);
    
    1232
    +  lcdFilterComboBox_->setCurrentIndex(LCDFilter_Light);
    
    1218 1233
     
    
    1219
    -  horizontalHintingCheckBox->setChecked(true);
    
    1220
    -  verticalHintingCheckBox->setChecked(true);
    
    1221
    -  blueZoneHintingCheckBox->setChecked(true);
    
    1234
    +  horizontalHintingCheckBox_->setChecked(true);
    
    1235
    +  verticalHintingCheckBox_->setChecked(true);
    
    1236
    +  blueZoneHintingCheckBox_->setChecked(true);
    
    1222 1237
     
    
    1223
    -  showBitmapCheckBox->setChecked(true);
    
    1224
    -  showOutlinesCheckBox->setChecked(true);
    
    1238
    +  showBitmapCheckBox_->setChecked(true);
    
    1239
    +  showOutlinesCheckBox_->setChecked(true);
    
    1225 1240
     
    
    1226
    -  gammaSlider->setValue(18); // 1.8
    
    1227
    -  sizeDoubleSpinBox->setValue(20);
    
    1228
    -  dpiSpinBox->setValue(96);
    
    1229
    -  zoomSpinBox->setValue(20);
    
    1241
    +  gammaSlider_->setValue(18); // 1.8
    
    1242
    +  sizeDoubleSpinBox_->setValue(20);
    
    1243
    +  dpiSpinBox_->setValue(96);
    
    1244
    +  zoomSpinBox_->setValue(20);
    
    1230 1245
     
    
    1231 1246
       checkHinting();
    
    1232 1247
       checkHintingMode();
    

  • src/ftinspect/maingui.hpp
    ... ... @@ -94,158 +94,143 @@ private slots:
    94 94
       void zoom();
    
    95 95
     
    
    96 96
     private:
    
    97
    -  Engine* engine;
    
    97
    +  Engine* engine_;
    
    98
    +  
    
    99
    +  int currentFontIndex_;
    
    98 100
     
    
    99
    -  QStringList fontList;
    
    100
    -  int currentFontIndex;
    
    101
    +  long currentNumberOfFaces_;
    
    102
    +  long currentFaceIndex_;
    
    101 103
     
    
    102
    -  long currentNumberOfFaces;
    
    103
    -  long currentFaceIndex;
    
    104
    +  int currentNumberOfNamedInstances_;
    
    105
    +  int currentNamedInstanceIndex_;
    
    104 106
     
    
    105
    -  int currentNumberOfNamedInstances;
    
    106
    -  int currentNamedInstanceIndex;
    
    107
    +  int currentNumberOfGlyphs_;
    
    108
    +  int currentGlyphIndex_;
    
    107 109
     
    
    108
    -  int currentNumberOfGlyphs;
    
    109
    -  int currentGlyphIndex;
    
    110
    -
    
    111
    -  int currentCFFHintingMode;
    
    112
    -  int currentTTInterpreterVersion;
    
    110
    +  int currentCFFHintingMode_;
    
    111
    +  int currentTTInterpreterVersion_;
    
    113 112
     
    
    114 113
       // 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;
    
    114
    +  GlyphOutline *currentGlyphOutlineItem_;
    
    115
    +  GlyphPoints *currentGlyphPointsItem_;
    
    116
    +  GlyphPointNumbers *currentGlyphPointNumbersItem_;
    
    117
    +  GlyphBitmap *currentGlyphBitmapItem_;
    
    118
    +
    
    119
    +  QAction *aboutAct_;
    
    120
    +  QAction *aboutQtAct_;
    
    121
    +  QAction *closeFontAct_;
    
    122
    +  QAction *exitAct_;
    
    123
    +  QAction *loadFontsAct_;
    
    124
    +
    
    125
    +  QCheckBox *autoHintingCheckBox_;
    
    126
    +  QCheckBox *blueZoneHintingCheckBox_;
    
    127
    +  QCheckBox *hintingCheckBox_;
    
    128
    +  QCheckBox *horizontalHintingCheckBox_;
    
    129
    +  QCheckBox *segmentDrawingCheckBox_;
    
    130
    +  QCheckBox *showBitmapCheckBox_;
    
    131
    +  QCheckBox *showOutlinesCheckBox_;
    
    132
    +  QCheckBox *showPointNumbersCheckBox_;
    
    133
    +  QCheckBox *showPointsCheckBox_;
    
    134
    +  QCheckBox *verticalHintingCheckBox_;
    
    135
    +
    
    136
    +  QComboBoxx *antiAliasingComboBoxx_;
    
    137
    +  QComboBoxx *hintingModeComboBoxx_;
    
    138
    +  QComboBox *lcdFilterComboBox_;
    
    139
    +  QComboBox *unitsComboBox_;
    
    140
    +
    
    141
    +  QDoubleSpinBox *sizeDoubleSpinBox_;
    
    142
    +
    
    143
    +  QGraphicsScene *glyphScene_;
    
    144
    +  QGraphicsViewx *glyphView_;
    
    148 145
     
    
    149 146
       QGridLayout *fontLayout;
    
    150 147
       QGridLayout *infoRightLayout;
    
    151 148
     
    
    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
    -  };
    
    149
    +  QHash<int, int> hintingModesTrueTypeHash_;
    
    150
    +  QHash<int, int> hintingModesCFFHash_;
    
    151
    +  QHash<FT_LcdFilter, int> lcdFilterHash_;
    
    152
    +
    
    153
    +  QHBoxLayout *antiAliasingLayout_;
    
    154
    +  QHBoxLayout *blueZoneHintingLayout_;
    
    155
    +  QHBoxLayout *ftinspectLayout_;
    
    156
    +  QHBoxLayout *gammaLayout_;
    
    157
    +  QHBoxLayout *hintingModeLayout_;
    
    158
    +  QHBoxLayout *horizontalHintingLayout_;
    
    159
    +  QHBoxLayout *infoLeftLayout_;
    
    160
    +  QHBoxLayout *lcdFilterLayout_;
    
    161
    +  QHBoxLayout *navigationLayout_;
    
    162
    +  QHBoxLayout *pointNumbersLayout_;
    
    163
    +  QHBoxLayout *segmentDrawingLayout_;
    
    164
    +  QHBoxLayout *sizeLayout_;
    
    165
    +  QHBoxLayout *verticalHintingLayout_;
    
    166
    +
    
    167
    +  QLabel *antiAliasingLabel_;
    
    168
    +  QLabel *dpiLabel_;
    
    169
    +  QLabel *fontFilenameLabel_;
    
    170
    +  QLabel *fontNameLabel_;
    
    171
    +  QLabel *gammaLabel_;
    
    172
    +  QLabel *glyphIndexLabel_;
    
    173
    +  QLabel *glyphNameLabel_;
    
    174
    +  QLabel *hintingModeLabel_;
    
    175
    +  QLabel *lcdFilterLabel_;
    
    176
    +  QLabel *sizeLabel_;
    
    177
    +  QLabel *zoomLabel_;
    
    178
    +
    
    179
    +  QList<int> hintingModesAlwaysDisabled_;
    
    180
    +
    
    181
    +  QLocale *locale_;
    
    182
    +
    
    183
    +  QMenu *menuFile_;
    
    184
    +  QMenu *menuHelp_;
    
    185
    +
    
    186
    +  QPen axisPen_;
    
    187
    +  QPen blueZonePen_;
    
    188
    +  QPen gridPen_;
    
    189
    +  QPen offPen_;
    
    190
    +  QPen onPen_;
    
    191
    +  QPen outlinePen_;
    
    192
    +  QPen segmentPen_;
    
    193
    +
    
    194
    +  QPushButton *nextFaceButton_;
    
    195
    +  QPushButton *nextFontButton_;
    
    196
    +  QPushButton *nextNamedInstanceButton_;
    
    197
    +  QPushButton *previousFaceButton_;
    
    198
    +  QPushButton *previousFontButton_;
    
    199
    +  QPushButton *previousNamedInstanceButton_;
    
    200
    +
    
    201
    +  QPushButtonx *toEndButtonx_;
    
    202
    +  QPushButtonx *toM1000Buttonx_;
    
    203
    +  QPushButtonx *toM100Buttonx_;
    
    204
    +  QPushButtonx *toM10Buttonx_;
    
    205
    +  QPushButtonx *toM1Buttonx_;
    
    206
    +  QPushButtonx *toP1000Buttonx_;
    
    207
    +  QPushButtonx *toP100Buttonx_;
    
    208
    +  QPushButtonx *toP10Buttonx_;
    
    209
    +  QPushButtonx *toP1Buttonx_;
    
    210
    +  QPushButtonx *toStartButtonx_;
    
    211
    +
    
    212
    +  QSignalMapper *glyphNavigationMapper_;
    
    213
    +
    
    214
    +  QSlider *gammaSlider_;
    
    215
    +
    
    216
    +  QSpinBox *dpiSpinBox_;
    
    217
    +  QSpinBoxx *zoomSpinBox_;
    
    218
    +
    
    219
    +  QTabWidget *tabWidget_;
    
    220
    +
    
    221
    +  QVBoxLayout *generalTabLayout_;
    
    222
    +  QVBoxLayout *leftLayout_;
    
    223
    +  QVBoxLayout *rightLayout_;
    
    224
    +
    
    225
    +  QVector<QRgb> grayColorTable_;
    
    226
    +  QVector<QRgb> monoColorTable_;
    
    227
    +
    
    228
    +  QWidget *ftinspectWidget_;
    
    229
    +  QWidget *generalTabWidget_;
    
    230
    +  QWidget *leftWidget_;
    
    231
    +  QWidget *rightWidget_;
    
    232
    +  QWidget *mmgxTabWidget_;
    
    233
    +  
    
    249 234
       enum HintingMode
    
    250 235
       {
    
    251 236
         HintingMode_TrueType_v35,
    
    ... ... @@ -267,15 +252,18 @@ private:
    267 252
         Units_pt
    
    268 253
       };
    
    269 254
     
    
    255
    +  void showFont();
    
    256
    +  void syncSettings();
    
    257
    +  void clearStatusBar();
    
    258
    +
    
    270 259
       void createActions();
    
    271 260
       void createConnections();
    
    272 261
       void createLayout();
    
    273 262
       void createMenus();
    
    274
    -  void clearStatusBar();
    
    275 263
       void createStatusBar();
    
    276
    -  void readSettings();
    
    277 264
       void setGraphicsDefaults();
    
    278
    -  void showFont();
    
    265
    +
    
    266
    +  void readSettings();
    
    279 267
       void writeSettings();
    
    280 268
     };
    
    281 269
     
    

  • src/ftinspect/meson.build
    ... ... @@ -21,15 +21,19 @@ 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
    +
    
    33 37
         'ftinspect.cpp',
    
    34 38
         'maingui.cpp',
    
    35 39
       ])
    

  • src/ftinspect/rendering/glyphbitmap.cpp
    ... ... @@ -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),
    

  • src/ftinspect/rendering/glyphbitmap.hpp
    ... ... @@ -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
     
    

  • src/ftinspect/rendering/glyphoutline.cpp
    ... ... @@ -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
     }
    

  • src/ftinspect/rendering/glyphoutline.hpp
    ... ... @@ -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
     
    

  • src/ftinspect/rendering/glyphpointnumbers.cpp
    ... ... @@ -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
           {
    

  • src/ftinspect/rendering/glyphpointnumbers.hpp
    ... ... @@ -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
     
    

  • src/ftinspect/rendering/glyphpoints.cpp
    ... ... @@ -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
           }
    

  • src/ftinspect/rendering/glyphpoints.hpp
    ... ... @@ -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
     
    

  • src/ftinspect/rendering/grid.cpp
    ... ... @@ -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);
    

  • src/ftinspect/rendering/grid.hpp
    ... ... @@ -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
     
    

  • src/ftinspect/widgets/qgraphicsviewx.cpp
    ... ... @@ -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
     
    

  • src/ftinspect/widgets/qgraphicsviewx.hpp
    ... ... @@ -24,8 +24,8 @@ protected:
    24 24
                             int dy);
    
    25 25
     
    
    26 26
     private:
    
    27
    -  QPointF lastBottomLeftPoint;
    
    28
    -  bool lastBottomLeftPointInitialized;
    
    27
    +  QPointF lastBottomLeftPoint_;
    
    28
    +  bool lastBottomLeftPointInitialized_;
    
    29 29
     };
    
    30 30
     
    
    31 31
     
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]