Code Monkey home page Code Monkey logo

glif's Introduction

MFEKglif

Glyph editor for the Modular Font Editor K project. Build Status

Current beta release: v2.0.0ꞵ1 “Repetitive Spline Injury”

Binaries (links in § Artifacts)

  • Linux
  • Windows
  • macOS (not notarized — please also read notes in § Running from artifacts → Mac users)

Table of Contents

  1. Overview
  2. Keys
  3. Running from artifacts
  4. Building
  5. I/O Help
  6. Contributing
  7. License

Overview

MFEKglif mixes three technologies: Skia, a powerful path rasterizer and manipulation library; Dear ImGui, an immediate mode GUI toolkit; and Rust, a modern high-performance systems language.

I wrote it after, hopefully, learning from the mistakes made by George Williams in FontForge, after being a user of FontForge for six years and a co-maintainer for one and a half years.

MFEKglif is the flagship program of the Modular Font Editor K project, which aims to create a full font editor by making many small programs that all work together, fulfilling the Unix adage that each program should have one task and do that task well. MFEKglif aims to do the task of creating and editing glyphs well.

To make this as easy as possible to build, and cross-platform without hassle, resources are compiled into the binary via the Rust include_str! macro, and MFEKglif is statically compiled by default to its C dependencies.

Keys

Note: This is a basic list to get you started. A complete list can be found in resources/default_keymap.xml. You may copy this file to e.g. $HOME/.config/MFEK/glif/keybindings.xml on Linux and modify it.

I/O

For more information, see § “I/O Help”.

  • CtrlO — Open user-specified .glif or .glifjson file
  • CtrlS — Save current glyph in a multi-layered .glifjson file
  • CtrlShiftS — Save current glyph in a multi-layered user-specified .glifjson file
  • CtrlU — Flatten the topmost layer, and overwrite current .glif with it
  • CtrlShiftU — Flatten the topmost layer, and write it to a user-specified .glif file
  • CtrlE — Export the multi-layered .glif to different glyphs/ directories for each layer, with layerinfo.plist and update layercontents.plist for each.

Tools

  • A — Select «Pan» tool
  • P — Select «Pen» tool
  • V — Select «Select» tool
  • Z — Select «Zoom» tool
  • AltD — Select «Dash Along Path» tool
  • AltP — Select «Pattern Along Path» tool
  • W — Select «Variable Width Stroke» tool
  • M — Select «Measure» tool
  • N — Select «Anchors» tool
  • S — Select «Shapes» tool

Selection

  • CtrlA — Select all points in current layer
  • Backspace — Delete currently selected points

Running from artifacts

MFEKglif is still beta-quality software, and a numbered release hasn't been made yet. Before 1.0 is out, though, you can test it out with the artifacts function in GitHub. Go to «Actions», choose a commit, and download the artifact for your OS. Three are uploaded: MFEKglif-linux, MFEKglif-windows, and MFEKglif-macos (not notarized).

Building

Mac users

Apple charges a fee to "notarize" applications and without this "notarization" MFEKglif will not run correctly, or in some cases, at all. So, for the foreseeable future, you must build MFEKglif from source on OS X. This is not as hard as it sounds! :-)

Linux users

MFEKglif depends on GTK3 (for the open/save dialogs) and SDL2 (for windowing). If using X11 and not Wayland, it depends on the X11 C shape extension (libxcb-shape.so.0) and the xfixes extension (libxcb-xfixes.so.0). Their header files are also needed: /usr/include/xcb/shape.h and /usr/include/xcb/xfixes.h.

On Arch Linux, these three packages provide all the dependencies: gtk3 libxcb sdl2

On Ubuntu, these four packages provide the dependencies: libgtk-3-dev libxcb-shape0-dev libxcb-xfixes0-dev sdl2-dev

Adding .desktop shortcut

