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] 7 commits: [ftinspec


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][gsoc-2022-chariri-3] 7 commits: [ftinspect] Center on a better point when the program starts up.
Date: Fri, 26 Aug 2022 14:17:07 +0000

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

Commits:

  • 1baa5dc1
    by Charlie Jiang at 2022-08-26T20:58:51+08:00
    [ftinspect] Center on a better point when the program starts up.
    
    Now it will use the central point of the size box (by default (10, 10)) as
    the initial central point.
    
    * src/ftinspect/panels/singular.cpp, src/ftinspect/panels/singular.hpp:
      As described
    
  • 3e7bccd8
    by Charlie Jiang at 2022-08-26T21:00:20+08:00
    * src/ftinspect/glyphcomponents/glyphcontinuous.cpp: Fix C++14.
    
    No lambda capture initializer for C++11.
    
  • 1c566b06
    by Charlie Jiang at 2022-08-26T21:01:10+08:00
    * src/ftinspect/glyphcomponents/glyphcontinuous.cpp: Fix dragging on KDE.
    
    In KDE, if the mouse events are passed as-is to the parent handler, the
    whole window will be moved. By removing calling into base class methods,
    such behaviour is suppressed.
    
  • b45ee98d
    by Charlie Jiang at 2022-08-26T21:30:41+08:00
    [ftinspect] Make the bitmap in the glyph details pane clickable.
    
    * src/ftinspect/glyphcomponents/glyphbitmap.cpp,
      src/ftinspect/glyphcomponents/glyphbitmap.hpp:
      Add `clicked` event to `GlyphBitmapWidget`.
    
    * src/ftinspect/panels/glyphdetails.cpp,
      src/ftinspect/panels/glyphdetails.hpp:
      Keep track of current glyph index and pass it up when the bitmap is
      clicked.
    
    * src/ftinspect/panels/continuous.cpp, src/ftinspect/panels/continuous.hpp:
      Connect events.
    
    * src/ftinspect/panels/singular.cpp, src/ftinspect/panels/singular.hpp:
      Don't update the size when the size parameter is invalid.
    
  • 71d7689e
    by Charlie Jiang at 2022-08-26T22:06:35+08:00
    [ftinspect] Flash the glyph selected in the singular view when switching...
    
    from singular tab to continuous tab.
    
    * src/ftinspect/glyphcomponents/glyphcontinuous.cpp,
      src/ftinspect/glyphcomponents/glyphcontinuous.hpp:
      Add related field and handle the flashing in `paintCache` function.
      Add `flashOnGlyph` and `stopFlashing` funcs.
    
    * src/ftinspect/panels/continuous.cpp, src/ftinspect/panels/continuous.hpp:
      Add `highlightGlyph` which calls into `GlyphContinuous::flashGlyph`.
      Call `GlyphContinuous::stopFlashing` when doing a full repainting.
    
    * src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Add handling when
      switching tabs. Need to keep track of the last tab so we know if we are
      switching from the singular grid view.
    
    * src/ftinspect/panels/singular.cpp, src/ftinspect/panels/singular.hpp:
      Add `currentGlyph` getter.
    
  • 31e4b657
    by Charlie Jiang at 2022-08-26T22:12:02+08:00
    * src/ftinspect/engine/fontinfo.cpp: Fix typo.
    
  • 06972faf
    by Charlie Jiang at 2022-08-26T22:14:10+08:00
    [ftinspect] Simplify SFNT name cell for `name_id` greater than 256.
    
    Don't show " <Unknown>" when the id is greater than 256.
    
    * src/ftinspect/models/fontinfomodels.cpp: As described.
    

15 changed files:

