-
4aea40d0
by Charlie Jiang
at 2022-09-05T15:30:32+08:00
[ftinspect] Use custom `QAbstractListModel` instead of manually mapping.
In `maingui.cpp`, mapping between `QComboBox` indices and actual FreeType
values was done manually. The enabled statuses of individual ComboBox items
were also maintained in `maingui.cpp`.
In this commit, those code was moved to seperate custom classes
implementating `QAbstractListModel`. All mapping was done there.
Enable/Disable states was maintained in the classes as well.
By doing this, the reason why some items were disabled was made more clear
and explicit. Adding more items is easier.
The `QComboBoxx` custom widget is no longer needed since disable flag can
be provided by the custom model by overriding the `flags` function.
`SimpleComboBoxModel` is a basic class for Key-Value-DisplayName mapping.
Other models could extend this class if no complicated mapping (e.g.
`HintingModeComboBoxModel`) is needed.
* src/ftinspect/models/customcomboboxmodels.cpp,
src/ftinspect/models/customcomboboxmodels.cpp: New files.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
`Engine` now accepts "load target" value of certain anti-aliasing mode
instead of the anti-aliasing enum value. The mapping was moved into
`AntiAliasingComboBoxModel`.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Move all mappings
and enabled/disabled statuses to separate models.
Remove mapping `QHash`es. Use `QComboBox` instead of `QComboBoxx`.
* src/ftinspect/meson.build, src/ftinspect/CMakeLists.txt: Updated.
-
b593186d
by Charlie Jiang
at 2022-09-05T15:30:41+08:00
[ftinspect] Re-organize custom widgets.
* src/ftinspect/widgets/customwidgets.cpp,
src/ftinspect/widgets/customwidgets.cpp: New files.
Include `QGraphicsViewx`, `ZoomSpinBox` and `UnboundScrollArea` (for later
use).
* src/ftinspect/widgets/qspinboxx.hpp, src/ftinspect/widgets/qspinboxx.hpp:
Changed into `ZoomSpinBox` in `customwidgets.cpp`.
* src/ftinspect/widgets/qgraphicsviewx.cpp,
src/ftinspect/widgets/qgraphicsviewx.hpp:
Merged into `customwidgets.cpp`
* src/ftinspect/widgets/qcomboboxx.hpp,
src/ftinspect/widgets/qcomboboxx.cpp: Removed. No longer needed.
We're using custom `QAbstractListModel`'s `flags` func to disable items..
* src/ftinspect/widgets/qpushbuttonx.hpp,
src/ftinspect/widgets/qpushbuttonx.cpp: Removed. No longer needed.
We're using `setButtonNarrowest` in `uihelper.cpp`.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Updated to use new
custom widgets.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
690526a3
by Charlie Jiang
at 2022-09-05T15:30:41+08:00
[ftinspect] Rename `rendering` dir to `glyphcomponents`.
All classes in `rendering` directory will be responsible for draw
glyphs, either as independent widgets or as `QGraphicsItem`. However, the
actual drawing part will be placed into `RenderingEngine`. Therefore, we
rename it to `glyphcomponents`.
* src/ftinspect/rendering/**: Renamed.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build,
src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Updated.
-
432a0a65
by Charlie Jiang
at 2022-09-05T15:30:41+08:00
[ftinspect] WIP: Rewrite `MainGUI`.
Note: This commit doesn't compile. This change is splitted into 2 commits
to avoid a complicated diff.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Old version removed.
-
2ece842d
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Rewrite `MainGUI`.
Note: This commit compiles, but the main view is removed, so you will get a
blank right panel. The singular view will be added back with major changes
in the next commit.
This commit mainly introduces below changes:
1. The original `MainGUI` contains almost all GUI elements. Most of them are
taken out to modular components. The current `MainGUI` serves only as
a skeleton provides coordinate between components, greatly shortened.
It also provides some auxiliary code such as calling to file chooser.
2. The left panel is moved to `SettingPanel` class. The current
`settingpanel.[ch]pp` are directly modified from the latest code, so they
contains some options not implemented in the `Engine`.
Structural code that is only added accompanying later change is removed,
such as the comparator mode. Such code will be added back with the
related feature. However, code for unimplemented options are simply
commented out.
3. The main part is transformed into a tabbed view. The original code is
removed. Refactored, it will be added back in the next commit.
4. The navigation buttons (Next/Prev Font/Face/NI) are changed into the new
triplet-selector, which is a major UI improvement.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: As described.
* src/ftinspect/panels/abstracttab.hpp: Add `AbstractTab` which is an
interface for all tabs listening for font reloading and repainting.
* src/ftinspect/panels/settingpanel.cpp,
src/ftinspect/panels/settingpanel.hpp:
As described, this is the left panel. This requires intensive reviewing
since many bugs had rooted here.
* src/ftinspect/widgets/tripletselector.cpp,
src/ftinspect/widgets/tripletselector.hpp:
As described, this is the triplet (Font/Subface/NI) selector.
This component is also responsible for repopulating triplet information
and keep up with the font file change (i.e. the
`FontFileManager::currentFileChanged` event is captured here).
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `fontValid` and `namedInstanceName` since `TripletSelector` requires
them. However, they'll subject to change later.
* src/ftinspect/ftinspect.cpp: Remove call to `MainGUI::setDefaults`.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
143ecfe9
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Add the `SingularTab` and related widgets.
This introduces the new singular tab. However, because the new tab heavily
depend on the new engine structure, it's current not functional. No bitmap
or outline will be displayed. This would be fixed after the `Engine` was
refactored in the next commit.
The new singular tab has the size and glyph index selector moved out as
modular widgets to be reused.
The new scroll and shortcut behaviours are introduced in this commit, which
depend on scroll events introduced in the custom `QGraphicsViewx`.
The infinity panning of grid is implemented mainly via
`SingularTab::updateGrid` and `Grid::updateRect`.
This commit is introducing new features since it would be unfavorable to
"backport" old version of glyph components, and add those new features in
future commits - this is way too complex.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `currentFontNumberOfGlyphs` and `dpi` functions.
* src/ftinspect/widgets/fontsizeselector.cpp,
src/ftinspect/widgets/fontsizeselector.hpp:
This is the new font size selector to replace the old size/DPI/zoom boxes.
This widget is capable of handling wheel and key events delegated from
other widgets.
The support for fixed sizes and bitmap-only font is not yet added.
* src/ftinspect/widgets/glyphindexselector.cpp,
src/ftinspect/widgets/glyphindexselector.hpp:
This is the new glyph index selector to replace the old navi buttons.
This selector is aware of index min/max, consists of a group of navi
buttons, a text box (actually a spin box without buttons) to directly
input glyph index.
* src/ftinspect/glyphcomponents/graphicsdefault.cpp,
src/ftinspect/glyphcomponents/graphicsdefault.hpp:
This struct contains all default graphical settings (mainly for singular
view, e.g. the grid line color).
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp:
Add the new tab into the main window.
* src/ftinspect/glyphcomponents/glyphbitmap.cpp,
src/ftinspect/glyphcomponents/glyphbitmap.hpp:
This will now delegate rendering to the engine instead of doing rendering
itself. However, since the rendering part of the `Engine` is not
implemented, code initializing `image_` is left commented.
Also add another constructor for initializing directly from a `QImage`.
* src/ftinspect/glyphcomponents/glyphoutline.cpp,
src/ftinspect/glyphcomponents/glyphoutline.hpp,
src/ftinspect/glyphcomponents/glyphpointnumbers.cpp,
src/ftinspect/glyphcomponents/glyphpointnumbers.hpp,
src/ftinspect/glyphcomponents/glyphpoints.cpp,
src/ftinspect/glyphcomponents/glyphpoints.hpp:
Constructors of those items now accept a `FT_Glyph` instead of
`FT_Outline`. The conversion is done inside the view, and the view won't
be displayed if the glyph isn't outline glyph.
This simplifies the code of `SingularTab`.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
04452d7b
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Refactor `Engine` and fix the singular tab.
This comment brings the new glyph loading and bitmap rendering code.
The bitmap rendering part is in `RenderingEngine` which can be obtained
from the `Engine`. The `Engine` now supports loading the glyph by loading
with image cache and without image cache.
The `loadOutline` function is removed.
Accompanying this change, some new features are introduced as well. Most
notable the improvements in rendering: back/foreground color and gamma,
support bitmap glyphs (not enabled in the UI). Support for LCD and color
layer font is absent yet.
The singular tab is now enabled by uncommented functional code that was
commented in the last commit.
In `Engine`, a `ftFallbackFace_` is introduced for all non-rendering work,
and the old `ftSize_` is only used for rendering. This helps dealing with
non-scalable fonts since we can safely retrieve info with the fallback face.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Integrate the `RenderingEngine`.
Change `loadFont` to update the `ftFallbackFace_` as well.
Change all info-retrieving functions to use `ftFallbackFace_`.
Add `loadGlyph`, `loadGlyphIntoSlotWithoutCache` and
`loadGlyphWithoutUpdate`, and remove `loadOutline`.
Extract code about "get a face object from the cache and do sth."
into a new function `withFace`.
Add property `antiAliasingEnabled` and `renderMode` for the rendering
engine.
Some minor changes are included.
* src/ftinspect/engine/rendering.cpp, src/ftinspect/engine/rendering.hpp:
New files, as described.
* src/ftinspect/panels/settingpanel.cpp,
src/ftinspect/glyphcomponents/glyphbitmap.cpp,
src/ftinspect/panels/singular.cpp: Uncomment functional code.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
94a2d2b7
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Support embedded bitmap and bitmap-only fonts.
Bitmap glyphs are already supported in the new rendering engine, so we make
the option effective in the GUI. Also support bitmap-only fonts by coercing
sizes to available ones and force embedded bitmaps.
* src/ftinspect/widgets/fontsizeselector.cpp,
src/ftinspect/widgets/fontsizeselector.hpp:
Retrieve fixed sizes info from the engine and coerce to nearest available
sizes when using bitmap-only fonts.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `embeddedBitmapEnabled` property and `currentFontHasEmbeddedBitmap`,
`currentFontBitmapOnly` and `currentFontFixedSizes` getters.
* src/ftinspect/panels/settingpanel.cpp: Uncomment functional code.
-
4d320b18
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Support tricky fonts.
For tricky fonts, we disable auto-hinter and limit the TT interpreter
version.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `currentFontTricky` function and turn off hinting forcibly when the
user turns it off in the GUI for tricky fonts.
* src/ftinspect/panels/settingpanel.cpp: As described.
-
72a98cdb
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Support stem darkening.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `setStemDarkening` func.
* src/ftinspect/panels/settingpanel.cpp: Uncomment function code.
-
3d9d4c7b
by Charlie Jiang
at 2022-09-05T15:30:42+08:00
[ftinspect] Support color layers.
* src/ftinspect/engine/rendering.cpp:
Add implementation of `tryDirectRenderColorLayers`.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Implement `loadPaletteInfos` and `loadPalette`.
Add `currentFontHasColorLayers` and a group of getters/setters supporting
color layer rendering.
Also reorder fields as the number of fields grows.
* src/ftinspect/panels/settingpanel.cpp,
src/ftinspect/panels/settingpanel.hpp:
Implement `populatePalettes` and reorder functions.
Fix `checkPalette` about combo box enabling state and reset the cache when
the palette settings change.
Uncomment functional code.
* src/ftinspect/engine/paletteinfo.cpp,
src/ftinspect/engine/paletteinfo.hpp: New files adding `PaletteInfo`.
Retrieving palette names using SFNT name tables is not supported yet.
* src/ftinspect/panels/singular.cpp:
Call `Engine::loadPalette` when drawing.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
4ee1da3f
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Support LCD rendering.
* src/ftinspect/engine/rendering.cpp, src/ftinspect/engine/rendering.hpp:
Implement `convertLCDToARGB` and `convertLCDVToARGB`.
Add `lcdUsesBGR` property.
* src/ftinspect/panels/settingpanel.cpp: Uncomment functional code.
-
87ceac22
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Support opening files via command-line.
* src/ftinspect/engine/fontfilemanager.cpp,
src/ftinspect/engine/fontfilemanager.hpp:
Add `loadFromCommandLine` func.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp:
Add and call `loadCommandLine` func.
-
643732b1
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Support opening files drag-dropping.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Add related code.
-
f3a724e5
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Add auxiliary lines for the grid view.
The aux lines will show advance and asc/descender.
* src/ftinspect/glyphcomponents/grid.cpp,
src/ftinspect/glyphcomponents/grid.hpp: Implement aux lines.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `currentSizeAscDescPx`.
* src/ftinspect/panels/singular.cpp, src/ftinspect/panels/singular.hpp:
Pass parameters to the `Grid` graphics item.
-
9a72820d
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Support MM/GX.
* src/ftinspect/panels/settingpanelmmgx.cpp,
src/ftinspect/panels/settingpanelmmgx.hpp:
Add GUI widgets for MM/GX settings.
* src/ftinspect/engine/mmgx.cpp, src/ftinspect/engine/mmgx.hpp:
Add `MMGXAxisInfo` to retrieve axes info. However, the SFNT name table
isn't implemented, so the SFNT based axis names are unavailable.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `applyMMGXDesignCoords`. Add getters `currentFontMMGXState` and
`currentFontMMGXAxes`. Info is retrieved when loading font.
* src/ftinspect/panels/settingpanel.cpp,
src/ftinspect/panels/settingpanel.hpp: Uncomment functional code.
Remove `checkHintingMode` and `checkStemDarkening`. Applying of delayed
settings is taken care by the `MainGUI`. So emitting `fontReloadNeeded`
simply will do the work.
* src/ftinspect/maingui.cpp: Don't reset the cache so aggressively.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
8ae4f1b4
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Add SFNT `name` table retrieving.
* src/ftinspect/engine/fontinfo.cpp, src/ftinspect/engine/fontinfo.hpp:
New files, add `SFNTName` to retrieve `name` table.
Conversions to `QString` from mainstream encodings are supported.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `currentFontSFNTNames` and retrieve the `name` table when loading the
font. Also pass the SFNT name table when loading palettes.
* src/ftinspect/engine/mmgx.cpp, src/ftinspect/engine/paletteinfo.cpp:
Uncomment functional code to make use of the `name` table.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
4e6d8732
by Charlie Jiang
at 2022-09-05T15:30:43+08:00
[ftinspect] Add "Continuous View".
Most new features in the continuous view are included in the commit, except
the mouse left (details pane)/right (go to singular) click behaviour.
* src/ftinspect/panels/continuous.cpp, src/ftinspect/panels/continuous.hpp:
New files, the main continuous tab.
* src/ftinspect/glyphcomponents/glyphcontinuous.cpp,
src/ftinspect/glyphcomponents/glyphcontinuous.hpp:
New files, adding the `GlyphContinuous` as the actual canvas for
continuous rendering.
* src/ftinspect/engine/stringrenderer.cpp,
src/ftinspect/engine/stringrenderer.hpp:
New files, adding `StringRenderer` to layout the strings and produce
glyphs for the canvas to draw.
* src/ftinspect/widgets/charmapcombobox.cpp,
src/ftinspect/widgets/charmapcombobox.hpp:
New files, add the `CharMapComboBox` widget.
* src/ftinspect/engine/charmap.cpp,src/ftinspect/engine/charmap.hpp:
New files, adding `CharMapInfo` class.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add necessary fields and getters for string rendering.
Retrieve charmap when loading fonts.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp:
Add the continuous view to the main window.
Call `ContinuousTab::highlightGlyph` when switching from singular to
continuous view.
* src/ftinspect/panels/settingpanel.cpp: Uncomment functional code.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
d4eb06bb
by Charlie Jiang
at 2022-09-05T15:30:44+08:00
[ftinspect] Add left/right click behaviour to the continuous view.
Left clicking will open the glyph details pane, and right clicking will
switch to the singular tab.
* src/ftinspect/panels/glyphdetails.cpp,
src/ftinspect/panels/glyphdetails.hpp:
New files, add the `GlyphDetails` class.
* src/ftinspect/glyphcomponents/glyphcontinuous.cpp,
src/ftinspect/glyphcomponents/glyphcontinuous.hpp:
Add `mouseReleaseEvent` event handler which emits the new
`updateGlyphDetails` and `rightClickGlyph` signals.
* src/ftinspect/glyphcomponents/glyphbitmap.cpp,
src/ftinspect/glyphcomponents/glyphbitmap.hpp:
Add `GlyphBitmapWidget` to show the enlarged bitmap.
* src/ftinspect/panels/continuous.cpp, src/ftinspect/panels/continuous.hpp:
Add code to update the details panel, and wire up events.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp:
Add code to initialize the glyph details panel, and wire up components and
events.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
723310f5
by Charlie Jiang
at 2022-09-05T15:30:44+08:00
[ftinspect] Add "Comparator View".
* src/ftinspect/panels/comparator.cpp, src/ftinspect/panels/comparator.hpp:
New files, adding the `ComparatorTab`.
* src/ftinspect/panels/settingpanel.cpp,
src/ftinspect/panels/settingpanel.hpp: Add comparator mode.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp:
Add comparator tab and modify `switchTab` to prevent unwanted window
resizing, and to fix the tab bar position.
Modify `applySettings` to skip applying for comparator tab.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
f3c0a891
by Charlie Jiang
at 2022-09-05T15:30:44+08:00
[ftinspect] Add "Font Info" tab.
* src/ftinspect/panels/info.cpp, src/ftinspect/panels/info.hpp:
New files, add the `InfoTab` class.
* src/ftinspect/engine/fontinfo.cpp, src/ftinspect/engine/fontinfo.hpp:
Add `SFNTTableInfo`, `FontBasicInfo`, `FontTypeEntries`, `FontFixedSize`
and `CompositeGlyphInfo`. The `SFNTTableInfo` and `CompositeGlyphInfo`
classes retrieve info without the related FreeType API, but directly
parse the font data.
* src/ftinspect/models/fontinfomodels.cpp,
src/ftinspect/models/fontinfomodels.hpp:
New files. Add models for the tables and the tree view in the info tab to
use.
* src/ftinspect/engine/engine.cpp, src/ftinspect/engine/engine.hpp:
Add `loadDefaults` function for the composite glyphs view to draw its
small icon.
Add `currentFontHasGlyphName`, `currentFontPSInfo`,
`currentFontPSPrivateInfo` and `currentFontSFNTTableInfo` to obtain info.
Add getters.
* src/ftinspect/engine/fontinfonamesmapping.cpp: New file for name mapping.
* src/ftinspect/engine/fontfilemanager.cpp,
src/ftinspect/engine/fontfilemanager.hpp:
Add `currentReloadDueToPeriodicUpdate` so the composite glyph tree isn't
refreshed (which is a very expensive process) for the periodic updating of
symbolic font files.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp:
Add the font info tab info the main window and wire events.
* src/ftinspect/CMakeLists.txt, src/ftinspect/meson.build: Updated.
-
3bf89259
by Charlie Jiang
at 2022-09-05T15:30:44+08:00
[ftinspect] Fix random crash when closing fonts.
* src/ftinspect/widgets/tripletselector.cpp: Disallow font indices below 0.
It seems the CFF driver can't handle this properly.
-
d20838a8
by Charlie Jiang
at 2022-09-05T15:30:44+08:00
* src/ftinspect/engine/engine.cpp: Minor formatting.