Ben Crowder

Blog: #plotdevice

21 posts :: tag feed :: about the blog :: archive

#drawbot #go #harfbuzz #ink #pagedjs #pdf #plotdevice #press #rust #svg #unicode #working-in-public

Update on Press (the PDF compiler). I haven’t worked on it at all lately, but I wanted to document its current state for history’s sake, and as part of working in public. (I’ve also been sitting on this post for over a year.)

Back in 2017 I did end up re-architecting Press to use Low Ink as an intermediate page description language. In the process, Low Ink changed from a JSON-based idea to this:

:page 11x8.5in
:bleedbox x=0.125in y=0.125in w=5.75in h=8.75in
:fontmap family=helv weight=regular style=normal standard=Helvetica
:yinvert
:push
:translate x=72 y=72

# ascender
:push
:translate x=0 y=1040
:strokecolor hex=#999
:linewidth 0.25pt
:line x1=0 y1=0 x2=1080 y2=0
:stroke
:push
:fillcolor hex=#999
:font family=helv size=14pt
:text x=1085 y=-3 text="ascender"
:pop
:pop

# filled glyph
:push
:translate x=1320 y=240
:fillcolor hex=#000
:moveto x=0 y=0
:pathto x=400 y=300 cx1=120 cy1=300 cx2=140 cy2=300
:pathto x=320 y=200 cx1=540 cy1=300 cx2=320 cy2=180
:lineto x=350 y=350
:lineto x=450 y=250
:lineto x=150 y=0
:moveto x=200 y=200
:lineto x=200 y=250
:lineto x=250 y=250
:lineto x=250 y=200
:lineto x=200 y=200
:fill
:pop

It was intended to be a fairly low-level wrapper on the PDF format, with the idea being that other libraries/apps would provide more ergonomic abstractions on top of it.

I initially used Python because Press started out as a library, but with the pivot to a compiler model, I think Go or Rust would probably end up being a better choice (Rust would make integrating HarfBuzz a bit easier, at any rate).

Potential improvements

To my 2021 eyes, the language design isn’t particularly elegant. I like that the parameters are named (clarity), but for most of the commands there aren’t actually that many parameters, because many of the settings that would normally be parameters are separate commands. For parameters that are clearly unambiguous, the names hamper readability. For example, I think something like this might be better:

:line 0,0 to 1080,0
:fillcolor #345

I’ve also thought that push and pop could potentially be clearer as curly braces, and that the initial colons aren’t really necessary:

{
  translate 0,1040
  strokecolor #999
  linewidth 0.25pt
  line 0,0 to 1080,0
  stroke

  {
    fillcolor #999
    font 14pt helv
    text 1085,-3 "ascender"
  }
}

The future

My initial reason for building Press was to have an easy, programmable cross-platform way to create language chart PDFs (so I could move away from PlotDevice/DrawBot), and what I’ve realized (acknowledging that I haven’t really been making language charts in recent years) is that there are some other, better options now.

One that seems decent is SVG, converted to PDF by way of Inkscape. Initial tests here seem like it would probably work fine.

Another promising option that I admittedly haven’t looked into very much yet is Paged.js. HTML and CSS are already great for declarative typesetting, and the more I’ve thought about programmatic typesetting, the more this model seems to be the future I’d want to work with (and not just because of parity with web, though that makes it much more compelling).

tl;dr I don’t see myself continuing on with Press, so we may as well call a mortem on it.


Reply via email or via office hours

#design #note-paper #plotdevice #releases

Just posted some note paper PDFs which I made in PlotDevice. There’s lined paper — 30 lines/page up to 130 lines/page (for those who write really, really small) — and graph paper — 10×10 up to 140×140.


Reply via email or via office hours

Ugaritic alphabet chart

#charts #languages #plotdevice #ugaritic

After a year-long hiatus, I’m starting to get back into making language charts. Today’s offering is an (admittedly obscure) Ugaritic alphabet chart:

ugaritic-alphabet.png

Reply via email or via office hours

Bubbles

#art #photoshop #plotdevice #python #pythonista

Playing around:

bubbles.jpg

I wrote the circle chording code on my phone in Pythonista, then ported it to PlotDevice, fleshed it out, and textured it in Photoshop.


Reply via email or via office hours

#cffi #coding #harfbuzz #icu #plotdevice #press

