Mikko Mononen
@mikkomononen.bsky.social
460 followers 200 following 670 posts
Coder and woodworker. Author of Recast&Detour and NanoVG. Previously at Epic Games, Unity, Tinkercad, Crytek, demoscene. https://github.com/memononen
Posts Media Videos Starter Packs
mikkomononen.bsky.social
I saw the mastodon thread too after posting :) libffi definitely sounds like less pain than rolling your own.
mikkomononen.bsky.social
Some assembly is likely required, but you should get things figured out from the x64 calling convention.
learn.microsoft.com/en-us/cpp/bu...

If you have control over the function, I'm sure you'll have easier time if you pass the params using a pointer to struct to the function.
x64 Calling Convention
Learn about the default x64 calling convention that one function uses to make calls into another function.
learn.microsoft.com
mikkomononen.bsky.social
Curious to see where you take the editor. Especially since it's so purpose built for specific state of mind.

I have been digging into the details if text edits the past 10mo and there's so much that we take for granted.
mikkomononen.bsky.social
Sounds good. I wish choosing a license was as fun as choosing the name for your project. I tend to moodswing between zlib and mit out of old habits.
mikkomononen.bsky.social
Not sure about the diagnosis... but I always roll my hoodie cuffs.
mikkomononen.bsky.social
p.s. that cursor looks so juicy, I'm sure it makes you type at least 100% faster :)
mikkomononen.bsky.social
I stole that immediately too :) I have tried it earlier and failed, I did not realize it was due to the hash in the contents.

I've been looking for a simple syntax highlighter for my text rendering/editor project example, and depending the license you choose I might borrow some ideas.
mikkomononen.bsky.social
I guess I'll sleep on it.
mikkomononen.bsky.social
The flat I have setup is definitely usable, but makes the spacing a bit clunky.

It's definitely solvable, but solutions are potentially unorthodox.

One option would be to treat all the list items as one section for vertical padding, and add another option for spacing between same type of blocks.
mikkomononen.bsky.social
So where to put the space around the list?

This is often solved in rich text editors by having a block for the whole list, and then a block of each of the list items (kind like you'd do it in html).

That is, hierarchical data. I want to avoid that to keep things simple, and to keep the scope sane.
mikkomononen.bsky.social
Which in turn allows stuff like lists.

Lists are a bit tricky, though. You want to style them for:
- line height, green (easy, already supported)
- space between list items, yellow
- space around the list

The whole list kind reads like a single paragraph, but actually each list item is a block.
mikkomononen.bsky.social
The API currently allows you to add a list of content, like a piece of normal text followed by piece of bold text.

I've been extending that API so that it allows you to define start of text blocks too, which allows to add attributes for things like padding/indent, and align per paragraph.
mikkomononen.bsky.social
I've been working on paragraph styling support for skribidi.

My goal is to support roughly markdown for the rich text rendering and editing.

I'm trying my best to not make things complicated. For example I really would like to avoid adding hierarchy to the text.
mikkomononen.bsky.social
The extra size and alignment make things big quick. Especially if you have structs in structs kinda situation.
mikkomononen.bsky.social
I think the building blocks are there. Could be a good exercise.
mikkomononen.bsky.social
I might add/expose the concept of paragraph in some cases to make things a bit easier to style and handle. I'm thinking stuff like indentation or bulleted lists, or some other styling that applies to whole paragraph.

Empty paragraphs are annoying when the styling is attached to text.
mikkomononen.bsky.social
I'm still mulling over the scope of the rich text editing for Skribidi. The goal is not to be word, but rather some subset of markdown.

There are some things that would be simpler if I added some kind of "document model", but for the sake of keeping things simple, I really don't want to do that.
mikkomononen.bsky.social
Since the slant of the caret comes from the font, the whole process involves font selection too. Which means a bit more state has to be stored somewhere, etc.

Details, details...
mikkomononen.bsky.social
As you move your caret, the movement will pick the current style from the character before the caret (or first character on line).

But... you can change this style. Like in the example above, I pressed ctrl+I to make the current style italic.
mikkomononen.bsky.social
There were two things that were tricky in that case.

1) The caret inherits the style from the character before the caret position. Since I handle caret placement in visual order this was a bit tricky.

2) The caret previews the current text style. Current text style is separate state from the text.
mikkomononen.bsky.social
For the past weeks I have been writing and refactoring things to get rich text editing to work in Scribidi. It's so close now.

There are always tons of small details, like changing the caret to preview the italic/oblique.
mikkomononen.bsky.social
Yes, maybe more like a mellow accordion yoda vibe:
www.youtube.com/watch?v=ZS01...

"... geet the fuuuck out of my waaay, I'm coooming o-on my waaay..."
Bandoneon bit: Force Theme (from Star Wars)
YouTube video by Jackson Parodi
www.youtube.com
mikkomononen.bsky.social
Now you make me second guess my implementation :D AFK, but it should be close to windows/chrome, with some additional stops around bidi changes. Anyways, it's a bit of a brain scratcher code.
mikkomononen.bsky.social
Day you have:
Kiss|a
Koira

And current location is 4/left.
Press right -> 4/right (end of first line)
Press right -> 5/left (start of next line)
So there's extra stop at end of line.
mikkomononen.bsky.social
IIRC i handle line start/end specifically in skribidi. That is, at line end i also stop at leading edge of last char before continuing to trailing edge of next char. It's tricky to get right, especially with bidi. Rewrote the logic billion times.