The 2024 Wheel Reinvention Jam just concluded. See the results.

Jam Submition - Scroll, a experiment in a non text typesetting file format

The team

The team and what everyone did

Samuel Deboni - Editor and file format

Igor Fagundes - Editor and file format

Henrique Hiram - PDF exporter

Gleiston Assis - PDF exporter and file format

About the project

We experimented with a non text based typesetting format, the result was a file format we called Scroll, and the respective editor Scrolled.

The main idea was to have a easy to use editor like a Word processor, but with a more structure format like LaTeX, and thinking about it the best way to represent such thing is with a non text file format.

The result was a hierarchical file with the structure

Chapters -> Topics -> Sub Topics -> Sub Sub Topics ->
Paragraphs -> Words -> Characters

The editor

screenshot.png

The editor is written using Odin, SDL and SDL_ttf for rendering, and has about 3kLOC.

Here is the editor working.

Loading a file

gif_0.gif

Navigating

gif_1.gif

Some Editing

gif_2.gif

PDF Exporting

We could not finish the PDF exporter, so the result is not very good, but here is what we have so far.

gif_3.gif

The result

We are very happy with the result and we already can think about new features to add, in case we continue working on this project.

One thing I realized is that after the base editing was done, because the structured nature of the file format, adding things to the rendering like bold and Italic or colored text was very easy, and I want to experiment with new layouts and features.

Going forward

If we decide to continue with the project, the first think to do will be to finish the PDF exporter, and do a major rewrite on the editor. Right now the editor still has some bugs, and wee need to create a solid foundation to keep working. Right now we use the best memory management strategy known to man, allocate and forget.

After that I'd like to explore and push this idea. After all typesetting is a big topic, right now it is only text, but we can add images, mathematical symbols and so much more.

Build

Here are builds for windows and linux. For the linux version you need to have installed in your system SDL2 and SDL2_ttf, it was only tested on Arch Linux, it may not work on other distributions.

scrolled_windows.zip

scrolled_linux.tar.gz

Keyboard shortcuts

The navigation is not very good, but here are the keys

  • Arrow Up / Scroll Up -> move the cursor up
  • Arrow Down / Scroll Down -> move the cursor down
  • Arrow Up / Scroll Up + LShift -> increase level
  • Arrow Down / Scroll Down + LShift -> decrease level
  • Ctrl + N -> Split Topic
  • Ctrl + J -> Join Topic
  • Ctrl + B -> Toggle Bold
  • Ctrl + I -> Toggle Italic
  • Return -> New paragraph or split pargraph
  • Backspace -> Delete character

It is also possible to navigate the paragraphs using the left panel.


Edited by Samuel Deboni Fraga on Reason: Added builds

I tried it a little, and got a bit confused, so here is a little bit of feedback.

The main reason I got confused (I think) is that it's a bit hard to see at which level of the hierarchy I'm at. Am I in a Chapter, topic, sub topic... And since the default movement doesn't allow you to go to the thing directly above me (at least that's what I understood) it was hard to navigate.

A second thing, is that as far as I understood, to get a paragraph, I need all level that come before a paragraph, which seems unhelpful from my point of view. What if I only want a "Title" and a paragraph ?

I agree that the navigation is confusing, I tried to do something different compared to standard editors (Switching levels), but it did not work that well, maybe it just need to be polished more, since this was done late in the jam.

You need all the levels to simplify the file format, but you can have a "gost" level if the title is blank, so It is only rendered if you have a title, that way it is possible to have a "title" and a paragraph.

Thanks for the feedback :)


Replying to mrmixer (#25293)

I'm so glad to see that someone tackled typesetting in this jam.

What led you to the particular hierarchy you have here? It sounds fairly reasonable but perhaps a bit limited, or overly structured in some sense. For example an academic paper might not have chapters, but it possibly might have topics. What does the structure accomplish for you and what features might it enable in the future?

Also you say this is a "non text based typesetting format" - what about it is not text-based?

This particulate hierarchy allow to have a very simple file structure, each layer is a plain array on disk, so it is very easy to read and write.

It is a bit limited, and to allow more flexibility you don't need to use all the levels. For example, it is possible to have a "ghost" chapter for example, it exists, but it is not rendered, so you can have a academic paper with one ghost chapter and many topics. A Topic can have a ghost Sub and Sub Sub topics, so looks like a topic with many paragraph.

I feel like this idea was not explained very well, but the user should not need to worry about that, in the editor it will look like a more flexible struct.

One thing about the format is that it only specify the structure of the data, not the layout, so in the future I plan to be possible to create layout data, to easily control how It is rendered, maybe even allowing to override the global layout in each layer.

It is non text based in the sense that it is not something like markdown or latex, a text file that needs to be parsed. It has structured data in the file, and at the end of the file there is a heap, strings that are refereed to by each word. For example, a word is a struct that has some flags, a color and a pointer and size to a string.


Replying to bvisness (#25346)