freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][gsoc-2022-chariri-3] [ftinspect] Add MM/G


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][gsoc-2022-chariri-3] [ftinspect] Add MM/GX info for the Font Info tab.
Date: Thu, 18 Aug 2022 13:56:50 +0000

Charlie Jiang pushed to branch gsoc-2022-chariri-3 at FreeType / FreeType Demo Programs

Commits:

  • ec99ea20
    by Charlie Jiang at 2022-08-18T21:56:31+08:00
    [ftinspect] Add MM/GX info for the Font Info tab.
    
    The actual MM/GX is not implemented factually.
    
    Also done some minor tweaks to other tabs.
    
    * src/ftinspect/panels/info.cpp, src/ftinspect/panels/info.hpp:
      Implement `MMGXInfoTab`. Fix updating of the PostScript Tab.
    
    * src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
      Add `curMMGXState_` and `curMMGXAxes_`, retrieve them when loading font
      and add getters.
    
    * src/ftinspect/engine/mmgx.cpp, src/ftinspect/engine/mmgx.hpp:
      Add files to retrieve MM/GX information.
    
    * src/ftinspect/models/fontinfomodels.cpp,
      src/ftinspect/models/fontinfomodels.hpp:
      Add `MMGXAxisInfoModel` to display MM/GX axes. Removed the "Index" column
      but use the vertical header to display row index.
    
    * src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
    

10 changed files:

