graphicore / Atem-MOM-Glyphs-Integration

Make the Metapolator Object Model available in the Glyphs font editor.
GNU General Public License v3.0
0 stars 0 forks source link

Getting started #2

Open schriftgestalt opened 8 years ago

schriftgestalt commented 8 years ago

Here is the basic documentation on how ObjC can talk to Javascript in Webkit.

To get started I think it would be the easiest if there is a global function in JavaScript that gets some arguments and returns the paths (or one of the arguments is a pen object...).

schriftgestalt commented 8 years ago

I put together a sample project that call a function in JS with the caller as an argument. The JS calls a method on the ObjC-object. All in all it requires only a few lines of code in ObjC. I’ll add it to the repo, soon.

That means that the pen approach would be easy to implement.

graphicore commented 8 years ago

That means that the pen approach would be easy to implement.

Ok, cool. I like that.

graphicore commented 8 years ago

@schriftgestalt OK, I updated the repository with a minimal working version.

Here are some directions: https://github.com/graphicore/Atem-MOM-Glyphs-Integration#usage this includes a sample glyph.

Here is the online distributed version http://graphicore.github.io/Atem-MOM-Glyphs-Integration/dist/latest/

When you load the page, it should display nothing. There's some logging going on at the moment, but there should be no errors.

The distributed code is in the gh-pages branch

This should be enough for you to look into it and give me feedback.

schriftgestalt commented 8 years ago

Is there some info about the pen-API?

graphicore commented 8 years ago

It's basically the same as in fontTools (SegmentPen) or RoboFab/ufoLib (PointPen).

Both APIs are defined in here: https://github.com/graphicore/Atem-Pen-Case

For the PointPen see AbstractPointPen

For the SegmentPen see AbstractPen and for some more boilerplate BasePen

Only methods that don't start with an underscore are considered the public API, the rest won't be called from my code.

I don't have any better documentary yet :-/

We could search for documentation of the Python equivalents?

We can also (probably easily) write an adapter pen to connect to your API if it is necessary.

schriftgestalt commented 8 years ago

Can you explain how to get all dependencies? And why does the link to "latest" gives a different page that in the repository?

graphicore commented 8 years ago

Do you know the "Github Pages" feature? If you have a github repository and make a gh-pages branch all of it's contents are published as a public website. The url is constructed like this: {username}.github.io/{repository-name}/{repository files ...} (you can also use your own domain)

The gh-pages branch in this Repository is completely different to the master branch. I just used it for the webhosting feature. You can load the code from there.

Can you explain how to get all dependencies?

You don't need to get any dependencies, the stuff in the gh-pages branch comes with all of them, the most are included in the dist/latest/main.js file and some are in the dist/latest/lib directory.

If you want to build or run it yourself you'll need bower which can be installed with npm which comes with node.js.

To install bower: $ npm install bower -g (-g means global) To install the (development-)server and the dependencies of the build script you have to go to the repository and run $ npm install And to install the application dependencies $ bower install

Then you can use the build script (see README) and the development server ($ ./bin/momglyphs serve app/project.mp -p 8080)

schriftgestalt commented 8 years ago

You are saying that I should work with the version from github directly? That makes debugging very difficult. Would it be possible to put all dependencies in one folder? I don't like to install all those things.

graphicore commented 8 years ago

You are saying that I should work with the version from github directly? That makes debugging very difficult.

OK, then get bower and ...

I don't like to install all those things.

Actually you only need to install nodejs in your system, as npm (node package manager) comes with it. Bower, you can install this within the project, locally:

In the projects repository directory, just do $ npm install bower (without the -g flag) and then it goes into the node_modules directory. To run it you would have to call it like this ./node_modules/bin/bower (the path could be different).

All the npm dependencies you install go into the ./node_modules directory and all the bower dependencies go into app/lib/bower_components directory.

So, besides nodejs there's no system dependency needed, and also that can be installed per user AFAIK.

Would it be possible to put all dependencies in one folder?

In the end that's what npm (node_modules) and bower (app/lib/bower_components) do.