Changes:

  • src/ftinspect/engine/fontinfo.cpp
    ... ... @@ -112,7 +112,7 @@ SFNTName::sfntNameToQString(unsigned short platformID,
    112 112
         // All UTF-16BE.
    
    113 113
         return utf16BEToQString(str, size);
    
    114 114
       case TT_PLATFORM_MACINTOSH:
    
    115
    -    if (platformID == TT_MAC_ID_ROMAN)
    
    115
    +    if (encodingID == TT_MAC_ID_ROMAN)
    
    116 116
           return QString::fromLatin1(str, static_cast<int>(size));
    
    117 117
     
    
    118 118
         if (outSuccess)
    

  • src/ftinspect/glyphcomponents/glyphbitmap.cpp
    ... ... @@ -96,7 +96,7 @@ GlyphBitmap::paint(QPainter* painter,
    96 96
     GlyphBitmapWidget::GlyphBitmapWidget(QWidget* parent)
    
    97 97
     : QWidget(parent)
    
    98 98
     {
    
    99
    -  
    
    99
    +  setToolTip(tr("Click to inspect in Singular Grid View."));
    
    100 100
     }
    
    101 101
     
    
    102 102
     
    
    ... ... @@ -165,4 +165,13 @@ GlyphBitmapWidget::sizeHint() const
    165 165
     }
    
    166 166
     
    
    167 167
     
    
    168
    +void
    
    169
    +GlyphBitmapWidget::mouseReleaseEvent(QMouseEvent* event)
    
    170
    +{
    
    171
    +  QWidget::mouseReleaseEvent(event);
    
    172
    +  if (event->button() == Qt::LeftButton)
    
    173
    +    emit clicked();
    
    174
    +}
    
    175
    +
    
    176
    +
    
    168 177
     // end of glyphbitmap.cpp

  • src/ftinspect/glyphcomponents/glyphbitmap.hpp
    ... ... @@ -38,6 +38,7 @@ private:
    38 38
       QRectF boundingRect_;
    
    39 39
     };
    
    40 40
     
    
    41
    +
    
    41 42
     // Sometimes we don't want a complicated QGraphicsView
    
    42 43
     // for this kind of work...
    
    43 44
     class GlyphBitmapWidget
    
    ... ... @@ -51,9 +52,13 @@ public:
    51 52
       void updateImage(QImage* image, QRect rect);
    
    52 53
       void releaseImage();
    
    53 54
     
    
    55
    +signals:
    
    56
    +  void clicked();
    
    57
    +
    
    54 58
     protected:
    
    55 59
       void paintEvent(QPaintEvent* event) override;
    
    56 60
       QSize sizeHint() const override;
    
    61
    +  void mouseReleaseEvent(QMouseEvent* event) override;
    
    57 62
     
    
    58 63
     private:
    
    59 64
       GlyphBitmap* bitmapItem_ = NULL;
    

  • src/ftinspect/glyphcomponents/glyphcontinuous.cpp
    ... ... @@ -50,6 +50,11 @@ GlyphContinuous::GlyphContinuous(QWidget* parent, Engine* engine)
    50 50
       setAcceptDrops(false);
    
    51 51
       setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    
    52 52
     
    
    53
    +  flashTimer_ = new QTimer(this);
    
    54
    +  flashTimer_->setInterval(FlashIntervalMs);
    
    55
    +  connect(flashTimer_, &QTimer::timeout,
    
    56
    +          this, &GlyphContinuous::flashTimerFired);
    
    57
    +
    
    53 58
       FT_Stroker_New(engine_->ftLibrary(), &stroker_);
    
    54 59
     }
    
    55 60
     
    
    ... ... @@ -89,6 +94,25 @@ GlyphContinuous::setSourceText(QString text)
    89 94
     }
    
    90 95
     
    
    91 96
     
    
    97
    +void
    
    98
    +GlyphContinuous::flashOnGlyph(int glyphIndex)
    
    99
    +{
    
    100
    +  flashTimer_->stop();
    
    101
    +
    
    102
    +  flashGlyphIndex_ = glyphIndex;
    
    103
    +  flashRemainingCount_ = FlashDurationMs / FlashIntervalMs;
    
    104
    +  flashTimer_->start();
    
    105
    +}
    
    106
    +
    
    107
    +
    
    108
    +void
    
    109
    +GlyphContinuous::stopFlashing()
    
    110
    +{
    
    111
    +  flashGlyphIndex_ = -1;
    
    112
    +  flashTimer_->stop();
    
    113
    +}
    
    114
    +
    
    115
    +
    
    92 116
     void
    
    93 117
     GlyphContinuous::purgeCache()
    
    94 118
     {
    
    ... ... @@ -139,7 +163,6 @@ GlyphContinuous::resizeEvent(QResizeEvent* event)
    139 163
     void
    
    140 164
     GlyphContinuous::mousePressEvent(QMouseEvent* event)
    
    141 165
     {
    
    142
    -  QWidget::mousePressEvent(event);
    
    143 166
       if (!mouseOperationEnabled_)
    
    144 167
         return;
    
    145 168
       if (event->button() == Qt::LeftButton)
    
    ... ... @@ -160,7 +183,6 @@ GlyphContinuous::mousePressEvent(QMouseEvent* event)
    160 183
     void
    
    161 184
     GlyphContinuous::mouseMoveEvent(QMouseEvent* event)
    
    162 185
     {
    
    163
    -  QWidget::mouseMoveEvent(event);
    
    164 186
       if (!mouseOperationEnabled_)
    
    165 187
         return;
    
    166 188
       if (event->buttons() != Qt::LeftButton)
    
    ... ... @@ -193,7 +215,6 @@ GlyphContinuous::mouseMoveEvent(QMouseEvent* event)
    193 215
     void
    
    194 216
     GlyphContinuous::mouseReleaseEvent(QMouseEvent* event)
    
    195 217
     {
    
    196
    -  QWidget::mouseReleaseEvent(event);
    
    197 218
       if (!mouseOperationEnabled_)
    
    198 219
         return;
    
    199 220
       if (event->button() == Qt::LeftButton)
    
    ... ... @@ -303,6 +324,24 @@ GlyphContinuous::transformGlyphStroked(FT_Glyph glyph)
    303 324
     void
    
    304 325
     GlyphContinuous::paintCache(QPainter* painter)
    
    305 326
     {
    
    327
    +  bool flashFlipFlop = false;
    
    328
    +  if (flashRemainingCount_ >= 0)
    
    329
    +  {
    
    330
    +    if (flashGlyphIndex_ >= 0) // only flash when the glyph index valid
    
    331
    +      flashFlipFlop = flashRemainingCount_ % 2 == 1;
    
    332
    +    else
    
    333
    +    {
    
    334
    +      flashTimer_->stop();
    
    335
    +      flashRemainingCount_ = 0;
    
    336
    +    }
    
    337
    +    flashRemainingCount_--;
    
    338
    +  }
    
    339
    +  else if (flashGlyphIndex_ >= 0)
    
    340
    +  {
    
    341
    +    flashGlyphIndex_ = -1;
    
    342
    +    flashTimer_->stop();
    
    343
    +  }
    
    344
    +
    
    306 345
       if (stringRenderer_.isWaterfall())
    
    307 346
         positionDelta_.setY(0);
    
    308 347
       for (auto& line : glyphCache_)
    
    ... ... @@ -310,6 +349,8 @@ GlyphContinuous::paintCache(QPainter* painter)
    310 349
         beginDrawCacheLine(painter, line);
    
    311 350
         for (auto& glyph : line.entries)
    
    312 351
         {
    
    352
    +      if (glyph.glyphIndex == flashGlyphIndex_ && flashFlipFlop)
    
    353
    +        continue; // flash
    
    313 354
           drawCacheGlyph(painter, glyph);
    
    314 355
         }
    
    315 356
       }
    
    ... ... @@ -547,4 +588,11 @@ GlyphContinuous::calculateAverageLineCount()
    547 588
     }
    
    548 589
     
    
    549 590
     
    
    591
    +void
    
    592
    +GlyphContinuous::flashTimerFired()
    
    593
    +{
    
    594
    +  repaint();
    
    595
    +}
    
    596
    +
    
    597
    +
    
    550 598
     // end of glyphcontinuous.cpp

  • src/ftinspect/glyphcomponents/glyphcontinuous.hpp
    ... ... @@ -12,6 +12,7 @@
    12 12
     
    
    13 13
     #include <QWidget>
    
    14 14
     #include <QImage>
    
    15
    +#include <QTimer>
    
    15 16
     
    
    16 17
     #include <freetype/freetype.h>
    
    17 18
     #include <freetype/ftglyph.h>
    
    ... ... @@ -90,7 +91,9 @@ public:
    90 91
       {
    
    91 92
         mouseOperationEnabled_ = enabled;
    
    92 93
       }
    
    93
    -
    
    94
    +  
    
    95
    +  void flashOnGlyph(int glyphIndex);
    
    96
    +  void stopFlashing();
    
    94 97
       void purgeCache();
    
    95 98
       void resetPositionDelta();
    
    96 99
     
    
    ... ... @@ -114,6 +117,10 @@ private:
    114 117
       Engine* engine_;
    
    115 118
       StringRenderer stringRenderer_;
    
    116 119
     
    
    120
    +  QTimer* flashTimer_;
    
    121
    +  int flashRemainingCount_ = 0;
    
    122
    +  int flashGlyphIndex_ = -1;
    
    123
    +
    
    117 124
       Source source_ = SRC_AllGlyphs;
    
    118 125
       Mode mode_ = M_Normal;
    
    119 126
       int beginIndex_;
    
    ... ... @@ -172,10 +179,16 @@ private:
    172 179
                                         double* outSizePoint);
    
    173 180
       int calculateAverageLineCount();
    
    174 181
     
    
    182
    +  void flashTimerFired();
    
    183
    +
    
    175 184
       // Mouse constants
    
    176 185
       constexpr static int ClickDragThreshold = 10;
    
    177 186
       constexpr static int HorizontalUnitLength = 100;
    
    178 187
       constexpr static int VerticalUnitLength = 150;
    
    188
    +
    
    189
    +  // Flash Timer constants
    
    190
    +  constexpr static int FlashIntervalMs = 250;
    
    191
    +  constexpr static int FlashDurationMs = 3000;
    
    179 192
     };
    
    180 193
     
    
    181 194
     
    

  • src/ftinspect/maingui.cpp
    ... ... @@ -164,7 +164,8 @@ MainGUI::onTripletChanged()
    164 164
     void
    
    165 165
     MainGUI::switchTab()
    
    166 166
     {
    
    167
    -  auto isComparator = tabWidget_->currentWidget() == comparatorTab_;
    
    167
    +  auto current = tabWidget_->currentWidget();
    
    168
    +  auto isComparator = current == comparatorTab_;
    
    168 169
       if (!leftWidget_->isVisible() && !isComparator)
    
    169 170
       {
    
    170 171
         // Dirty approach here: When setting the left panel as visible, the main
    
    ... ... @@ -183,6 +184,12 @@ MainGUI::switchTab()
    183 184
         leftWidget_->setVisible(!isComparator);
    
    184 185
     
    
    185 186
       reloadCurrentTabFont();
    
    187
    +
    
    188
    +  if (current == continuousTab_ && lastTab_ == singularTab_
    
    189
    +      && singularTab_->currentGlyph() >= 0)
    
    190
    +    continuousTab_->highlightGlyph(singularTab_->currentGlyph());
    
    191
    +
    
    192
    +  lastTab_ = tabWidget_->currentWidget();
    
    186 193
     }
    
    187 194
     
    
    188 195
     
    
    ... ... @@ -263,6 +270,7 @@ MainGUI::createLayout()
    263 270
       tabWidget_->addTab(comparatorTab_, tr("Comparator View"));
    
    264 271
       tabs_.append(infoTab_);
    
    265 272
       tabWidget_->addTab(infoTab_, tr("Font Info"));
    
    273
    +  lastTab_ = singularTab_;
    
    266 274
       
    
    267 275
       tabWidget_->setTabToolTip(0, tr("View single glyph in grid view.\n"
    
    268 276
                                       "For pixelwise inspection of the glyphs."));
    

  • src/ftinspect/maingui.hpp
    ... ... @@ -114,6 +114,7 @@ private:
    114 114
       ContinuousTab* continuousTab_;
    
    115 115
       ComperatorTab* comparatorTab_;
    
    116 116
       InfoTab* infoTab_;
    
    117
    +  QWidget* lastTab_ = NULL;
    
    117 118
     
    
    118 119
       QDockWidget* glyphDetailsDockWidget_;
    
    119 120
       GlyphDetails* glyphDetails_;
    

  • src/ftinspect/models/fontinfomodels.cpp
    ... ... @@ -207,6 +207,8 @@ SFNTNameModel::data(const QModelIndex& index,
    207 207
       switch (static_cast<Columns>(index.column()))
    
    208 208
       {
    
    209 209
       case SNM_Name:
    
    210
    +    if (obj.nameID >= 256)
    
    211
    +      return QString::number(obj.nameID);
    
    210 212
         return QString("%1 <%2>")
    
    211 213
                  .arg(obj.nameID)
    
    212 214
                  .arg(*mapSFNTNameIDToName(obj.nameID));
    

  • src/ftinspect/panels/continuous.cpp
    ... ... @@ -39,6 +39,7 @@ ContinuousTab::repaintGlyph()
    39 39
       sizeSelector_->applyToEngine(engine_);
    
    40 40
       
    
    41 41
       syncSettings();
    
    42
    +  canvas_->stopFlashing();
    
    42 43
       canvas_->purgeCache();
    
    43 44
       canvas_->repaint();
    
    44 45
     }
    
    ... ... @@ -56,12 +57,20 @@ ContinuousTab::reloadFont()
    56 57
       checkModeSource();
    
    57 58
     
    
    58 59
       charMapSelector_->repopulate();
    
    60
    +  canvas_->stopFlashing();
    
    59 61
       canvas_->stringRenderer().reloadAll();
    
    60 62
       canvas_->purgeCache();
    
    61 63
       repaintGlyph();
    
    62 64
     }
    
    63 65
     
    
    64 66
     
    
    67
    +void
    
    68
    +ContinuousTab::highlightGlyph(int index)
    
    69
    +{
    
    70
    +  canvas_->flashOnGlyph(index);
    
    71
    +}
    
    72
    +
    
    73
    +
    
    65 74
     void
    
    66 75
     ContinuousTab::syncSettings()
    
    67 76
     {
    
    ... ... @@ -537,6 +546,9 @@ ContinuousTab::createConnections()
    537 546
     
    
    538 547
       sizeSelector_->installEventFilterForWidget(canvas_);
    
    539 548
       sizeSelector_->installEventFilterForWidget(this);
    
    549
    +
    
    550
    +  connect(glyphDetails_, &GlyphDetails::switchToSingular,
    
    551
    +          [&] (int index) { switchToSingular(index, -1); });
    
    540 552
     }
    
    541 553
     
    
    542 554
     
    

  • src/ftinspect/panels/continuous.hpp
    ... ... @@ -38,6 +38,7 @@ public:
    38 38
     
    
    39 39
       void repaintGlyph() override;
    
    40 40
       void reloadFont() override;
    
    41
    +  void highlightGlyph(int index);
    
    41 42
       void syncSettings();
    
    42 43
     
    
    43 44
       // -1: Glyph order, otherwise the char map index in the original list
    
    ... ... @@ -66,6 +67,7 @@ public:
    66 67
       void showToolTip();
    
    67 68
     
    
    68 69
     signals:
    
    70
    +  // if sizePoint <= 0, then don't change size.
    
    69 71
       void switchToSingular(int glyphIndex, double sizePoint);
    
    70 72
     
    
    71 73
     protected:
    

  • src/ftinspect/panels/glyphdetails.cpp
    ... ... @@ -30,6 +30,7 @@ GlyphDetails::updateGlyph(GlyphCacheEntry& ctxt, int charMapIndex)
    30 30
     {
    
    31 31
       auto& cMaps = engine_->currentFontCharMaps();
    
    32 32
     
    
    33
    +  glyphIndex_ = ctxt.glyphIndex;
    
    33 34
       glyphIndexLabel_->setText(QString::number(ctxt.glyphIndex));
    
    34 35
       if (charMapIndex < 0 || static_cast<unsigned>(charMapIndex) >= cMaps.size())
    
    35 36
       {
    
    ... ... @@ -187,6 +188,9 @@ GlyphDetails::createConnections()
    187 188
     {
    
    188 189
       connect(unitButtonGroup_, &QButtonGroup::idClicked,
    
    189 190
               this, &GlyphDetails::changeUnit);
    
    191
    +
    
    192
    +  connect(bitmapWidget_, &GlyphBitmapWidget::clicked,
    
    193
    +          this, &GlyphDetails::bitmapWidgetClicked);
    
    190 194
     }
    
    191 195
     
    
    192 196
     
    
    ... ... @@ -249,4 +253,12 @@ GlyphDetails::changeUnit(int unitId)
    249 253
     }
    
    250 254
     
    
    251 255
     
    
    256
    +void
    
    257
    +GlyphDetails::bitmapWidgetClicked()
    
    258
    +{
    
    259
    +  if (glyphIndex_ >= 0)
    
    260
    +    emit switchToSingular(glyphIndex_);
    
    261
    +}
    
    262
    +
    
    263
    +
    
    252 264
     // end of glyphdetails.cpp

  • src/ftinspect/panels/glyphdetails.hpp
    ... ... @@ -30,8 +30,12 @@ public:
    30 30
       void updateGlyph(GlyphCacheEntry& ctxt,
    
    31 31
                        int charMapIndex);
    
    32 32
     
    
    33
    +signals:
    
    34
    +  void switchToSingular(int index);
    
    35
    +
    
    33 36
     private:
    
    34 37
       Engine* engine_ = NULL;
    
    38
    +  int glyphIndex_ = -1;
    
    35 39
     
    
    36 40
       enum DisplayUnit : int
    
    37 41
       {
    
    ... ... @@ -79,6 +83,7 @@ private:
    79 83
       void createConnections();
    
    80 84
     
    
    81 85
       void changeUnit(int unitId);
    
    86
    +  void bitmapWidgetClicked();
    
    82 87
     };
    
    83 88
     
    
    84 89
     
    

  • src/ftinspect/panels/settingpanelmmgx.cpp
    ... ... @@ -57,10 +57,7 @@ SettingPanelMMGX::reloadFont()
    57 57
           w->updateInfo(currentAxes_[i]);
    
    58 58
           listLayout_->addWidget(w);
    
    59 59
           connect(w, &MMGXSettingItem::valueChanged,
    
    60
    -              [this, index = i]
    
    61
    -              {
    
    62
    -                itemChanged(index);
    
    63
    -              });
    
    60
    +              [this, i] { itemChanged(i); });
    
    64 61
         }
    
    65 62
       }
    
    66 63
       checkHidden();
    

  • src/ftinspect/panels/singular.cpp
    ... ... @@ -249,6 +249,36 @@ SingularTab::eventFilter(QObject* watched,
    249 249
     }
    
    250 250
     
    
    251 251
     
    
    252
    +void
    
    253
    +SingularTab::resizeEvent(QResizeEvent* event)
    
    254
    +{
    
    255
    +  QWidget::resizeEvent(event);
    
    256
    +
    
    257
    +  // Tricky part: when loading, this method will be called twice. Only at the
    
    258
    +  // second time the initial layouting is done, thus the result of `centerOn`
    
    259
    +  // can be valid.
    
    260
    +  // We want to only center the midpoint of the size when the program starts up
    
    261
    +  // so we use a counter to track the status.
    
    262
    +  if (initialPositionSetCount_ <= 0)
    
    263
    +    return;
    
    264
    +  initialPositionSetCount_--;
    
    265
    +
    
    266
    +  updateGeometry();
    
    267
    +  auto size = sizeSelector_->selectedSize();
    
    268
    +  auto unit = sizeSelector_->selectedUnit();
    
    269
    +  if (unit == FontSizeSelector::Units_pt)
    
    270
    +  {
    
    271
    +    sizeSelector_->applyToEngine(engine_);
    
    272
    +    auto dpi = engine_->dpi();
    
    273
    +    auto val = size * dpi / 72.0 / 2;
    
    274
    +    glyphView_->centerOn(val, -val);
    
    275
    +  }
    
    276
    +  else
    
    277
    +    glyphView_->centerOn(size / 2, -size / 2);
    
    278
    +
    
    279
    +}
    
    280
    +
    
    281
    +
    
    252 282
     void
    
    253 283
     SingularTab::createLayout()
    
    254 284
     {
    
    ... ... @@ -439,11 +469,19 @@ void
    439 469
     SingularTab::setCurrentGlyphAndSize(int glyphIndex,
    
    440 470
                                         double sizePoint)
    
    441 471
     {
    
    442
    -  sizeSelector_->setSizePoint(sizePoint);
    
    472
    +  if (sizePoint >= 0)
    
    473
    +    sizeSelector_->setSizePoint(sizePoint);
    
    443 474
       indexSelector_->setCurrentIndex(glyphIndex); // this will auto trigger update
    
    444 475
     }
    
    445 476
     
    
    446 477
     
    
    478
    +int
    
    479
    +SingularTab::currentGlyph()
    
    480
    +{
    
    481
    +  return indexSelector_->currentIndex();
    
    482
    +}
    
    483
    +
    
    484
    +
    
    447 485
     void
    
    448 486
     SingularTab::syncSettings()
    
    449 487
     {
    

  • src/ftinspect/panels/singular.hpp
    ... ... @@ -41,7 +41,9 @@ public:
    41 41
     
    
    42 42
       void repaintGlyph() override;
    
    43 43
       void reloadFont() override;
    
    44
    +  // when sizePoint <= 0, the size remains unchanged.
    
    44 45
       void setCurrentGlyphAndSize(int glyphIndex, double sizePoint);
    
    46
    +  int currentGlyph();
    
    45 47
     
    
    46 48
     private slots:
    
    47 49
       void setGlyphIndex(int);
    
    ... ... @@ -58,6 +60,7 @@ private slots:
    58 60
     
    
    59 61
     protected:
    
    60 62
       bool eventFilter(QObject* watched, QEvent* event) override;
    
    63
    +  void resizeEvent(QResizeEvent* event) override;
    
    61 64
     
    
    62 65
     private:
    
    63 66
       int currentGlyphIndex_;
    
    ... ... @@ -100,6 +103,8 @@ private:
    100 103
     
    
    101 104
       GraphicsDefault* graphicsDefault_;
    
    102 105
     
    
    106
    +  int initialPositionSetCount_ = 2; // see `resizeEvent`
    
    107
    +
    
    103 108
       void createLayout();
    
    104 109
       void createConnections();
    
    105 110
       
    


  • reply via email to

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