After a break of several months, I’m getting back to working on Press. Status is pretty much the same as last time I posted about it. (It’s actually even a little more behind than that, since I had HarfBuzz Python bindings working then, but now — after upgrading to macOS Sierra — I’m running into issues with PyGObject’s introspection module. I may end up having to write my own HarfBuzz bindings with CFFI. We’ll see.)

The high-level roadmap right now: get font embedding to work correctly, add support for embedding images (which should be fairly easy, I think), integrate ICU for language analysis and HarfBuzz for shaping, and add color space support.

As of now, I plan to use Press for making language charts (which I’ve been using PlotDevice for) and picture books. Once it’s to the point where I can do that, then I’ll start on Ink (low-level typesetting engine, intended for typesetting books, and higher-level rule-based engine for making it easier to work with).


Reply via email or via office hours

Russian alphabet chart

#charts #languages #plotdevice #russian

Just finished the aforementioned Russian alphabet chart:

RussianAlphabet.png

It’s available in PDF as usual.


Reply via email or via office hours

Ink

#coding #ink #opentype #plotdevice #rust #tex #typesetting

As mentioned on Twitter, I’ve decided to write my own typesetting engine, called Ink. Apparently I’m crazy.

The details are still very much in the air, but here are some quick notes:

  • Written in Rust (for speed)
  • Programmatic (sort of like TeX)
  • Scripting language for extensibility (JavaScript or Lua or Python)
  • Intended for use in typesetting book interiors, covers, and charts
  • Possibly some kind of template/data division
  • Full OpenType feature support (shaping via HarfBuzz)
  • Custom PDF generation library (inkpdf)

Reasons for doing this insane thing:

  • PlotDevice only runs on OS X and I want the source of my language charts to be usable on other platforms.
  • I’d like to open source the books I typeset, so InDesign isn’t a great solution.
  • TeX is powerful and well-seasoned and all, but it’s not exactly pleasant or easy to work with, especially for the kind of stuff I do.
  • I’ll learn a lot and have fun while I’m at it.

The initial roadmap, not necessarily in order:

  • Write inkpdf in Python (which I think will be a better fit for the charts anyway)
  • Get familiar with HarfBuzz
  • Learn Rust
  • Port inkpdf to Rust
  • Plan out the Ink language (I’ve started on this and it’s looking promising)
  • Figure out how scripting is going to work and embed the interpreter

I’ll document the process on this blog, of course. First steps: reading the PDF spec and figuring out how to make PDFs by hand.

(For those who’ve been reading for a while, Ink was also the name of my static blog engine. That’s now ink-static, and at some point I’ll either retire it completely or change the name to something unrelated.)


Reply via email or via office hours

Snakes

#cg #photoshop #plotdevice

A new piece, “Snakes”:

snakes.jpg

Detail:

snakes-detail.jpg

The code is on GitHub, and as I’ve also posted a few process pics to Twitter (which I think I’ll continue doing).


Reply via email or via office hours

Circlecells

#cellular-automata #cg #photoshop #plotdevice

Yesterday’s generative art piece, called “Circlecells” (these names are amazing, I know):

circlecells-01.jpg

Detail:

circlecells-01-detail.jpg

The code is on GitHub. I also posted a few process pics to Twitter yesterday. There are also three other accompanying pieces in the set generated with different seeds: 02, 03, 04.

Explanation:

  • There’s a 20×20 grid which gets populated with an initial seed population of living/dead cells. (I get a random value between 0 and 5; if it’s 0 or 1, the cell is alive.)
  • The lines are drawn from any living cells to any immediately neighboring living cells.
  • The size of each circle is dependent on how many living neighbors the cell has.
  • The initial round is drawn in light tan, then the grid is run through a modified Conway’s Game of Life (any cells with 2, 3, or 5 living neighbors are alive in the next round).
  • Two more iterated rounds are drawn, one in a slightly darker tan and the last in dark red. (Drawing is done with the multiply blending mode.)
  • I textured the piece in Photoshop afterwards, using some Kyle T. Webster brushes — add canvas, add noise, encaustic grit, a couple others that I can’t remember.

Reply via email or via office hours

Sahidic Coptic alphabet chart

#charts #coptic #languages #plotdevice #worksheets

Today I’m releasing a Sahidic Coptic alphabet chart and worksheet. The chart:

SahidicCopticAlphabetChart.png

And the worksheet:

SahidicCopticAlphabetGradedWorksheet.png

Reply via email or via office hours