I provide a .desktop shortcut in resources/ as MFEKglif.desktop. To install it, assuming MFEKglif is in your $PATH:

  1. Copy the icon to $XDG_HOME. On my system, the command was mkdir -p ~/.local/share/icons/hicolor/512x512/apps/ && cp resources/MFEKglif.png ~/.local/share/icons/hicolor/512x512/apps/MFEKglif.png.
  2. Run desktop-file-install --dir=~/.local/share/applications ~/MFEKglif.desktop to install locally (also depends on $XDG_HOME, or run it as root without --dir to install the .desktop icon globally.
  3. Run update-desktop-database on the directory used in step 2.

For everyone

  • Download and install rustup, selecting either the nightly or stable toolchain. MFEKglif builds on both as of 7 November 2021.
  • Pull this repository, and finally…
  • Compile the project. An example command is in § Contributing; you may also find the provided Makefile helpful.

Note on system SDL2

By default, MFEKglif compiles and statically links to SDL2 if not on Linux. If you have SDL2 installed, or find compiling it difficult for some reason and wish to link to a binary SDL2, you should provide the flag --features=sdl2-dynamic to cargo build. This will disable the features sdl2/bundled and sdl2/static-link, and your system will attempt to link to a dynamic libSDL2.

Mac users

Mac users can install SDL2 via Homebrew if the automatic static linking of system SDL2 is not working well:

brew install sdl2

(It was found to have issues as recently as August 21, 2022; see № 321.)

Errors?

If you previously pulled the repository and get errors related to glifparser, mfek-ipc, or another local unstable dependency, try running cargo update to force Cargo to pull the latest versions from GitHub.

I/O Help

It's worth taking a moment to explain MFEKglif's I/O. Before November 6, 2021, a complex system was used to save private MFEKglif UFO .glif extensions to the standard .glif format. This became too confusing, both for users and developers, and was removed.

MFEKglif considers UFO .glif as an import format, and its own native format is .glifjson, which is just a JSON file with keys and values it understands. This is because MFEKglif supports multi-layered glyphs, variable-width stroking, pattern-along-path, and many other features that are of course not in standard .glif; others, such as Spiro and Hyperbézier curves, are planned.

So, when you save (Ctrl+S), MFEKglif will write a file named a.glifjson if you had open a.glif. To get back out UFO .glif output, you have to do one of the several export abilities MFEKglif has. If you instead save with Ctrl+U, you'll be given a dialog asking you a name for your output .glif file. If you save with Ctrl+Shift+U, MFEKglif will overwrite whatever the current filename is as a .glif, so if you've opened a.glif, it'll overwrite that; if you've opened a.glifjson, it'll write to a.glif. This flattens all layers, so you may instead want MFEKglif's most complex (and therefore potentially buggy! please open any issue you find) mode of saving: exporting—Ctrl+E. This will create a new directory for every layer in your glyph and save the layer into it, flattening layer groups.

Contributing

I typically build and run MFEKglif like this:

RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- examples/Q_.glif

We welcome all contributions! Please open an issue first so we can discuss before you make big changes so no effort is wasted.

More debug output

It is possible to get even more debug output out of MFEKglif for figuring out where problems lie. To ask MFEKglif to dump the parsed .glif file on runtime, pass MFEK_DEBUG_DUMP_GLYPH=Y. To see every single sdl2 event (warning: this will flood your stdout) pass MFEK_DEBUG_EVENTS=Y.

Backtrace logging

By default, MFEKglif writes its backtraces to your temporary directory (it outputs the filename on crash as well). You should share these when reporting a crash; you may stop them from being written with the environment variable MFEK_BACKTRACE_NO_WRITE=Y.

To quiet all potentially useful information from a crash, set MFEK_QUIET_CRASH=Y.

Adding icons

Icons are themselves .glif files, see resources/fonts/MFEKglifIconFont.ufo/glyphs. Once you add a glyph to the UFO, you can rebuild the font (provided you have fontmake) with make iconfont.

Goals

Contributions which do not work on at least GNU/Linux and Windows will be rejected; we want to be able to build MFEKglif on as many platforms as possible. Both Skia and Dear ImGui are cross-platform; we use Vulkan and not OpenGL so we are future-proof even on OS X.

Contibutions will also be judged on how well they fit into the MFEK project as a whole. It's possible that your idea fits better into another module and not MFEKglif; we can help you figure out where it should go.

«Issues» vs. «Discussions»

If you find a bug in MFEKglif, please open the bug against this repository in «Issues». Your bug may be moved by a maintainer (as of 4 January 2022 Fred Brennan/@ctrlcctrlv is the only MFEK maintainer) to the bug tracker of another MFEK module or library, considering only where the code resides that your issue concerns, not the module you're using. When in doubt as to which repository is correct, just use this one—let Fred figure it out.

To discuss the MFEK project/offer ideas/report your experience, (good or bad!) and not report a bug, please open a thread in «Discussions». «Discussions» is not at all strict about repository hygeine, so you may discuss anything related to MFEK there.

License

Copyright 2020–2021 Fredrick R. Brennan, Matthew Blanchard & MFEK Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this software or any of the provided source code files except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.  See the License for the
specific language governing permissions and limitations under the License.

By contributing you release your contribution under the terms of the license.

glif's People

Contributors

alerque avatar ctrlcctrlv avatar dependabot-preview[bot] avatar dependabot[bot] avatar eliheuer avatar jazzfool avatar jpt avatar matthewblanchard avatar small-ku avatar subject38 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glif's Issues

VWS crash: panicked at 'index out of bounds: the len is 4 but the index is 4'

82bf6a5

File

{
  "layers": [
    {
      "name": "Layer 0",
      "visible": true,
      "color": null,
      "outline": [
        {
          "inner": [
            {
              "x": 125.285736,
              "y": 197.28552,
              "a": {
                "At": [
                  119.285736,
                  262.28564
                ]
              },
              "b": {
                "At": [
                  131.28574,
                  132.28552
                ]
              },
              "name": null,
              "ptype": "Curve",
              "data": null
            },
            {
              "x": 233.28574,
              "y": 324.2854,
              "a": {
                "At": [
                  351.28564,
                  334.2854
                ]
              },
              "b": {
                "At": [
                  115.285736,
                  314.2854
                ]
              },
              "name": null,
              "ptype": "Curve",
              "data": null
            },
            {
              "x": 342.28577,
              "y": 174.28549,
              "a": {
                "At": [
                  338.28577,
                  59.285492
                ]
              },
              "b": {
                "At": [
                  346.28574,
                  289.28528
                ]
              },
              "name": null,
              "ptype": "Curve",
              "data": null
            },
            {
              "x": 224.28574,
              "y": 54.285645,
              "a": {
                "At": [
                  124.285736,
                  43.285645
                ]
              },
              "b": {
                "At": [
                  324.2859,
                  65.285645
                ]
              },
              "name": null,
              "ptype": "Curve",
              "data": null
            }
          ],
          "operation": {
            "VariableWidthStroke": {
              "data": {
                "handles": [
                  {
                    "left_offset": 10.0,
                    "right_offset": 10.0,
                    "tangent_offset": 0.0,
                    "interpolation": "Linear"
                  },
                  {
                    "left_offset": 10.0,
                    "right_offset": 10.0,
                    "tangent_offset": 0.0,
                    "interpolation": "Linear"
                  },
                  {
                    "left_offset": 40.25149507653363,
                    "right_offset": 40.25149507653363,
                    "tangent_offset": -1.685716592159115,
                    "interpolation": "Linear"
                  },
                  {
                    "left_offset": 10.0,
                    "right_offset": 10.0,
                    "tangent_offset": 0.0,
                    "interpolation": "Linear"
                  },
                  {
                    "left_offset": 10.0,
                    "right_offset": 10.0,
                    "tangent_offset": 0.0,
                    "interpolation": "Linear"
                  }
                ],
                "join_type": "Round",
                "cap_start_type": "Round",
                "cap_end_type": "Round",
                "remove_internal": false,
                "remove_external": false
              }
            }
          }
        },
        {
          "inner": [
            {
              "x": 68.0,
              "y": 387.0,
              "a": "Colocated",
              "b": "Colocated",
              "name": null,
              "ptype": "Line",
              "data": null
            },
            {
              "x": 479.0,
              "y": 387.0,
              "a": "Colocated",
              "b": "Colocated",
              "name": null,
              "ptype": "Line",
              "data": null
            },
            {
              "x": 479.0,
              "y": 9.0,
              "a": "Colocated",
              "b": "Colocated",
              "name": null,
              "ptype": "Line",
              "data": null
            },
            {
              "x": 68.0,
              "y": 9.0,
              "a": "Colocated",
              "b": "Colocated",
              "name": null,
              "ptype": "Line",
              "data": null
            }
          ],
          "operation": null
        }
      ],
      "operation": null,
      "images": []
    }
  ],
  "history": [],
  "order": "Cubic",
  "anchors": [],
  "components": {
    "root": "M",
    "vec": []
  },
  "flattened": null,
  "component_rects": null,
  "guidelines": [],
  "width": 1085,
  "unicode": [
    "M"
  ],
  "name": "M",
  "note": null,
  "format": 2,
  "filename": "/tmp/vws_rev.glif"
}

Reproduction

  1. Select the square by double clicking one of its points
    image
  2. Press Backspace

Crash

panicked at 'index out of bounds: the len is 4 but the index is 4', /home/fred/.cargo/git/checkouts/math.rlib-d2c76c88b18fa5ee/2547be6/src/variable_width_stroking.rs:138:28

Requested backtrace:
   0: MFEKglif::util::set_panic_hook::{{closure}}
             at src/util/mod.rs:61:26
   1: std::panicking::rust_panic_with_hook
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:595:17
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:497:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/sys_common/backtrace.rs:141:18
   4: rust_begin_unwind
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:493:5
   5: core::panicking::panic_fmt
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/core/src/panicking.rs:92:14
   6: core::panicking::panic_bounds_check
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/core/src/panicking.rs:69:5
   7: <usize as core::slice::index::SliceIndex<[T]>>::index
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:184:10
   8: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:15:9
   9: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:2427:9
  10: MFEKmath::variable_width_stroking::variable_width_stroke
             at /home/fred/.cargo/git/checkouts/math.rlib-d2c76c88b18fa5ee/2547be6/src/variable_width_stroking.rs:138:28
  11: MFEKglif::contour_operations::variablewidthstroke::<impl MFEKglif::contour_operations::ContourOperation for glifparser::glif::mfek::VWSContour>::build
             at src/contour_operations/variablewidthstroke.rs:16:26
  12: MFEKglif::contour_operations::build
             at src/contour_operations/mod.rs:49:20
  13: MFEKglif::editor::operations::<impl MFEKglif::editor::Editor>::rebuild
             at src/editor/operations.rs:30:36
  14: MFEKglif::main
             at src/main.rs:308:9
  15: core::ops::function::FnOnce::call_once
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  16: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18
  17: std::rt::lang_start::{{closure}}
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:49:18
  18: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/core/src/ops/function.rs:259:13
      std::panicking::try::do_call
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:379:40
      std::panicking::try
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panicking.rs:343:19
      std::panic::catch_unwind
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/panic.rs:431:14
      std::rt::lang_start_internal
             at /rustc/79e50bf77928f374921a6bcafee3fcff1915f062/library/std/src/rt.rs:34:21
  19: std::rt::lang_start
             at /home/fred/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:48:5
  20: main
  21: __libc_start_main
  22: _start


shell returned 101

Use an icon font for all non-custom icons?

Screen Shot 2021-05-10 at 12 07 30

The icons for add/remove/up/down are aligned oddly; the up/down look like unicode characters typeset with a system font, whereas the add/remove look like icons rendered from vector artwork.

I suggest using a comprehensive UI icon set packaged as a font, like the Material Design set on https://fonts.google.com/icons, so that you can get the best of both worlds

Build fails

% git clone https://github.com/MFEK/glif;
% cd glif;
% cargo run --;
    Updating git repository `https://github.com/MFEK/imgui-skia-renderer.rlib`
    Updating git repository `https://github.com/mfek/ipc`
    Updating git repository `https://github.com/raphlinus/nfd-rs`
    Updating git submodule `https://github.com/mlabbe/nativefiledialog`
  Downloaded libloading v0.7.0
  Downloaded gcc v0.3.55
  Downloaded bincode v1.3.2
  Downloaded derive_more v0.99.13
  Downloaded parking_lot_core v0.8.3
  Downloaded raw-window-handle v0.3.3
  Downloaded strum_macros v0.20.1
  Downloaded enum-iterator-derive v0.6.0
  Downloaded bytemuck v1.5.1
  Downloaded color_quant v1.1.0
  Downloaded num-rational v0.3.2
  Downloaded enum-iterator v0.6.0
  Downloaded backtrace v0.3.56
  Downloaded scoped_threadpool v0.1.9
  Downloaded jpeg-decoder v0.1.22
  Downloaded miniz_oxide v0.3.7
  Downloaded strum v0.20.0
  Downloaded semver-parser v0.7.0
  Downloaded objc_id v0.1.1
  Downloaded git-version v0.3.4
  Downloaded vk-mem v0.2.2
  Downloaded serde_bytes v0.11.5
  Downloaded skulpin v0.13.0
  Downloaded profiling-procmacros v0.1.3
  Downloaded skulpin-renderer v0.13.0
  Downloaded syn v1.0.67
  Downloaded unidiff v0.3.3
  Downloaded pathfinder_simd v0.5.0
  Downloaded version-compare v0.0.10
  Downloaded parking_lot v0.11.1
  Downloaded png v0.16.8
  Downloaded rustc-demangle v0.1.18
  Downloaded weezl v0.1.4
  Downloaded ureq v2.1.0
  Downloaded objc-foundation v0.1.1
  Downloaded chlorine v1.0.7
  Downloaded sdl2 v0.34.3
  Downloaded raw-window-metal v0.1.2
  Downloaded rafx v0.0.10
  Downloaded imgui v0.7.0
  Downloaded object v0.23.0
  Downloaded num-iter v0.1.42
  Downloaded adler32 v1.2.0
  Downloaded app_dirs v1.2.1
  Downloaded ash-window v0.6.0
  Downloaded glam v0.8.7
  Downloaded image v0.23.14
  Downloaded float-ord v0.2.0
  Downloaded pathfinder_geometry v0.5.1
  Downloaded rafx-framework v0.0.10
  Downloaded rafx-base v0.0.10
  Downloaded rafx-api v0.0.10
  Downloaded gimli v0.23.0
  Downloaded dirs v2.0.2
  Downloaded colored v2.0.0
  Downloaded git-version-macro v0.3.4
  Downloaded sdl2-sys v0.34.3
  Downloaded ash v0.32.0
  Downloaded tiff v0.6.1
  Downloaded encoding_rs v0.8.28
  Downloaded profiling v0.1.10
  Downloaded imgui-sys v0.7.0
  Downloaded imgui-sdl2 v0.14.0
  Downloaded downcast-rs v1.2.0
  Downloaded clipboard v0.5.0
  Downloaded addr2line v0.14.1
  Downloaded semver v0.9.0
  Downloaded gif v0.11.2
  Downloaded font-kit v0.10.0
  Downloaded deflate v0.8.6
  Downloaded lock_api v0.4.2
  Downloaded convert_case v0.4.0
  Downloaded cmake v0.1.45
  Downloaded rustc_version v0.2.3
  Downloaded dirs-sys v0.3.5
  Downloaded 75 crates (9.5 MB) in 1.23s (largest was `profiling` at 1.7 MB)
   Compiling libc v0.2.91
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.0.1
   Compiling cc v1.0.67
   Compiling lazy_static v1.4.0
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling bitflags v1.2.1
   Compiling syn v1.0.67
   Compiling memchr v2.3.4
   Compiling log v0.4.14
   Compiling adler v1.0.2
   Compiling serde_derive v1.0.125
   Compiling crc32fast v1.2.1
   Compiling regex-syntax v0.6.23
   Compiling serde v1.0.125
   Compiling core-foundation-sys v0.8.2
   Compiling untrusted v0.7.1
   Compiling spin v0.5.2
   Compiling foreign-types-shared v0.1.1
   Compiling tinyvec_macros v0.1.0
   Compiling matches v0.1.8
   Compiling glob v0.3.0
   Compiling version_check v0.9.3
   Compiling scopeguard v1.1.0
   Compiling ryu v1.0.5
   Compiling percent-encoding v2.1.0
   Compiling unicode-width v0.1.8
   Compiling block v0.1.6
   Compiling humantime v2.1.0
   Compiling vec_map v0.8.2
   Compiling termcolor v1.1.2
   Compiling bindgen v0.57.0
   Compiling serde_json v1.0.64
   Compiling base64 v0.13.0
   Compiling ansi_term v0.11.0
   Compiling unicode-segmentation v1.7.1
   Compiling strsim v0.8.0
   Compiling encoding_rs v0.8.28
   Compiling itoa v0.4.7
   Compiling once_cell v1.7.2
   Compiling lazycell v1.3.0
   Compiling rustc-hash v1.1.0
   Compiling byteorder v1.3.4
   Compiling chunked_transfer v1.4.0
   Compiling peeking_take_while v0.1.2
   Compiling shlex v0.1.1
   Compiling cfg-if v0.1.10
   Compiling rayon-core v1.9.0
   Compiling either v1.6.1
   Compiling smallvec v1.6.1
   Compiling semver-parser v0.7.0
   Compiling glam v0.8.7
   Compiling version-compare v0.0.10
   Compiling downcast-rs v1.2.0
   Compiling fnv v1.0.7
   Compiling adler32 v1.2.0
   Compiling arrayvec v0.5.2
   Compiling chlorine v1.0.7
   Compiling proc-macro-hack v0.5.19
   Compiling xml-rs v0.8.3
   Compiling gcc v0.3.55
   Compiling sdl2 v0.34.3
   Compiling weezl v0.1.4
   Compiling color_quant v1.1.0
   Compiling same-file v1.0.6
   Compiling roots v0.0.6
   Compiling gimli v0.23.0
   Compiling xmlwriter v0.1.0
   Compiling scoped_threadpool v0.1.9
   Compiling bytemuck v1.5.1
   Compiling object v0.23.0
   Compiling convert_case v0.4.0
   Compiling rustc-demangle v0.1.18
   Compiling float-ord v0.2.0
   Compiling strum v0.20.0
   Compiling app_dirs v1.2.1
   Compiling libloading v0.6.7
   Compiling libloading v0.7.0
   Compiling instant v0.1.9
   Compiling foreign-types v0.3.2
   Compiling tinyvec v1.1.1
   Compiling unicode-bidi v0.3.4
   Compiling lock_api v0.4.2
   Compiling textwrap v0.11.0
   Compiling form_urlencoded v1.0.1
   Compiling cmake v0.1.45
   Compiling miniz_oxide v0.4.4
   Compiling crossbeam-utils v0.8.3
   Compiling memoffset v0.6.3
   Compiling num-traits v0.2.14
   Compiling rayon v1.5.0
   Compiling num-integer v0.1.44
   Compiling num-iter v0.1.42
   Compiling num-rational v0.3.2
   Compiling nom v5.1.2
   Compiling itertools v0.9.0
   Compiling miniz_oxide v0.3.7
   Compiling semver v0.9.0
   Compiling heck v0.3.2
   Compiling walkdir v2.3.2
   Compiling clang-sys v1.0.1
   Compiling gif v0.11.2
   Compiling ash v0.32.0
   Compiling xmltree v0.10.2
   Compiling unicode-normalization v0.1.17
   Compiling nfd v0.0.4 (https://github.com/raphlinus/nfd-rs?rev=5e09b79bf511e3a91ae8cefdb96e9734fa4a79c2#5e09b79b)
   Compiling addr2line v0.14.1
   Compiling ring v0.16.20
   Compiling vk-mem v0.2.2
   Compiling imgui-sys v0.7.0
   Compiling rustc_version v0.2.3
   Compiling glifparser v0.0.0 (https://github.com/MFEK/glifparser.rlib#1d902863)
   Compiling mfek-ipc v0.0.0 (https://github.com/mfek/ipc#c0b924d5)
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /Users/dcrossland/.cargo/git/checkouts/glifparser.rlib-8a794fa86f0b184f/1d90286/src/lib.rs:1:1
  |
1 | #![feature(assoc_char_funcs, let_chains)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: could not compile `glifparser`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
%

Add a quadratic pen

Would appreciate @eliheuer telling me his favorite style of quadratic pen so I can just implement that. The current pen is cubic Bézier only, attempting to use it in a quadratic glyph will cause an assertion error, intentionally.

Switch to SDL2, drop `winit` ASAP. Point numbering broken, console broken on Linux due to `winit` kbd implementation being bad.

This says it all:

https://github.com/rust-windowing/winit/blob/386ead15a3e3fef5c0c02bd7491d3cc9a7a6e0aa/src/platform_impl/linux/x11/events.rs#L178

//ffi::XK_numbersign => VirtualKeyCode::Numbersign

🤦‍♂️🤦‍♂️🤦‍♂️ 😱❗❗❗

Issue discovered by @eliheuer in his Twitch stream. Confirmed and cause found just now by @iwsfutcmd.

I don't trust any software with code like this commented out period. They have no idea what they're doing in my humble opinion. The fact that Subtract and Minus were only recently unified is shocking as well.

So, this is an urgent issue. I had hoped not to need to rewrite main.rs again, but I don't mind given the severity of their keyboard handling.

SDL2 supports Unicode input, so console will still work without much worry about hooking OS APIs for IME's etc.

can't compile skulpin-renderer

Hey.

I am not a coder, so I'm likely doing something wrong here, but I can't compile due to this error

error[E0308]: mismatched types

it tells me in my .cargo/registry/src/github.com-1ecc6299db9ec823/skulpin-renderer-0.4.1/src/skia_support.rs file it's expecting Option<unsafe extern "system" fn() -> c_void> and only finding Option<unsafe extern "system" fn()>

seems really silly to me because when I look at the skia_support.rs file it reads "Option<unsafe extern "system" fn() -> c_void" which is what it's claiming to want it to say so IDK what it's on about here.

I'm running rustc 1.52.0-nightly

let me know if there's any other info you'd need from me.

lovely project, truly the font editor we all need

Change internal representation of background images.

Currently the way we store images is problematic in a few ways. We're holding an affine matrix that represents the image transform, which works, but decomposing this matrix back into scale, rotation, shear, etc. is somewhat complicated and introduces rounding errors.

I'd like to change it so if we load an existing image from a UFO it maintains it's matrix, but when a user adds a new image through MFEK we keep scale, shear, rotation, etc. as separate variables the user can modify and then composes the matrix each frame. This allows users to easily specify very specific angles they want the image to appear at, and does not introduce rounding errors to the values the users see on the user interfaces (ex 45 -> 45.00006 after decomposition). On export we'd compose an affine matrix out of these values and store it in the standard manner for UFO images.

On the topic of a user importing images the image would not be able to be modified in this way until the user clicks a button to clear the existing matrix, and then our method would take over from there.

Save via git

While writing #103 (comment) I was reminded that most editors with good plugins get a "replace save() with git.commit()" plugin, and it's possibly so useful to be a good candidate for an out of the box feature.

Lmk if you want links to prior art, but it's a fairly simple concept.

Still, it can go deeper, such as adding auto save with auto commit message, dialog to capture commit messages, advanced UI for file and even line selection, stash, branching and tagging, push/pull.

Possibly this is related to the inotify hot reload of UFO stuff, since checking out another commit will trigger that, etc

Sometimes when exporting the layer 0 in the UFO data does not match that in the JSON MFEK data.

We're considering abandoning the idea of using the UFO file format as our internal format, and simply using JSON that's converted back upon export. The problem being when external tools are used they might modify layer 0 and make MFEK data attached to that layer. There are two ways to solve this problem:

  1. Check our internal layer 0 against the UFO layer 0 and prompt the user to clear the associated MFEK data.
  2. Abandon the idea of trying to maintain a UFO compatible layer 0 and save only in JSON format until export.

Add console

@eliheuer suggested I make some issues so people know my plans.

Pressing : should open a console, similar to Yakuake and Vim. You type a command, like :selectall or :set CLEAR_COLOR 0xff_000000, pressing enter executes command.

Qglif will not have menus, it will only have hotkeys and a console.

Filter the guidelines in `MFEKGlif` during save

ascender and descender are inserted into MFEKGlif's guidelines field during loading by MFEKmetadata. They aren't actual user-added guidelines and shouldn't actually appear in files if they aren't parented.

This bug is minor but causes two strange effects…

It causes more and more guidelines of these names to be written to the file upon every save. This causes the ascender/descender line to both appear darker, and also probably results in illegal .glif data (oops)

Add GitHub Actions (or perhaps Circle/Cirrus)

Time has come for this; I've inadvertently broken the build on other platforms a few time already.

Trouble is, I've never written a CI recipe from scratch before. Quite embarrassing, yes.

Maybe @eliheuer @jtanx @iwsfutcmd have ideas. (Why didn't you accept invitation to join organization btw Eli? I wanted to assign you to #7.)

Building from release fails

Just a heads up, building this from the release source fails with the following error:

error: git describe failed with status 128: fatal: not a git repository (or any of the parent directories): .git
  --> src/util/argparser.rs:21:40
   |
21 |         .version(&*format!("{}-alpha", git_version!()))
   |                                        ^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `proc_macro_call` (in Nightly builds, run with -Z macro-backtrace for more info)

Probably best to just install it from a git clone anyway but I wanted to share just so you know.

Challenges building while following instructions in readme (false alarms, but leaving this for others)

Context: I’m on macOS 10.15.5 and I wanted to install this to try it out. I had a few hurdles in doing so, and I’ve figured them out but will leave this issue (and close it) in case it helps others who have the same issues.

I was curious to check this out, but after following the directions to install vulkanSDK & rustup, the build was stopped at an error:

   Compiling glifparser v0.0.0 (https://github.com/mfeq/glifparser#e3c77586)
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /Users/stephennixon/.cargo/git/checkouts/glifparser-a0b09305bd94eda1/e3c7758/src/lib.rs:1:1
  |
1 | #![feature(assoc_char_funcs, let_chains)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling aho-corasick v0.7.13
error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: could not compile `glifparser`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

So, I ran rustc --explain E0554 as suggested, and realized that I hadn’t quite followed all the instructions – I hadn’t configured the rust installation to use the nightly toolchain.

So, I ran the build again, and ... I got another error:

   Compiling skulpin v0.10.0
   Compiling Qglif v0.1.0 (/Users/stephennixon/code/Qglif)
    Finished dev [unoptimized + debuginfo] target(s) in 52.55s
     Running `target/debug/Qglif Q_.glif`
[2020-09-13T01:33:18Z DEBUG Qglif::io] Loaded "Q" (U+0051) from Q_.glif
[2020-09-13T01:33:18Z DEBUG Qglif::imgui::support] Building ImGui font atlas
[2020-09-13T01:33:18Z INFO  skulpin_renderer::instance] Finding vulkan entry point
Error during renderer construction: CreateInstanceError(LoadingError(LoadingError(DlOpen { desc: "dlopen(libvulkan.dylib, 2): image not found" })))

I found that this is because I misunderstood the vulkanSDK Getting Started guide. I tried to do the main method of moving the DMG files into a folder within my home directory. However, I had to also do their "Alternate method" of running the ./install_vulkan.py script.

With this, the build worked!

image

Qool! (Dumb joke, sorry.) Looking forward to playing with this a bit. Thanks for making this pretty straightforward for newcomers to build!

updating readme

right now glif won't run unless the .glif file is part of a UFO, the suggested command
RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- examples/Q_.glif
doesn't run right now? (small)

also it needs vulkan drivers, which is mentioned for mac but not included in linux instructions

small in either case, not hard to figure out

Mfek UFO: proportional width cells, etc

(filing here and you can transfer to the ufo repo when you make it public)

https://twitter.com/fr_brennan/status/1397723808191156230?s=19 shows a typical glyph view grid:

20210527_062637

One of the early mocks Eli did for runebender showed proportionally spaced cells,

But the current runebender uses a monospace grid, with eliding longer glyph names and overflow of larger glyphs, like the honorific here:

  • So I think a "scale factor" (like Glyphsapp and Robofont and fontlab have, with a slider on the bottom toolbar, and fontforge has as a set of size options in the view pulldown, as I recall), can be complimented by a
  • monospace default with a proportional toggle, and
  • theming for the background, cell border, cell background, foreground, label bg/fg color, label eliding technique (2+ lines, middle ellipsis, end ellipsis, etc)

Global state idea: Tool-level state

Having the corners, show_sel_box and the new vws_previews and vws_contours in the global state seems hacky, I think I need to come up with some way to have tool-level state, which is set at the time of tool switch.

So maybe each .rs file in events can define a thread-local state variable, containing a different type, and TOOL_DATA can become a reference to the current tool's data, or something.

Maybe tool data state variables should be a HashMap. Gotta think more about this.

Proposal: refactor namespaces so the binary comes out as `mfek-glif`

I would like to setup Arch Linux packaging for this project, but right away I'm faced with some guideline problems. Naming the package is difficult. I would like to propose some upstream reorganization here to make downstream usage more consistent.

The biggest issue is that capital letters in binary names are strongly discouraged. Guidelines on this vary by distro. I know there are a few distros that 100% enforce this and there are some that don't care at all. Arch Linux is somewhere in the middle: it strongly dislikes them but has allowed a few exceptions. For example historical reasons have given X a pass. There are also a handful of others. Many more projects are relegated to keeping their upstream capitalized versions to the side and linking a lowercased version from /bin. For example Virtual Box, whose upstream binary name comes out as VBoxManage is symlinked from vboxmanage.

For Arch Linux packaging, upper casing the name of the package is completely disallowed, I can't even submit a package except in lower case. The binary inside doesn't have to match the package name, but I would probably need to at the very least symlink a lower cased version or more likely just lower case it after build.

I would like to recommend that this project adopt a naming scheme that will be more likely to be implemented with no changes downstream: Lets rename the binary generated here from MEFKglifmefk-glif. That will still leave room for other binaries in the mefk-... namespace. It will also make it easier to search for packages (dashes as separators help by virtue of being valid word boundary so "whole word" searches for glif or mefk will come up positive. The dash notation for subcommands is also pretty widely recognized these days (cf. git-...).

I do realize there is a bit of a hyphen vs. underscore fiasco in progress in the world of Rust crates. Avoiding the whole thing would be the biggest reason to not add the dash, but honestly I think it will be better off

If this is agreeable I'd be happy to put it together as a PR.

Alternatively, simply glif might actually work as a package & binary name. I initially assumed that would be a hard name to claim, but I don't actually see anything in that namespace at all in any major distro.

Better panic hook

A better panic hook that could display the error in a dialog would be good for non-technical users.

We could perhaps package something like a cross-platform zenity, if that exists. Just something that can use native API's to create a quick dialog under any OS. I could easily code one for Windows and Linux, but no clue about OS X. I feel like something must exist. Will look into.

Does not render correctly on OS X

I just tested commit 9b1c006 on Arch with Nightly and it worked without issues.

However, on macOS 10.15 I get a series of errors. It would be nice if this worked well on macOS and I'm happy to be a macOS tester for this editor.

The first error I get reads:

error[E0599]: no function or associated item named `from_u32` found for type `char` in the current scope
   --> src/glifparser.rs:203:23
    |
203 |                 char::from_u32(u32::from_str_radix(unicodehex, 16).expect("<unicode> hex not int"))
    |                       ^^^^^^^^ function or associated item not found in `char`
    |
help: you are looking for the module in `std`, not the primitive type
    |
203 |                 std::char::from_u32(u32::from_str_radix(unicodehex, 16).expect("<unicode> hex not int"))
    |                 ^^^^^^^^^^^^^^^^^^^

I fixed this but got a few more errors and couldn't get it to build, I might try a PR to get it working, but thought I would post the issue first so you know I'm thinking about it.

Thanks!

Add open dialog

A few interesting cross-platform crates exist for this, so I think it's something real simple to do. Let's see though...

This will stop us from needing to just error out if no filename is provided, helping Windows users who may want to just double click Qglif.exe and be on their merry way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.