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


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][gsoc-2022-chariri] 2 commits: [ftinspect] Minor sorting and renaming.
Date: Mon, 11 Jul 2022 05:11:58 +0000

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

Commits:

  • 72f41a0b
    by Charlie Jiang at 2022-07-11T13:07:54+08:00
    [ftinspect] Minor sorting and renaming.
    
    * src/ftinspect/panels/continuous.cpp, src/ftinspect/panels/continuous.hpp:
      Sort `updateFromCurrentSubTab`; make `setGlyphCount` update limit index as
      well; rename `updateCharMapLimit` to `updateLimitIndex`.
    
    * src/ftinspect/panels/settingpanel.cpp,
      src/ftinspect/panels/settingpanel.hpp: Remove `checkLCDFilter`; eliminate
      unnecessary updates.
    
  • 50c2bdbc
    by Charlie Jiang at 2022-07-11T13:11:31+08:00
    [ftinspect] Add documentation for data flow and events.
    
    * src/ftinspect/DataFlowAndEvent.md: New file.
    

5 changed files:

Changes:

  • src/ftinspect/DataFlowAndEvent.md
    1
    +# Data Flow and Event
    
    2
    +
    
    3
    +This document describes how data such as settings and parameters flows between
    
    4
    +components in `ftinspect`, and how events are wired between objects.
    
    5
    +
    
    6
    +There's 2 major types of setting: "Active" and "Passive". When an active setting
    
    7
    +is changed on the GUI, the event handler will actively push it to the engine.
    
    8
    +When a passive setting is changed, it won't be immediately pushed all way down
    
    9
    +to the underlying engine. They're passively applied to the engine on every
    
    10
    +render event.
    
    11
    +
    
    12
    +Below will list all settings and status values used in the project.
    
    13
    +
    
    14
    +## Common Info and Settings
    
    15
    +
    
    16
    +Most of these settings comes from the left panel. They're common across all
    
    17
    +modes.
    
    18
    +
    
    19
    +When they're modified, after internal processing of `SettingPanel`, the
    
    20
    +`SettingPanel` will emit a signal, either `repaintNeeded` or `fontReloadNeeded`.
    
    21
    +`MainGUI` is responsible to catch the signal. For the former one, it will just
    
    22
    +notify the current active tab to repaint its view. For the latter one, it will
    
    23
    +first reload the font in `Engine`, then notify the current tab that the font has
    
    24
    +changed. During the process, active settings are already applied to the Engine
    
    25
    +by `SettingPanel`, and passive settings will be applied when repainting.
    
    26
    +
    
    27
    +Passive settings are applied to the engine via `SettingPanel::syncSettings`
    
    28
    +function.
    
    29
    +
    
    30
    +Notation: `->` single arrows means calling hierarchy, and `=>` double arrows
    
    31
    +          means temporal sequence (i.e. one happens after another, but not one
    
    32
    +          calls another).
    
    33
    +
    
    34
    +Currently there's only one active setting here:
    
    35
    +
    
    36
    +- Hinting Mode: `checkHintingMode` (map using model) -> engine setters -> `FT_Property_Set` => emit reload font
    
    37
    +
    
    38
    +Passive common settings are:
    
    39
    +
    
    40
    +- Hinting On/Off
    
    41
    +  `checkHinting` (may change hinting mode!) -> emit repaint -> `syncSettings` => `Engine::update` -> load flags
    
    42
    +- Hinting Debug Switches (hor. / vert. hinting etc...)
    
    43
    +  repaint -> `syncSettings` => not implemented in Engine
    
    44
    +- Auto Hinting On/Off
    
    45
    +  `checkAutoHinting` -> emit repaint -> `syncSettings` => `Engine::update` -> load flags
    
    46
    +- Anti Aliasing Mode
    
    47
    +  `checkAntiAliasing` -> emit repaint -> `syncSettings` (map using model) => `Engine::update` -> load flags
    
    48
    +- LCD Filter Mode
    
    49
    +  repaint -> `syncSettings` (map using model) -> `Engine::setLcdFilter` -> `FT_Library_SetLcdFilter`
    
    50
    +- Gamma Value
    
    51
    +  repaint -> `syncSettings` => not implemented in Engine
    
    52
    +
    
    53
    +Info:
    
    54
    +
    
    55
    +- Font Glyph Count
    
    56
    +  `loadFont` -> `FTC_Manager_LookupSize` => stored in `curNumGlyphs_`
    
    57
    +- Font Type
    
    58
    +  `loadFont` -> `FT_FACE_DRIVER_NAME` => stored in `fontType_`
    
    59
    +- Available CharMaps (incl. Max index for each charmap)
    
    60
    +  `loadFont` -> computed & stored in `curCharMaps_`
    
    61
    +- Font Family Name & Style Name
    
    62
    +  `loadFont` -> stored in `curFamilyName_` & `curStyleName_`
    
    63
    +
    
    64
    +## Settings and Info in the Singular View
    
    65
    +
    
    66
    +There's currently no active setting in the Singular View.
    
    67
    +
    
    68
    +These parameters are used in the Sinuglar View:
    
    69
    +
    
    70
    +- Current Glyph Index
    
    71
    +  `GlyphIndexSelector::currentIndexChanged` -> `setGlyphIndex` (stored in `currentGlyphIndex_`) -> reprint -> `Engine::loadOutline` -> `FTC_ImageCache_LookupScaler`
    
    72
    +- Font Size
    
    73
    +  `FontSizeSelector::valueChanged` -> `repaintGlyph` -> `syncSettings` -> `FontSizeSelector::applyToEngine` => `Engine::update` -> scaler width/height
    
    74
    +- Zoom Factor
    
    75
    +  `zoom` -> glyph view transform => emit update grid
    
    76
    +- Show Points
    
    77
    +  `checkShowPoints` -> repaint (used in painting)
    
    78
    +- Show Bitmap & Show Point Numbers & Show Outlines On/Off
    
    79
    +  repaint (used in painting)
    
    80
    +
    
    81
    +And these values are obtained from the engine in the Singular View:
    
    82
    +
    
    83
    +- Current Glyph Count (a.k.a. Limit Index)
    
    84
    +  (see above "Common Info") -> `reloadFont` (stored in `currentGlyphCount_`) -> `GlyphIndexSelector::setMinMax` -> min/mas for spin box
    
    85
    +
    
    86
    +## Settings and Info in the Continuous View
    
    87
    +
    
    88
    +Settings in the sub tabs are pulled using `updateFromCurrentSubTab` when
    
    89
    +repainting. Info is pushed via `updateCurrentSubTab` when reloading font. 
    
    90
    +
    
    91
    +### Common Settings and Info
    
    92
    +
    
    93
    +- Font Size
    
    94
    +  `FontSizeSelector::valueChanged` -> repaint -> `FontSizeSelector::applyToEngine`
    
    95
    +  May also be alter via scrolling: `wheelResize` -> `FontSizeSelector::handleWheelResizeBySteps` -> spin box value
    
    96
    +- Current Glyph Count
    
    97
    +  (see above "Common Info") -> `reloadFont` (stored in `currentGlyphCount_`)
    
    98
    +- Mode
    
    99
    +  repaint -> `updateFromCurrentSubTab` (stored in canvas) => `GlyphContinuous::paintEvent`
    
    100
    +
    
    101
    +### All Glyphs Mode
    
    102
    +
    
    103
    +(all passive)
    
    104
    +
    
    105
    +Settings:
    
    106
    +
    
    107
    +- SubMode
    
    108
    +  repaint -> `updateFromCurrentSubTab` (stored in canvas) => `GlyphContinuous::paintEvent`
    
    109
    +- Current Glyph Index
    
    110
    +  `GlyphIndexSelector::currentIndexChanged` -> repaint -> `updateFromCurrentSubTab` (stored in canvas) => `GlyphContinuous::paintEvent`
    
    111
    +- Current CharMap
    
    112
    +  repaint -> `updateFromCurrentSubTab` (stored in canvas) => `GlyphContinuous::paintEvent`
    
    113
    +  May also be updated when setting available charmaps
    
    114
    +- Limit Index (max index if charmap is used, otherwise glyph count)
    
    115
    +  Triggered when current charmap or glyph count changes.
    
    116
    +  `updateLimitIndex` -> stored in `glyphLimitIndex_` => `updateFromCurrentSubTab` (stored in canvas) => `GlyphContinuous::paintEvent`
    
    117
    +
    
    118
    +Info:
    
    119
    +
    
    120
    +- Available CharMaps
    
    121
    +  (see above "Common Info", already stored in engine) -> `reloadFont` -> `updateCurrentSubTab` -> `ContinousAllGlyphsTab::setCharMaps`
    
    122
    +- Current Glyph Count
    
    123
    +  (see above "Common Info", already stored in engine) -> `reloadFont` -> `updateCurrentSubTab` -> `ContinousAllGlyphsTab::setGlyphCount` (stored in `currentGlyphCount_`)
    
    124
    +- Displaying Count
    
    125
    +  repaint -> `GlyphContinuous::paintEvent` -> `GlyphContinuous::displayingCountUpdated` -> `ContinousAllGlyphsTab::setDisplayingCount` -> `GlyphIndexSelector::setShowingCount`
    \ No newline at end of file

  • src/ftinspect/panels/continuous.cpp
    ... ... @@ -123,12 +123,12 @@ ContinuousTab::updateFromCurrentSubTab()
    123 123
       switch (tabWidget_->currentIndex())
    
    124 124
       {
    
    125 125
       case AllGlyphs:
    
    126
    +    canvas_->setMode(GlyphContinuous::AllGlyphs);
    
    127
    +    canvas_->setSubModeAllGlyphs(allGlyphsTab_->subMode());
    
    126 128
         // Begin index is selected from All Glyphs subtab,
    
    127 129
         // and Limit index is calculated by All Glyphs subtab
    
    128 130
         canvas_->setBeginIndex(allGlyphsTab_->glyphBeginindex());
    
    129 131
         canvas_->setLimitIndex(allGlyphsTab_->glyphLimitIndex());
    
    130
    -    canvas_->setMode(GlyphContinuous::AllGlyphs);
    
    131
    -    canvas_->setSubModeAllGlyphs(allGlyphsTab_->subMode());
    
    132 132
         canvas_->setCharMapIndex(allGlyphsTab_->charMapIndex());
    
    133 133
         break;
    
    134 134
       }
    
    ... ... @@ -185,7 +185,14 @@ void
    185 185
     ContinousAllGlyphsTab::setGlyphBeginindex(int index)
    
    186 186
     {
    
    187 187
       indexSelector_->setCurrentIndex(index);
    
    188
    -  updateCharMapLimit();
    
    188
    +}
    
    189
    +
    
    190
    +
    
    191
    +void
    
    192
    +ContinousAllGlyphsTab::setGlyphCount(int count)
    
    193
    +{
    
    194
    +  currentGlyphCount_ = count;
    
    195
    +  updateLimitIndex();
    
    189 196
     }
    
    190 197
     
    
    191 198
     
    
    ... ... @@ -240,12 +247,12 @@ ContinousAllGlyphsTab::setCharMaps(QVector<CharMapInfo>& charMaps)
    240 247
         charMapSelector_->setCurrentIndex(newIndex);
    
    241 248
       }
    
    242 249
     
    
    243
    -  updateCharMapLimit();
    
    250
    +  updateLimitIndex();
    
    244 251
     }
    
    245 252
     
    
    246 253
     
    
    247 254
     void
    
    248
    -ContinousAllGlyphsTab::updateCharMapLimit()
    
    255
    +ContinousAllGlyphsTab::updateLimitIndex()
    
    249 256
     {
    
    250 257
       if (charMapSelector_->currentIndex() <= 0)
    
    251 258
         glyphLimitIndex_ = currentGlyphCount_;
    
    ... ... @@ -324,7 +331,7 @@ ContinousAllGlyphsTab::charMapChanged()
    324 331
         else
    
    325 332
           setGlyphBeginindex(0x20);
    
    326 333
       }
    
    327
    -  updateCharMapLimit();
    
    334
    +  updateLimitIndex();
    
    328 335
     
    
    329 336
       emit changed();
    
    330 337
     
    

  • src/ftinspect/panels/continuous.hpp
    ... ... @@ -85,12 +85,12 @@ public:
    85 85
       void setGlyphBeginindex(int index);
    
    86 86
     
    
    87 87
       // This doesn't trigger immediate repaint
    
    88
    -  void setGlyphCount(int count) { currentGlyphCount_ = count; }
    
    88
    +  void setGlyphCount(int count);
    
    89 89
       void setDisplayingCount(int count);
    
    90 90
     
    
    91 91
       void setCharMaps(QVector<CharMapInfo>& charMaps);
    
    92 92
       // This doesn't trigger either.
    
    93
    -  void updateCharMapLimit();
    
    93
    +  void updateLimitIndex();
    
    94 94
     
    
    95 95
     signals:
    
    96 96
       void changed();
    

  • src/ftinspect/panels/settingpanel.cpp
    ... ... @@ -28,7 +28,6 @@ SettingPanel::checkAllSettings()
    28 28
       checkHinting();
    
    29 29
       checkAutoHinting();
    
    30 30
       checkAntiAliasing();
    
    31
    -  checkLCDFilter();
    
    32 31
     }
    
    33 32
     
    
    34 33
     
    
    ... ... @@ -56,7 +55,7 @@ SettingPanel::checkHinting()
    56 55
         }
    
    57 56
     
    
    58 57
         autoHintingCheckBox_->setEnabled(true);
    
    59
    -    checkAutoHinting();
    
    58
    +    checkAutoHinting(); // this will emit repaint
    
    60 59
       }
    
    61 60
       else
    
    62 61
       {
    
    ... ... @@ -74,9 +73,9 @@ SettingPanel::checkHinting()
    74 73
           == AntiAliasingComboBoxModel::AntiAliasing_Light)
    
    75 74
           antiAliasingComboBox_->setCurrentIndex(
    
    76 75
             AntiAliasingComboBoxModel::AntiAliasing_Normal);
    
    77
    -  }
    
    78 76
     
    
    79
    -  emit repaintNeeded();
    
    77
    +    emit repaintNeeded();
    
    78
    +  }
    
    80 79
     }
    
    81 80
     
    
    82 81
     
    
    ... ... @@ -167,13 +166,6 @@ SettingPanel::checkAntiAliasing()
    167 166
     }
    
    168 167
     
    
    169 168
     
    
    170
    -void
    
    171
    -SettingPanel::checkLCDFilter()
    
    172
    -{
    
    173
    -  emit repaintNeeded();
    
    174
    -}
    
    175
    -
    
    176
    -
    
    177 169
     void
    
    178 170
     SettingPanel::syncSettings()
    
    179 171
     {
    
    ... ... @@ -207,7 +199,7 @@ SettingPanel::createConnections()
    207 199
               this, &SettingPanel::checkAntiAliasing);
    
    208 200
       connect(lcdFilterComboBox_, 
    
    209 201
               QOverload<int>::of(&QComboBox::currentIndexChanged),
    
    210
    -          this, &SettingPanel::checkLCDFilter);
    
    202
    +          this, &SettingPanel::repaintNeeded);
    
    211 203
     
    
    212 204
       connect(gammaSlider_, &QSlider::valueChanged,
    
    213 205
               this, &SettingPanel::repaintNeeded);
    

  • src/ftinspect/panels/settingpanel.hpp
    ... ... @@ -40,7 +40,6 @@ public slots:
    40 40
       void checkHintingMode();
    
    41 41
       void checkAutoHinting();
    
    42 42
       void checkAntiAliasing();
    
    43
    -  void checkLCDFilter();
    
    44 43
     
    
    45 44
     private:
    
    46 45
       Engine* engine_;
    


  • reply via email to

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