Comics Builder in GNU Emacs
Generate comics strip from a script in GNU Emacs.
First, create a folder containing artwork. You can use samples from [2]. It should have three subfolders - faces, poses and backgrounds. Images can be GIF, JPG or PNG. Filenames for face and poses follow a convention: <id>-<emotion>.<ext>. Please ensure you have atleast one file for neutral emotion.
Set appropriate values for following variables:
- comics-artwork - Folder containing artwork
- comics-col-max - Maximum no. of columns (default: 2)
- comics-emotions - Alist of emotions and words used to describe them
- comics-avatars - A list of cons cells (FACE-ID . BODY-ID)
Open a file containing the script (sample below) and run M-x comics. This will generate an SVG image for the comics strip which will fit the display window. Panels are rendered with fixed font-size so that it is always readable.
Actors are assigned an avatar from comics-avatars sequentially as they appear in the script. Normally, all the actors are drawn using neutral emotion. If you want to use a specific artwork for an actor in a panel or generic positive/negative emotions, define the same at the end of the dialog as (<face-emotion>/<body-emotion>).
Background image is defined within square-brackets .e.g. [001]
Sample script
A statement is rendered as a Narration balloon
a: Hi
b: Hello
A blank line starts a new panel.
b: I'm happy! (positive)
a: I'm sad! (negative)
Code
https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/comics.el
References
Could you create a video explaining how to make it work for dummies? Thanks!
ReplyDeleteI get "Wrong type argument: listp, "A statement is rendered as a Narration balloon"
DeleteI guess you'd need dom.el from my repo too. The new definition allows string to be identified as a text node.
Deletehttps://gitlab.com/atamariya/emacs/-/blob/dev/lisp/dom.el
Thanks for reporting.
Thank you! I also commented on Reddit, I still got an extra error posted there. Thanks for your help.
DeleteAh...I didn't see a follow-up on the reddit post. So I assumed it was fixed. What's the new error?
DeleteNow I get the following error: "Attempt to shape unibyte text".
DeleteDebugger: https://justpaste.it/8iy2s
You can either apply following patch or upgrade to latest Emacs https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fe903c5ab7354b97f80ecf1b01ca3ff1027be446
DeleteThanks. I have Emacs 27.2 How do I go about applying that patch? I'm not Emacs savvy.
DeletePatching would mean building from sources since it is C code. I guess upgrading to latest version would be a simpler option.
DeleteThanks. Will this affect my current distribution (Prelude) or anything in my Emacs if I upgrade?
DeleteNo, it shouldn't.
DeleteThanks!
Delete