Changes:

  • src/ftinspect/CMakeLists.txt
    ... ... @@ -27,6 +27,7 @@ add_executable(ftinspect
    27 27
       "engine/stringrenderer.cpp"
    
    28 28
       "engine/fontinfo.cpp"
    
    29 29
       "engine/fontinfonamesmapping.cpp"
    
    30
    +  "engine/mmgx.cpp"
    
    30 31
     
    
    31 32
       "rendering/glyphbitmap.cpp"
    
    32 33
       "rendering/glyphoutline.cpp"
    

  • src/ftinspect/engine/engine.cpp
    ... ... @@ -345,8 +345,8 @@ Engine::loadFont(int fontIndex,
    345 345
           curCharMaps_.emplace_back(i, face->charmaps[i]);
    
    346 346
     
    
    347 347
         SFNTName::get(this, curSFNTNames_);
    
    348
    -
    
    349 348
         loadPaletteInfos();
    
    349
    +    curMMGXState_ = MMGXAxisInfo::get(this, curMMGXAxes_);
    
    350 350
       }
    
    351 351
     
    
    352 352
       curNumGlyphs_ = numGlyphs;
    

  • src/ftinspect/engine/engine.hpp
    ... ... @@ -9,6 +9,7 @@
    9 9
     #include "charmap.hpp"
    
    10 10
     #include "paletteinfo.hpp"
    
    11 11
     #include "fontinfo.hpp"
    
    12
    +#include "mmgx.hpp"
    
    12 13
     
    
    13 14
     #include <vector>
    
    14 15
     #include <utility>
    
    ... ... @@ -158,6 +159,8 @@ public:
    158 159
       std::vector<CharMapInfo>& currentFontCharMaps() { return curCharMaps_; }
    
    159 160
       std::vector<PaletteInfo>& currentFontPalettes() { return curPaletteInfos_; }
    
    160 161
       std::vector<SFNTName>& currentFontSFNTNames() { return curSFNTNames_; }
    
    162
    +  MMGXState currentFontMMGXState() { return curMMGXState_; }
    
    163
    +  std::vector<MMGXAxisInfo>& currentFontMMGXAxes() { return curMMGXAxes_; }
    
    161 164
       FontFileManager& fontFileManager() { return fontFileManager_; }
    
    162 165
       EngineDefaultValues& engineDefaults() { return engineDefaults_; }
    
    163 166
       bool antiAliasingEnabled() { return antiAliasingEnabled_; }
    
    ... ... @@ -229,6 +232,8 @@ private:
    229 232
       std::vector<SFNTName> curSFNTNames_;
    
    230 233
       std::vector<CharMapInfo> curCharMaps_;
    
    231 234
       std::vector<PaletteInfo> curPaletteInfos_;
    
    235
    +  std::vector<MMGXAxisInfo> curMMGXAxes_;
    
    236
    +  MMGXState curMMGXState_ = MMGXState::NoMMGX;
    
    232 237
     
    
    233 238
       FT_Library library_;
    
    234 239
       FTC_Manager cacheManager_;
    

  • src/ftinspect/engine/mmgx.cpp
    1
    +// mmgx.cpp
    
    2
    +
    
    3
    +// Copyright (C) 2022 by Charlie Jiang.
    
    4
    +
    
    5
    +#include "mmgx.hpp"
    
    6
    +
    
    7
    +#include "engine.hpp"
    
    8
    +
    
    9
    +#include <freetype/ftmm.h>
    
    10
    +
    
    11
    +
    
    12
    +MMGXState
    
    13
    +MMGXAxisInfo::get(Engine* engine,
    
    14
    +                  std::vector<MMGXAxisInfo>& infos)
    
    15
    +{
    
    16
    +  auto size = engine->currentFtSize();
    
    17
    +  if (!size)
    
    18
    +  {
    
    19
    +    infos.clear();
    
    20
    +    return MMGXState::NoMMGX;
    
    21
    +  }
    
    22
    +  auto face = size->face;
    
    23
    +
    
    24
    +  if (!FT_HAS_MULTIPLE_MASTERS(face))
    
    25
    +  {
    
    26
    +    infos.clear();
    
    27
    +    return MMGXState::NoMMGX;
    
    28
    +  }
    
    29
    +
    
    30
    +  FT_Multi_Master dummy;
    
    31
    +  auto error = FT_Get_Multi_Master(face, &dummy);
    
    32
    +  auto state = error ? MMGXState::GX_OVF : MMGXState::MM;
    
    33
    +  
    
    34
    +  FT_MM_Var* mm;
    
    35
    +  if (FT_Get_MM_Var(face, &mm))
    
    36
    +  {
    
    37
    +    infos.clear();
    
    38
    +    return state;
    
    39
    +  }
    
    40
    +
    
    41
    +  infos.resize(mm->num_axis);
    
    42
    +
    
    43
    +  auto& sfnt = engine->currentFontSFNTNames();
    
    44
    +  for (unsigned int i = 0; i < mm->num_axis; ++i)
    
    45
    +  {
    
    46
    +    auto& axis = mm->axis[i];
    
    47
    +    auto& info = infos[i];
    
    48
    +    info.maximum = axis.maximum / 65536.0;
    
    49
    +    info.minimum = axis.minimum / 65536.0;
    
    50
    +    info.def = axis.def / 65536.0;
    
    51
    +    info.tag = axis.tag;
    
    52
    +
    
    53
    +    unsigned int flags = 0;
    
    54
    +    FT_Get_Var_Axis_Flags(mm, i, &flags);
    
    55
    +    info.hidden = (flags & FT_VAR_AXIS_FLAG_HIDDEN) != 0;
    
    56
    +
    
    57
    +    auto nameSet = false;
    
    58
    +    if (state == MMGXState::GX_OVF)
    
    59
    +    {
    
    60
    +      auto strid = mm->axis[i].strid;
    
    61
    +      for (auto& obj : sfnt)
    
    62
    +      {
    
    63
    +        if (obj.nameID == strid && obj.strValid)
    
    64
    +        {
    
    65
    +          info.name = obj.str;
    
    66
    +          nameSet = true;
    
    67
    +          break;
    
    68
    +        }
    
    69
    +      }
    
    70
    +    }
    
    71
    +
    
    72
    +    // XXX security flaw
    
    73
    +    if (!nameSet)
    
    74
    +      info.name = QString(axis.name);
    
    75
    +  }
    
    76
    +
    
    77
    +  FT_Done_MM_Var(face->glyph->library, mm);
    
    78
    +
    
    79
    +  return state;
    
    80
    +}
    
    81
    +
    
    82
    +// end of mmgx.cpp
    
    83
    +

  • src/ftinspect/engine/mmgx.hpp
    1
    +// mmgx.hpp
    
    2
    +
    
    3
    +// Copyright (C) 2022 by Charlie Jiang.
    
    4
    +
    
    5
    +#pragma once
    
    6
    +
    
    7
    +#include <vector>
    
    8
    +#include <QString>
    
    9
    +
    
    10
    +class Engine;
    
    11
    +
    
    12
    +enum class MMGXState
    
    13
    +{
    
    14
    +  NoMMGX,
    
    15
    +  MM,     // Adobe MM
    
    16
    +  GX_OVF, // GX or OpenType variable fonts
    
    17
    +};
    
    18
    +
    
    19
    +struct MMGXAxisInfo
    
    20
    +{
    
    21
    +  QString name;
    
    22
    +  unsigned long tag;
    
    23
    +
    
    24
    +  double minimum;
    
    25
    +  double maximum;
    
    26
    +  double def;
    
    27
    +
    
    28
    +  bool hidden;
    
    29
    +
    
    30
    +  static MMGXState get(Engine* engine, std::vector<MMGXAxisInfo>& infos);
    
    31
    +
    
    32
    +
    
    33
    +  friend bool
    
    34
    +  operator==(const MMGXAxisInfo& lhs,
    
    35
    +             const MMGXAxisInfo& rhs)
    
    36
    +  {
    
    37
    +    return lhs.name == rhs.name
    
    38
    +      && lhs.tag == rhs.tag
    
    39
    +      && lhs.minimum == rhs.minimum
    
    40
    +      && lhs.maximum == rhs.maximum
    
    41
    +      && lhs.def == rhs.def
    
    42
    +      && lhs.hidden == rhs.hidden;
    
    43
    +  }
    
    44
    +
    
    45
    +
    
    46
    +  friend bool
    
    47
    +  operator!=(const MMGXAxisInfo& lhs,
    
    48
    +             const MMGXAxisInfo& rhs)
    
    49
    +  {
    
    50
    +    return !(lhs == rhs);
    
    51
    +  }
    
    52
    +};
    
    53
    +
    
    54
    +
    
    55
    +// end of mmgx.hpp

  • src/ftinspect/meson.build
    ... ... @@ -28,6 +28,7 @@ if qt5_dep.found()
    28 28
         'engine/stringrenderer.cpp',
    
    29 29
         'engine/fontinfo.cpp',
    
    30 30
         'engine/fontinfonamesmapping.cpp',
    
    31
    +    'engine/mmgx.cpp',
    
    31 32
     
    
    32 33
         'rendering/glyphbitmap.cpp',
    
    33 34
         'rendering/glyphoutline.cpp',
    

  • src/ftinspect/models/fontinfomodels.cpp
    ... ... @@ -35,8 +35,6 @@ FixedSizeInfoModel::data(const QModelIndex& index,
    35 35
       auto& obj = storage_[r];
    
    36 36
       switch (static_cast<Columns>(index.column()))
    
    37 37
       {
    
    38
    -  case FSIM_Index:
    
    39
    -    return index.row();
    
    40 38
       case FSIM_Height:
    
    41 39
         return obj.height;
    
    42 40
       case FSIM_Width:
    
    ... ... @@ -60,13 +58,15 @@ FixedSizeInfoModel::headerData(int section,
    60 58
                                     Qt::Orientation orientation,
    
    61 59
                                     int role) const
    
    62 60
     {
    
    63
    -  if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
    
    61
    +  if (role != Qt::DisplayRole)
    
    62
    +    return {};
    
    63
    +  if (orientation == Qt::Vertical)
    
    64
    +    return section;
    
    65
    +  if (orientation != Qt::Horizontal)
    
    64 66
         return {};
    
    65 67
     
    
    66 68
       switch (static_cast<Columns>(section))
    
    67 69
       {
    
    68
    -  case FSIM_Index:
    
    69
    -    return tr("#");
    
    70 70
       case FSIM_Height:
    
    71 71
         return tr("Height");
    
    72 72
       case FSIM_Width:
    
    ... ... @@ -117,8 +117,6 @@ CharMapInfoModel::data(const QModelIndex& index,
    117 117
       auto& obj = storage_[r];
    
    118 118
       switch (static_cast<Columns>(index.column()))
    
    119 119
       {
    
    120
    -  case CMIM_Index: 
    
    121
    -    return index.row();
    
    122 120
       case CMIM_Platform: 
    
    123 121
         return QString("%1 <%2>")
    
    124 122
                  .arg(obj.platformID)
    
    ... ... @@ -146,13 +144,15 @@ CharMapInfoModel::headerData(int section,
    146 144
                                  Qt::Orientation orientation,
    
    147 145
                                  int role) const
    
    148 146
     {
    
    149
    -  if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
    
    147
    +  if (role != Qt::DisplayRole)
    
    148
    +    return {};
    
    149
    +  if (orientation == Qt::Vertical)
    
    150
    +    return section;
    
    151
    +  if (orientation != Qt::Horizontal)
    
    150 152
         return {};
    
    151 153
     
    
    152 154
       switch (static_cast<Columns>(section))
    
    153 155
       {
    
    154
    -  case CMIM_Index:
    
    155
    -    return "#";
    
    156 156
       case CMIM_Platform:
    
    157 157
         return "Platform";
    
    158 158
       case CMIM_Encoding:
    
    ... ... @@ -206,8 +206,6 @@ SFNTNameModel::data(const QModelIndex& index,
    206 206
       auto& obj = storage_[r];
    
    207 207
       switch (static_cast<Columns>(index.column()))
    
    208 208
       {
    
    209
    -  case SNM_Index:
    
    210
    -    return index.row();
    
    211 209
       case SNM_Name:
    
    212 210
         return QString("%1 <%2>")
    
    213 211
                  .arg(obj.nameID)
    
    ... ... @@ -245,13 +243,15 @@ SFNTNameModel::headerData(int section,
    245 243
                               Qt::Orientation orientation,
    
    246 244
                               int role) const
    
    247 245
     {
    
    248
    -  if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
    
    246
    +  if (role != Qt::DisplayRole)
    
    247
    +    return {};
    
    248
    +  if (orientation == Qt::Vertical)
    
    249
    +    return section;
    
    250
    +  if (orientation != Qt::Horizontal)
    
    249 251
         return {};
    
    250 252
     
    
    251 253
       switch (static_cast<Columns>(section))
    
    252 254
       {
    
    253
    -  case SNM_Index:
    
    254
    -    return "#";
    
    255 255
       case SNM_Name:
    
    256 256
         return "Name";
    
    257 257
       case SNM_Platform:
    
    ... ... @@ -270,4 +270,92 @@ SFNTNameModel::headerData(int section,
    270 270
     }
    
    271 271
     
    
    272 272
     
    
    273
    +int
    
    274
    +MMGXAxisInfoModel::rowCount(const QModelIndex& parent) const
    
    275
    +{
    
    276
    +  if (parent.isValid())
    
    277
    +    return 0;
    
    278
    +  return static_cast<int>(storage_.size());
    
    279
    +}
    
    280
    +
    
    281
    +
    
    282
    +int
    
    283
    +MMGXAxisInfoModel::columnCount(const QModelIndex& parent) const
    
    284
    +{
    
    285
    +  if (parent.isValid())
    
    286
    +    return 0;
    
    287
    +  return MAIM_Max;
    
    288
    +}
    
    289
    +
    
    290
    +
    
    291
    +QVariant
    
    292
    +MMGXAxisInfoModel::data(const QModelIndex& index,
    
    293
    +                        int role) const
    
    294
    +{
    
    295
    +  if (index.row() < 0 || index.column() < 0)
    
    296
    +    return {};
    
    297
    +  auto r = static_cast<size_t>(index.row());
    
    298
    +  if (role != Qt::DisplayRole || r > storage_.size())
    
    299
    +    return {};
    
    300
    +
    
    301
    +  auto& obj = storage_[r];
    
    302
    +  switch (static_cast<Columns>(index.column()))
    
    303
    +  {
    
    304
    +  case MAIM_Tag:
    
    305
    +  {
    
    306
    +    auto str = QString::fromUtf8(reinterpret_cast<const char*>(&obj.tag), 4);
    
    307
    +    std::reverse(str.begin(), str.end());
    
    308
    +    return str;
    
    309
    +  }
    
    310
    +  case MAIM_Minimum:
    
    311
    +    return obj.minimum;
    
    312
    +  case MAIM_Default:
    
    313
    +    return obj.def;
    
    314
    +  case MAIM_Maximum:
    
    315
    +    return obj.maximum;
    
    316
    +  case MAIM_Hidden:
    
    317
    +    return obj.hidden;
    
    318
    +  case MAIM_Name:
    
    319
    +    return obj.name;
    
    320
    +  default:
    
    321
    +    break;
    
    322
    +  }
    
    323
    +
    
    324
    +  return {};
    
    325
    +}
    
    326
    +
    
    327
    +
    
    328
    +QVariant
    
    329
    +MMGXAxisInfoModel::headerData(int section,
    
    330
    +                              Qt::Orientation orientation,
    
    331
    +                              int role) const
    
    332
    +{
    
    333
    +  if (role != Qt::DisplayRole)
    
    334
    +    return {};
    
    335
    +  if (orientation == Qt::Vertical)
    
    336
    +    return section;
    
    337
    +  if (orientation != Qt::Horizontal)
    
    338
    +    return {};
    
    339
    +
    
    340
    +  switch (static_cast<Columns>(section))
    
    341
    +  {
    
    342
    +  case MAIM_Tag:
    
    343
    +    return "Tag";
    
    344
    +  case MAIM_Minimum:
    
    345
    +    return "Minimum";
    
    346
    +  case MAIM_Default:
    
    347
    +    return "Default";
    
    348
    +  case MAIM_Maximum:
    
    349
    +    return "Maximum";
    
    350
    +  case MAIM_Hidden:
    
    351
    +    return "Hidden";
    
    352
    +  case MAIM_Name:
    
    353
    +    return "Name";
    
    354
    +  default: ;
    
    355
    +  }
    
    356
    +
    
    357
    +  return {};
    
    358
    +}
    
    359
    +
    
    360
    +
    
    273 361
     // end of fontinfomodels.cpp

  • src/ftinspect/models/fontinfomodels.hpp
    ... ... @@ -6,6 +6,7 @@
    6 6
     
    
    7 7
     #include "../engine/fontinfo.hpp"
    
    8 8
     #include "../engine/charmap.hpp"
    
    9
    +#include "../engine/mmgx.hpp"
    
    9 10
     
    
    10 11
     #include <vector>
    
    11 12
     #include <QAbstractTableModel>
    
    ... ... @@ -39,12 +40,11 @@ public:
    39 40
     
    
    40 41
       enum Columns : int
    
    41 42
       {
    
    42
    -    FSIM_Index  = 0,
    
    43
    -    FSIM_Height = 1,
    
    44
    -    FSIM_Width  = 2,
    
    45
    -    FSIM_Size   = 3,
    
    46
    -    FSIM_XPpem  = 4,
    
    47
    -    FSIM_YPpem  = 5,
    
    43
    +    FSIM_Height = 0,
    
    44
    +    FSIM_Width,
    
    45
    +    FSIM_Size,
    
    46
    +    FSIM_XPpem,
    
    47
    +    FSIM_YPpem,
    
    48 48
         FSIM_Max
    
    49 49
       };
    
    50 50
     
    
    ... ... @@ -77,12 +77,11 @@ public:
    77 77
     
    
    78 78
       enum Columns : int
    
    79 79
       {
    
    80
    -    CMIM_Index      = 0,
    
    81
    -    CMIM_Platform   = 1,
    
    82
    -    CMIM_Encoding   = 2,
    
    83
    -    CMIM_FormatID   = 3,
    
    84
    -    CMIM_Language   = 4,
    
    85
    -    CMIM_MaxIndex   = 5,
    
    80
    +    CMIM_Platform   = 0,
    
    81
    +    CMIM_Encoding,
    
    82
    +    CMIM_FormatID,
    
    83
    +    CMIM_Language,
    
    84
    +    CMIM_MaxIndex,
    
    86 85
         CMIM_Max
    
    87 86
       };
    
    88 87
     
    
    ... ... @@ -115,12 +114,11 @@ public:
    115 114
     
    
    116 115
       enum Columns : int
    
    117 116
       {
    
    118
    -    SNM_Index      = 0,
    
    119
    -    SNM_Name       = 1,
    
    120
    -    SNM_Platform   = 2,
    
    121
    -    SNM_Encoding   = 3,
    
    122
    -    SNM_Language   = 4,
    
    123
    -    SNM_Content    = 5,
    
    117
    +    SNM_Name       = 0,
    
    118
    +    SNM_Platform,
    
    119
    +    SNM_Encoding,
    
    120
    +    SNM_Language,
    
    121
    +    SNM_Content,
    
    124 122
         SNM_Max
    
    125 123
       };
    
    126 124
     
    
    ... ... @@ -130,4 +128,42 @@ private:
    130 128
     };
    
    131 129
     
    
    132 130
     
    
    131
    +class MMGXAxisInfoModel
    
    132
    +: public QAbstractTableModel
    
    133
    +{
    
    134
    +  Q_OBJECT
    
    135
    +public:
    
    136
    +  explicit MMGXAxisInfoModel(QObject* parent) : QAbstractTableModel(parent) {}
    
    137
    +  ~MMGXAxisInfoModel() override = default;
    
    138
    +
    
    139
    +  int rowCount(const QModelIndex& parent) const override;
    
    140
    +  int columnCount(const QModelIndex& parent) const override;
    
    141
    +  QVariant data(const QModelIndex& index,
    
    142
    +                int role) const override;
    
    143
    +  QVariant headerData(int section,
    
    144
    +                      Qt::Orientation orientation,
    
    145
    +                      int role) const override;
    
    146
    +
    
    147
    +  // Same to `FixedSizeInfoModel`
    
    148
    +  void beginModelUpdate() { beginResetModel(); }
    
    149
    +  void endModelUpdate() { endResetModel(); }
    
    150
    +  std::vector<MMGXAxisInfo>& storage() { return storage_; }
    
    151
    +
    
    152
    +  enum Columns : int
    
    153
    +  {
    
    154
    +    MAIM_Tag = 0,
    
    155
    +    MAIM_Minimum,
    
    156
    +    MAIM_Default,
    
    157
    +    MAIM_Maximum,
    
    158
    +    MAIM_Hidden,
    
    159
    +    MAIM_Name,
    
    160
    +    MAIM_Max
    
    161
    +  };
    
    162
    +
    
    163
    +private:
    
    164
    +  // Don't let the item count exceed INT_MAX!
    
    165
    +  std::vector<MMGXAxisInfo> storage_;
    
    166
    +};
    
    167
    +
    
    168
    +
    
    133 169
     // end of fontinfomodels.hpp

  • src/ftinspect/panels/info.cpp
    ... ... @@ -598,6 +598,7 @@ PostScriptInfoTab::reloadFont()
    598 598
       }
    
    599 599
       else
    
    600 600
       {
    
    601
    +    std::memset(&oldFontPrivate_, 0, sizeof(PS_PrivateRec));
    
    601 602
                 uniqueIDLabel_->clear();
    
    602 603
               blueValuesLabel_->clear();
    
    603 604
               otherBluesLabel_->clear();
    
    ... ... @@ -792,12 +793,77 @@ MMGXInfoTab::MMGXInfoTab(QWidget* parent,
    792 793
                              Engine* engine)
    
    793 794
     : QWidget(parent), engine_(engine)
    
    794 795
     {
    
    796
    +  createLayout();
    
    795 797
     }
    
    796 798
     
    
    797 799
     
    
    798 800
     void
    
    799 801
     MMGXInfoTab::reloadFont()
    
    800 802
     {
    
    803
    +  auto state = engine_->currentFontMMGXState();
    
    804
    +  axesGroupBox_->setEnabled(state != MMGXState::NoMMGX);
    
    805
    +  switch (state)
    
    806
    +  {
    
    807
    +  case MMGXState::NoMMGX: 
    
    808
    +    mmgxTypeLabel_->setText("No MM/GX");
    
    809
    +    break;
    
    810
    +  case MMGXState::MM:
    
    811
    +    mmgxTypeLabel_->setText("Adobe Multiple Master");
    
    812
    +    break;
    
    813
    +  case MMGXState::GX_OVF:
    
    814
    +    mmgxTypeLabel_->setText("TrueType GX or OpenType Variable Font");
    
    815
    +    break;
    
    816
    +  default:
    
    817
    +    mmgxTypeLabel_->setText("Unknown");
    
    818
    +  }
    
    819
    +
    
    820
    +  if (engine_->currentFontMMGXAxes() != axesModel_->storage())
    
    821
    +  {
    
    822
    +    axesModel_->beginModelUpdate();
    
    823
    +    axesModel_->storage() = engine_->currentFontMMGXAxes();
    
    824
    +    axesModel_->endModelUpdate();
    
    825
    +  }
    
    826
    +}
    
    827
    +
    
    828
    +
    
    829
    +void
    
    830
    +MMGXInfoTab::createLayout()
    
    831
    +{
    
    832
    +  mmgxTypePromptLabel_ = new QLabel(tr("MM/GX Type:"));
    
    833
    +  mmgxTypeLabel_ = new QLabel(this);
    
    834
    +  setLabelSelectable(mmgxTypeLabel_);
    
    835
    +
    
    836
    +  axesTable_ = new QTableView(this);
    
    837
    +
    
    838
    +  axesModel_ = new MMGXAxisInfoModel(this);
    
    839
    +  axesTable_->setModel(axesModel_);
    
    840
    +  auto header = axesTable_->verticalHeader();
    
    841
    +  // This will force the minimal size to be used
    
    842
    +  header->setDefaultSectionSize(0);
    
    843
    +  header->setSectionResizeMode(QHeaderView::Fixed);
    
    844
    +  axesTable_->horizontalHeader()->setStretchLastSection(true);
    
    845
    +
    
    846
    +  axesGroupBox_ = new QGroupBox("MM/GX Axes");
    
    847
    +
    
    848
    +  axesLayout_ = new QHBoxLayout;
    
    849
    +  axesLayout_->addWidget(axesTable_);
    
    850
    +
    
    851
    +  axesGroupBox_->setLayout(axesLayout_);
    
    852
    +
    
    853
    +  infoLayout_ = new QGridLayout;
    
    854
    +#define MMGXI2Row(w) GL2CRow(infoLayout_, w)
    
    855
    +  auto r = MMGXI2Row(mmgxType);
    
    856
    +
    
    857
    +  infoLayout_->addItem(new QSpacerItem(0, 0, 
    
    858
    +                                       QSizePolicy::Expanding, 
    
    859
    +                                       QSizePolicy::Preferred),
    
    860
    +                       r, 2);
    
    861
    +
    
    862
    +  mainLayout_ = new QVBoxLayout;
    
    863
    +  mainLayout_->addLayout(infoLayout_);
    
    864
    +  mainLayout_->addWidget(axesGroupBox_, 1);
    
    865
    +
    
    866
    +  setLayout(mainLayout_);
    
    801 867
     }
    
    802 868
     
    
    803 869
     
    

  • src/ftinspect/panels/info.hpp
    ... ... @@ -256,6 +256,19 @@ public:
    256 256
     
    
    257 257
     private:
    
    258 258
       Engine* engine_;
    
    259
    +
    
    260
    +  LabelPair(mmgxType)
    
    261
    +
    
    262
    +  QGroupBox* axesGroupBox_;
    
    263
    +  QTableView* axesTable_;
    
    264
    +
    
    265
    +  QGridLayout* infoLayout_;
    
    266
    +  QHBoxLayout* axesLayout_;
    
    267
    +  QVBoxLayout* mainLayout_;
    
    268
    +
    
    269
    +  MMGXAxisInfoModel* axesModel_;
    
    270
    +
    
    271
    +  void createLayout();
    
    259 272
     };
    
    260 273
     
    
    261 274
     
    


  • reply via email to

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