November Update

By Martin Fouilleul — 2024-11-13

Hi! As always I’m long overdue for an Orca progress update, but don’t get fooled by the relative quietness of yours truly. There’s quite a lot of work in progress on Orca at the moment.

Wasm Interpreter and Debugger

I continued working on the new WebAssembly interpreter, which now passes all tests of the standard suite! So it’s pretty much feature-complete (more so than wasm3), but I still want to do a pass on bytecode optimization and runtime perf before integrating it as the new wasm backend.

I also began work on the wasm debugger. So far we can single step and set breakpoints through both the wasm bytecode and our internal register-based, direct control flow bytecode. The following clip shows tabbing between the two representations, stepping inside a callee, and stopping at some breakpoints, with the content of the registers updating accordingly.

I also have line info parsed from the DWARF sections of the wasm module, so I’m pretty close to have source line stepping as well.

Text Layout API

I took a break from the insanity of DWARF by venturing into the insanity of Unicode. My heart still sways as to which is the ugliest baby.

Anyway our current text API is pretty much a toy API designed to quickly get going, but doesn’t really let you do anything beside draw and measure a single line of text, and will break if you throw anything with ligatures at it, or most non-latin scripts, let alone bidirectional text.

The new API lets you create lines of shaped text from a unicode string, potentially containing multiple languages / scripts with different writing directions. You can then query that line for text measurement and cursor positionning, and use it to draw the shaped glyphs. For example, the following code draws a line, and then gets the line metrics to draw a box around a range of codepoints.

// Create a text line from bidi text
oc_text_line* line = oc_text_line_from_utf8(arena,
                                            OC_STR8("Hello مرحبا שלום Bonjour"),
                                            &(oc_text_attributes){
                                                .font = font,
                                                .fontSize = size,
                                                .color = {0, 0, 0, 1},
                                            });

// Draw the text line at x,y
oc_move_to(x, y);
oc_text_line_draw(line);

// Draw a box around glyphs between codepoint indices 12 (inclusive) and 15 (exclusive)
oc_text_metrics metrics = oc_text_line_get_metrics_for_range(line, 12, 15);

oc_set_width(1);
oc_set_color(1, 0, 0, 1);
oc_rectangle_stroke(x + metrics.logical.x,
                    y + metrics.logical.y,
                    metrics.logical.w,
                    metrics.logical.h);

Which displays this result:

Multiscript Bidirectional Text

This new API should land very soon into the main, and replace the old simplistic API, with simple helpers for when you need to quickly render a one-off line of text, like

void oc_text_draw_utf8(oc_str8 text, oc_font font, f32 fontSize);

For the current time at least I can offload some work to Fribidi for bidirectional text segmentation and Harfbuzz for glyph shaping. We’re also doing some reordering to support multi-script bidirectional text, and reconstructing graphemes positions from shaped glyph clusters, which is needed for cursor positionning and text measurements.

There’s still a load of work to do! For example I punted on “proper” grapheme segmentation for now because it can get quite hairy. We’ll also need word wrapping and multiline layout, as well as a mechanism for font fallback. Oh, also emoji support 😭 (my unsollicited opinion is that emojis shouldn’t ever have been part of the Unicode standard, but hey). But that will be for a bit later!

Contributors Shout-outs: New Build System, Linux port, Audio API…

Reuben Dunnington has been working on porting our python build scripts to zig build, which will handle caching and incremental compilation for us. Our python scripts had to break the build into multiple sub-commands with ad-hoc caching to handle dependencies, and it was a bit unwieldy, so I’m looking forward to ditching it.

PLD is making steady progress on a Linux port. I’m pretty excited about covering the three major desktop OSes! It will also be a good check that we’re not painting ourselves into a corner if the design of the APIs work reasonably well for several underlying platforms.

Michael Kutowski has a promising fretboard sequencer project, which would make a great Orca app, so audio recording and playback suddenly moved up the priority stack. I started drafting an audio API, and we’ll work together on implementing it. It might take some time because we first need to settle on a wasm multithreading model that works well for Orca. But at least it will be making progress now that we have an actual project to motivate it and test it on.

Ben Visness put out a roadmap here and I’ll try my best to flesh it out and update it as we move forward. Most of the work we do is not immediately visible, and I’m still not 100% sure how to convey our progress on the Github repo, especially since you have to dig through the interface to see work being done outside of the main branch. Github issues alone don’t really convey a sense of temporality, priority, or wether an issue is actually an issue or a planned feature. But we hope the roadmap can provide some sense of what we’re currently doing and what’s next on our plate.

And More!

Not directly related to Orca, but I participated in the 2024 edition of the Wheel Reinvention Jam, with a toy computing environment inspired by Dynamicland. You can read my writeup on this fun one-week project on my personal website or watch the recap stream . My project is a native desktop application, but is built on top of Orca’s native platform layer, as well as its graphics and UI APIs. It’s also an exploration of one possible model for orchestrating interactions between Orca apps once we get closer to the long term vision of the platform. I plan on doing more little research projects and prototypes like this as we move forward.

I’m also reviving the Handmade Meetups in Grenoble after a long hyatus. The first meetup of the new series happened on November 2nd and we had a blast! We met for the afternoon in a cosy co-working space with 5 participants from Grenoble and around, one person even coming from as far as Switzerland! We had awesome demos ranging from 32K Intros, to a hybrid programming/HTML templating language, to an audio synthesizer running on a pinephone and controlled by a custom keyboard. I had a lot of fun, and I’m aiming at hosting these meetup every month starting from January. If you live in the area and would like to participate you can subscribe to the dedicated meetup newsletter or join Handmade Cities Discord.

Speaking of Handmade Cities, we’re closing in on the Handmade Seattle conference. I encourage you to get yourself a ticket to support the organizer and enjoy a gust of high quality conversations with like-minded peers, either online or in-person. Although I won’t demo at the conference this time, I’m looking forward to listen to great talks, catch up with friends and meet new ones. Come say hi if you attend in person!

Like and Subscribe, Click the Bell, etc…

Finally if you want to follow progress on Orca make sure you subscribe to our newsletter if you haven’t already. If you like my work you can also support me on Github Sponsors or on our Donorbox form. Any donation is much appreciated and helps me continue working on Orca!

Thanks for reading, and see you next time~