Skip to content

Commit

Permalink
Cleanup & bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebukam committed May 13, 2022
1 parent b32bf94 commit a724f60
Show file tree
Hide file tree
Showing 179 changed files with 6,935 additions and 169 deletions.
13 changes: 13 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# WIP

You can use `npm` during your tests, but you can't build the app with it. Instead, you will need to use `yarn` in order to flatten the dependencies before running the build.

- Clone the repo
- Run `yarn install` to fetch dependencies
- Run `yarn run nkmjs start-debug` to launch the Electron app in debug mode
- Most of the app' code is under the `app/js` folder.
- Use `Ctrl + R` to refresh the Electron debug container when you've made change to the source code.

- Run `yarn run nkmjs build` to build the app.
- Builds will be added to the `builds/dekstop/{plateform}` folder, created during the process.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MkFont is under active development, have a look to the repo [issues](https://git

## Tech
MkFont is built with [NKMjs](https://github.com/Nebukam/nkmjs) and runs with [Electron](https://github.com/electron/electron).
[`INSTALL.md`] — how to build the app on your machine

## Kudos
MkFont wouldn't be possible if not for [@fontello](https://github.com/fontello) folks sharing their magic : the app is primarily built around [svg2ttf](https://github.com/fontello/svg2ttf) & [svgpath](https://github.com/fontello/svgpath).
Expand Down
17 changes: 8 additions & 9 deletions app/js/data/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ class ENUMS {
]);

static BOUNDS_OUTSIDE = 0;
static BOUNDS_MIXED = 1;
static BOUNDS_MIXED_VER = 1;
static BOUNDS_INSIDE = 2;
static BOUNDS_MIXED_HOR = 3;

static BOUNDS = nkm.data.catalogs.CreateFrom({ name: `Transform reference`, autoSort: false }, [
{ name: `Imported bounds`, [nkm.com.IDS.VALUE]: this.BOUNDS_OUTSIDE, icon: 'bounds-outside' },
{ name: `Mixed bounds`, [nkm.com.IDS.VALUE]: this.BOUNDS_MIXED, icon: 'bounds-mixed' },
{ name: `Mixed bounds vertical`, [nkm.com.IDS.VALUE]: this.BOUNDS_MIXED_VER, icon: 'bounds-mixed' },
{ name: `Mixed bounds horizontal`, [nkm.com.IDS.VALUE]: this.BOUNDS_MIXED_HOR, icon: 'bounds-mixed-hor' },
{ name: `Glyph bounds`, [nkm.com.IDS.VALUE]: this.BOUNDS_INSIDE, icon: 'bounds-inside' },
]);

Expand Down Expand Up @@ -196,14 +198,11 @@ class ENUMS {

//

static LYR_BOUNDS_OUTSIDE = 0;
static LYR_BOUNDS_MIXED = 1;
static LYR_BOUNDS_INSIDE = 2;

static LYR_BOUNDS = nkm.data.catalogs.CreateFrom({ name: `Transform reference`, autoSort: false }, [
{ name: `Imported bounds`, [nkm.com.IDS.VALUE]: this.LYR_BOUNDS_OUTSIDE, icon: 'bounds-outside' },
{ name: `Mixed bounds`, [nkm.com.IDS.VALUE]: this.LYR_BOUNDS_MIXED, icon: 'bounds-mixed' },
{ name: `Glyph bounds`, [nkm.com.IDS.VALUE]: this.LYR_BOUNDS_INSIDE, icon: 'bounds-inside' },
{ name: `Imported bounds`, [nkm.com.IDS.VALUE]: this.BOUNDS_OUTSIDE, icon: 'bounds-outside' },
{ name: `Mixed bounds vertical`, [nkm.com.IDS.VALUE]: this.BOUNDS_MIXED_VER, icon: 'bounds-mixed' },
{ name: `Mixed bounds horizontal`, [nkm.com.IDS.VALUE]: this.BOUNDS_MIXED_HOR, icon: 'bounds-mixed-hor' },
{ name: `Glyph bounds`, [nkm.com.IDS.VALUE]: this.BOUNDS_INSIDE, icon: 'bounds-inside' },
]);

static LYR_SCALE = nkm.data.catalogs.CreateFrom({ name: `Scale`, autoSort: false }, [
Expand Down
2 changes: 2 additions & 0 deletions app/js/data/family-data-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ class FamilyDataBlock extends SimpleDataEx {
this._refGlyph._defaultGlyph.Reset(false, true);
this._refGlyph._defaultGlyph._ClearLayers();

this._searchSettings.Reset(false, true);

/////
this._glyphs.Clear();
this._glyphsMap = {};
Expand Down
2 changes: 1 addition & 1 deletion app/js/data/glyph-layer-data-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GlyphLayerDataBlock extends SimpleDataEx {

// Transform settings
p_values[IDS.LYR_USE_PREV_LAYER] = { value: false };
p_values[IDS.TR_LYR_BOUNDS_MODE] = { value: ENUMS.LYR_BOUNDS_OUTSIDE };
p_values[IDS.TR_LYR_BOUNDS_MODE] = { value: ENUMS.BOUNDS_OUTSIDE };
p_values[IDS.TR_BOUNDS_MODE] = { value: ENUMS.BOUNDS_OUTSIDE };
p_values[IDS.TR_LYR_SCALE_MODE] = { value: ENUMS.SCALE_MANUAL };
p_values[IDS.TR_LYR_SCALE_FACTOR] = { value: 1 };
Expand Down
2 changes: 1 addition & 1 deletion app/js/data/settings-transforms-data-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TransformSettingsDataBlock extends SimpleDataEx {

_ResetValues(p_values) {

p_values[IDS.TR_BOUNDS_MODE] = { value: ENUMS.BOUNDS_MIXED };
p_values[IDS.TR_BOUNDS_MODE] = { value: ENUMS.BOUNDS_MIXED_VER };
p_values[IDS.TR_SCALE_MODE] = { value: ENUMS.SCALE_ASCENDER };
p_values[IDS.TR_SCALE_FACTOR] = { value: 1 };
p_values[IDS.TR_NRM_FACTOR] = { value: 0 };
Expand Down
2 changes: 1 addition & 1 deletion app/js/data/ttf-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class TTFImport {
[IDS.HEIGHT]:gH,
transforms: {
// Make sure to push defaults
[IDS.TR_BOUNDS_MODE]: ENUMS.BOUNDS_MIXED,
[IDS.TR_BOUNDS_MODE]: ENUMS.BOUNDS_MIXED_VER,
[IDS.TR_SCALE_MODE]: ENUMS.SCALE_ASCENDER,
[IDS.TR_SCALE_FACTOR]: 1,
[IDS.TR_VER_ALIGN]: ENUMS.VALIGN_BASELINE,
Expand Down
2 changes: 1 addition & 1 deletion app/js/editors/inspectors/glyph-iitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class GlyphVariantInspectorItem extends base {
group: `read`
},
{
icon: `reset`, htitle: `Reset existing glyph or create an empty one if it doesn't exists.\n---\n+ [ Shift ] Also create components matching character decomposition.\n+ [ Alt ] Reset the glyph path while preserving everything else.\n[ Shift + Alt ] Create components & missing glyphs recursively.`,
icon: `reset`, htitle: `Reset existing glyph or create an empty one if it doesn't exists.\n---\n+ [ Shift ] Also create components matching character decomposition.\n+ [ Alt ] Reset the glyph path while preserving everything else.\n+ [ Shift + Alt ] Create components & missing glyphs recursively.`,
variant: ui.FLAGS.MINIMAL,
trigger: { fn: () => { this.editor.cmdGlyphClear.Execute(this._data); } },
group: `read`, member: { owner: this, id: `_glyphClearBtn` }
Expand Down
10 changes: 8 additions & 2 deletions app/js/editors/viewports/glyph-group-viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ const GlyphGroupHeader = require(`./glyph-group-header`);
const GlyphGroupFooter = require(`./glyph-group-footer`);
const GlyphGroupSearch = require(`./glyph-group-search`);

const __norange = {
name: 'No range', typeTag: `Custom`, count: 0,
icon: 'text-style', isDynamic: true,
fetchList: () => { return []; }
};

const base = nkm.datacontrols.ControlView; //ui.views.View
class GlyphGroupViewport extends base {
constructor() { super(); }
Expand Down Expand Up @@ -170,7 +176,7 @@ class GlyphGroupViewport extends base {
this._searchSettings = p_value;
this._searchObserver.ObserveOnly(p_value);
this._search.data = p_value;
//this._OnSearchToggled();
this._OnSearchToggled();
}

set displayRange(p_value) {
Expand Down Expand Up @@ -318,7 +324,7 @@ class GlyphGroupViewport extends base {

_ReloadList() {
let range = this._displayRange;
this._displayRange = null;
this.displayRange = __norange;
this.displayRange = range;
}

Expand Down
2 changes: 1 addition & 1 deletion app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class MKFont extends nkm.app.AppBase {

_FamilyFromTTF() {

let family = mkfData.TTF.FamilyFromTTF(fs.readFileSync(`./assets-dev/${__fontName}.ttf`));
let family = mkfData.TTF.FamilyFromTTF(fs.readFileSync(`./assets-dev/ttfs/${__fontName}.ttf`));

let gCount = family._glyphs.count;
family._glyphs.ForEach(glyph => {
Expand Down
58 changes: 33 additions & 25 deletions app/js/operations/svg-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,40 +445,42 @@ class SVGOperations {
case ENUMS.SKR_ORDER_Y_X_R: this._SkewY(tr, sky); this._SkewX(tr, skx); this._Rot(tr, rot, ranchor, widthRef, heightRef); break;
}

if (refMode == ENUMS.BOUNDS_INSIDE || refMode == ENUMS.BOUNDS_MIXED) {
if (refMode == ENUMS.BOUNDS_INSIDE || refMode == ENUMS.BOUNDS_MIXED_VER) {
// This alone, super expensive ;_;
bbox = this.GetBBox(pathTransform.toString());
}

}


if (refMode == ENUMS.BOUNDS_INSIDE) {
fitH = heightRef = bbox.height;
fitW = widthRef = bbox.width;
pathTransform
.translate(-bbox.x, -bbox.y)
.toString();
} else if (refMode == ENUMS.BOUNDS_MIXED) {
fitW = widthRef = bbox.width;
pathTransform
.translate(-bbox.x, 0)
.toString();
switch (refMode) {
case ENUMS.BOUNDS_INSIDE:
fitH = heightRef = bbox.height;
fitW = widthRef = bbox.width;
pathTransform.translate(-bbox.x, -bbox.y);
break;
case ENUMS.BOUNDS_MIXED_VER:
fitW = widthRef = bbox.width;
pathTransform.translate(-bbox.x, 0);
break;
case ENUMS.BOUNDS_MIXED_HOR:
fitH = heightRef = bbox.height;
pathTransform.translate(0, -bbox.y);
break;
}

if (mirror != ENUMS.MIRROR_NONE) {

switch (mirror) {
case ENUMS.MIRROR_H:
pathTransform.scale(-1, 1).translate(fitW, 0).toString();
pathTransform.scale(-1, 1).translate(fitW, 0);
doReverse = true;
break;
case ENUMS.MIRROR_V:
pathTransform.scale(1, -1).translate(0, fitH).toString();
pathTransform.scale(1, -1).translate(0, fitH);
doReverse = true;
break;
case ENUMS.MIRROR_H_AND_V:
pathTransform.scale(-1, -1).translate(fitW, fitH).toString();
pathTransform.scale(-1, -1).translate(fitW, fitH);
break;
}
}
Expand Down Expand Up @@ -678,32 +680,38 @@ class SVGOperations {
}

switch (p_settings.Get(IDS.TR_LYR_BOUNDS_MODE)) {
case ENUMS.LYR_BOUNDS_OUTSIDE:
break;
case ENUMS.LYR_BOUNDS_MIXED:
case ENUMS.BOUNDS_INSIDE:
offsetX = p_context.bbox.x;
offsetY = p_context.bbox.y;
ctxW = p_context.bbox.width;
ctxH = p_context.bbox.height;
break;
case ENUMS.LYR_BOUNDS_INSIDE:
case ENUMS.BOUNDS_MIXED_VER:
offsetX = p_context.bbox.x;
offsetY = p_context.bbox.y;
ctxW = p_context.bbox.width;
break;
case ENUMS.BOUNDS_MIXED_HOR:
offsetY = p_context.bbox.y;
ctxH = p_context.bbox.height;
break;
}

if (boundMode != ENUMS.BOUNDS_OUTSIDE) {
if (!vbbox) { vbbox = this.GetBBox(path); }
switch (boundMode) {
case ENUMS.BOUNDS_MIXED:
pathTransform.translate(-vbbox.x, 0);
pWidth = vbbox.width;
break;
case ENUMS.BOUNDS_INSIDE:
pathTransform.translate(-vbbox.x, -vbbox.y);
pWidth = vbbox.width;
pHeight = vbbox.height;
break;
case ENUMS.BOUNDS_MIXED_VER:
pathTransform.translate(-vbbox.x, 0);
pWidth = vbbox.width;
break;
case ENUMS.BOUNDS_MIXED_HOR:
pathTransform.translate(0, -vbbox.y);
pHeight = vbbox.height;
break;
}
}

Expand Down
5 changes: 3 additions & 2 deletions app/js/widgets/tr-layer-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class LayerTransformSettingsInspector extends base {
},

{ cl: ControlHeader, options: { label: `Context`, label2: `Layer` }, css: 'hdr' },
{ options: { propertyId: mkfData.IDS.TR_ANCHOR, inputOnly: true }, css: 'vsmall' },
{ options: { propertyId: mkfData.IDS.TR_ANCHOR, inputOnly: true }, css: 'vvsmall' },
{ options: { propertyId: mkfData.IDS.TR_LYR_BOUNDS_MODE, inputOnly: true }, css: 'small' },

{ options: { propertyId: mkfData.IDS.TR_LYR_SELF_ANCHOR, inputOnly: true }, css: 'vsmall' },
{ options: { propertyId: mkfData.IDS.TR_LYR_SELF_ANCHOR, inputOnly: true }, css: 'vvsmall' },
{ options: { propertyId: mkfData.IDS.TR_BOUNDS_MODE, inputOnly: true }, css: 'small' },

//{ options: { propertyId: mkfData.IDS.TR_LYR_SCALE_MODE, inputOnly: true }, css: 'small' },
Expand Down Expand Up @@ -101,6 +101,7 @@ class LayerTransformSettingsInspector extends base {
},
'.small': { 'flex': '1 1 25%' },
'.vsmall': { 'flex': '1 1 15%' },
'.vvsmall': { 'flex': '1 1 3%' },
'.large': { 'flex': '1 1 75%' },
'.btn': {
'flex': '0 0 32px',
Expand Down
10 changes: 10 additions & 0 deletions app/src-style/default/assets/icons/icon_bounds-mixed hor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src-style/default/assets/icons/icon_bounds-mixed-hor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets-dev/docs/artboard_checkbox.png
Binary file not shown.
Binary file removed assets-dev/docs/bookmark.png
Binary file not shown.
Binary file removed assets-dev/docs/copypaste.png
Binary file not shown.
Binary file removed assets-dev/docs/font_infos.png
Binary file not shown.
Binary file removed assets-dev/docs/glypheader_empty.png
Binary file not shown.
Binary file removed assets-dev/docs/glypheader_exists.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/bounds_glyph.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/bounds_import.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/bounds_mixed.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/halign_center.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/halign_left.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/halign_right.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/hanchor_center.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/hanchor_left.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/hanchor_right.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_asc.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_cap.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_em.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_height.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_manual.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_none.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_spread.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/scale_x.png
Binary file not shown.
Binary file removed assets-dev/docs/icons/valign_bsl.png
Diff not rendered.
Binary file removed assets-dev/docs/icons/valign_center.png
Diff not rendered.
Binary file removed assets-dev/docs/icons/valign_dsc.png
Diff not rendered.
Binary file removed assets-dev/docs/icons/vanchor_bottom.png
Diff not rendered.
Binary file removed assets-dev/docs/icons/vanchor_center.png
Diff not rendered.
Binary file removed assets-dev/docs/icons/vanchor_top.png
Diff not rendered.
Binary file removed assets-dev/docs/illustrator_artboard_preview.png
Diff not rendered.
Binary file removed assets-dev/docs/illustrator_mark_preview.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_glyph_align.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_glyph_export.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_glyph_main.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_glyph_metrics.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_metrics.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_metrics_bou.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_metrics_con.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_metrics_met.png
Diff not rendered.
Binary file removed assets-dev/docs/inspector_metrics_res.png
Diff not rendered.
Binary file removed assets-dev/docs/lowercase_a_basiclatin.png
Diff not rendered.
Binary file removed assets-dev/docs/marked_align_modes.png
Diff not rendered.
Binary file removed assets-dev/docs/marked_bounds_modes.png
Diff not rendered.
Binary file removed assets-dev/docs/metrics.png
Diff not rendered.
Binary file removed assets-dev/docs/no_bounds_modes.png
Diff not rendered.
Binary file removed assets-dev/docs/path_stroke.png
Diff not rendered.
Binary file removed assets-dev/docs/preview_em.png
Diff not rendered.
Binary file removed assets-dev/docs/preview_em_100.png
Diff not rendered.
Binary file removed assets-dev/docs/preview_em_1000.png
Diff not rendered.
Binary file removed assets-dev/docs/preview_em_20.png
Diff not rendered.
Binary file removed assets-dev/docs/preview_em_50.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshot_editor.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshot_editor_nums.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshot_glyph.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshot_import.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshot_landing.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshot_search.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshots/batch-import.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshots/grid.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshots/home.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshots/ligatures.png
Diff not rendered.
Binary file removed assets-dev/docs/screenshots/mkfont-preview.gif
Diff not rendered.
Binary file removed assets-dev/docs/screenshots/search.png
Diff not rendered.
Binary file removed assets-dev/docs/searchey.gif
Diff not rendered.
Binary file removed assets-dev/docs/stepbystep_1.png
Diff not rendered.
Binary file removed assets-dev/docs/stepbystep_4.png
Diff not rendered.
Binary file removed assets-dev/docs/stepbystep_412.png
Diff not rendered.
Binary file removed assets-dev/docs/stepbystep_5.png
Diff not rendered.
Binary file removed assets-dev/docs/stepbystep_6.png
Diff not rendered.
Binary file removed assets-dev/docs/stepbystep_infos.png
Diff not rendered.
Binary file removed assets-dev/docs/uniexport.png
Diff not rendered.
Binary file removed assets-dev/docs/viewbox_align_modes.png
Diff not rendered.
Binary file removed assets-dev/docs/viewbox_bounds_modes.png
Diff not rendered.
Binary file removed assets-dev/docs/x-ref.png
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a724f60

Please sign in to comment.