ifrost / afterwriting-labs

Post-processing for Fountain screenplays
http://www.afterwriting.com
226 stars 38 forks source link

CLI: The way to load fonts is arcane and doesn't seem to work #101

Closed earthbound19 closed 3 years ago

earthbound19 commented 5 years ago

In my opinion, requiring two JSON files passed as CLI switches just to use a custom font is forbiddingly (frankly absurdly) complex, and it doesn't seem to work.

command: afterwriting --source source.fountain --overwrite --pdf --config ThisCustomConfig.json --fonts ThisCustomFont.json

--populating both config files as directed here

Error:

undefined:2
    font_family: "ThisCustomFont"
    ^

Why isn't that defined? I followed directions to the tee. Is it looking for the JSON files in the installed path and not the path I invoke it from (alongside a .fountain file I'm attempting to convert to pdf)?

It would be great to just pass four font file names (base64 encoded or not) on the CLI and let the computer do everything else.

jrbostic commented 5 years ago

Are you formatting json correctly? Don't you need quotes around the font_family key? If not that... Are commas in the proper places?

But I think you're conflating two issues. One issue is whether your config json is parsing correctly. The other is whether your font file is pathed correctly.

jrbostic commented 5 years ago

If you're interested in context... https://github.com/ifrost/afterwriting-labs/issues/93

That's the issue where this feature was discussed... Should explain why it's implemented in that way. It also has links to Atom Fountain package issue through which you can view the PR that integrated this particular feature into a dependent project.

rcentros commented 5 years ago

I'm having the exact same issue as earthbound19. In my case I understand it's just my total ignorance, but I don't know what I'm doing wrong (and I have been trying to figure this out). I would really like to use Courier Screenplay with 'Afterwriting. Is it possible for someone to post a sample config.json and myFont.json file that works? I think then I could figure out what I'm doing wrong. Thanks.

I should also ask ... are there any other prerequisites? Somewhere I read that you needed to build a customfont.css but I'm guessing that was for HTML. But I was wondering if that something like this is assumed in the instructions? (I'm guessing not, but I just wanted to check.)

jrbostic commented 5 years ago

@rcentros I'm sorry, I don't have time at the moment to try and improve on this feature... However you can find a working integration of the custom font behavior in the atom-fountain package source code. Here's a link to the PR where it was initially integrated: https://github.com/superlou/fountain-atom/pull/60

Hope that helps!

rcentros commented 5 years ago

@jrbostic Hi — first, definitely no need to be sorry. I'm extremely grateful for 'Afterwriting (in all three of its configurations, the Web, the Offline Web and the CLI versions) and I try to point people to it all the time. My issue is not with how this alternate font feature is implemented, but how to use it. (But I can see I'm posting in the wrong place — I don't know if there is a "right" place though.) I just think I'm putting the wrong information into the two scripts. I don't know what to take literally and what is a placeholder. I'll keep looking and try to learn a bit more about .json configuration files. Again, thank you.

earthbound19 commented 4 years ago

@rcentros and @jrbostic thanks for your replies, sorry I missed them, I'll have a look.

piersdeseilligny commented 4 years ago

betterfountain, whose PDF Renderer is based on afterwriting's, uses the non-standard Font: title page key, which allows the use of any font installed on the computer (e.g.Font: Courier Prime). Maybe afterwriting could use the same thing?

ifrost commented 3 years ago

The way fonts can be embedded changed in version 1.17.2. The JS file containing the font description can be now generated using a separate script. For more details please check: https://github.com/ifrost/afterwriting-labs/blob/master/docs/clients.md#custom-fonts