-
2d14814e
by Charlie Jiang
at 2022-09-04T12:14:12+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.
-
797a3f88
by Charlie Jiang
at 2022-09-04T12:14:17+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.
-
a528c222
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
20d1aa34
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
f23f4c28
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
512e1dba
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
17e2b1b8
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
68d22667
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
4bbc7f05
by Charlie Jiang
at 2022-09-04T12:14:18+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.
-
dd172fa9
by Charlie Jiang
at 2022-09-04T12:14:18+08:00
[ftinspect] Support opening files drag-dropping.
* src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: Add related code.