HN user

zhxiaoliang

77 karma
Posts2
Comments34
View on HN

Typst taking 300ms to do 300 pages cannot be seen as 4FPS - you don't treat the sum of 300 pages as single frame, LOL. And laying out a single paragraph is not 1ms for a whole document either. The paper is otherwise pretty good, but these rhetorics are probably not necessary, IMO.

The site has an elegant design and exudes a calming, inviting atmosphere.

I came across a line in the Social Contract that caught my attention: “The platforms that dominate today have drifted from their original promise. Feeds are flooded with content from accounts no one follows.”

I respectfully disagree with that. IMO the problem lies in the opposite direction. The content we see on these sites is driven by algorithms that reward popular posts and influencers. This creates a system of “stars” and “fans,” which does not foster genuine connections.

The original internet promised to give equal voices to all and allow users to see things they might otherwise miss. When I encounter a new social network like yours, especially one as elegant as this, I secretly hope it will restore that original promise.

The author’s memory is remarkable. I hardly remember my own name that far back, LOL. Back then, I knew I would always struggle with those types of interviews, so I always carried a floppy disk with me to them. The disk contained a few programs I had written, and I would simply tell the interviewers, “Don’t give me a quiz. I’m terrible at it, so if you do, I’m out.” However, if they were willing to look at my capabilities, I would share a few of my programs. That approach actually worked most of the time and got me the jobs. The good old days!

Yes, it’s a late addition to that library. The dancing text demo uses the “weighted exclusion” feature of the VMPrint engine, which essentially creates an object composed of horizontal bars. However, the engine also offers another mode that constructs exclusion objects by combining primitive shapes like circles and polygons. This “stick” demo demonstrates that. In doing so, I added a small set of APIs to allow programmatic control over these primitive parts, which essentially turns this into a rudimentary rigging system. I’m uncertain about its practicality in real-world applications, but it was interesting to observe.

I’m glad that you’re trying the Layoutmaster library in your projects. You can also feed it video with a predominantly white background (or any other solid color). Additionally, the video can contain multiple objects, and the algorithm treats them uniformly.

Click (2016) 2 months ago

That’s a cool story! Thx for sharing. Back then programming was rough, but the sense of accomplishment from completing even simple tasks was real and rewarding.

LOL sorry my bad. Should have been more specific. It’s a demo of my layout library. The stick figure is made with a few primitives to form a so-called exclusion assembly which causes texts to flow around them. But what’s unique about it is that these primitive parts can be controlled independently via programmatic control. This turns them into a little rig essentially. I thought it was funny and could be even useful so I shared it.

I feel it's also partly due to the poisonous online culture today. Negativity always prevails, and the loudest voices are the ones that get heard. Showing appreciation has become old fashioned, and creators feel the pressure to “market” themselves or risk being silenced by online platforms or drawn into the noise. It’s simply exhausting.

Click (2016) 2 months ago

Yes. It was 1993 -- there was no Internet to search for anything. The manual that came with Visual C++ could fill a small library, and the program itself came on two dozen floppy disks. And me being a not-so-bright junior programmer didn't help either.

Click (2016) 2 months ago

It was the spring of 1993. UPS dropped a huge package at my door. It was Visual C++ 1.0 in a 50-story-high white box that weighed a ton. I spent the whole day reading manuals and messing with it. When my wife came home that night, I couldn't wait to show her what I finally managed to pull off -- a maximized window that contained a single button that filled the entire space of that window. And the label said "Click Me." My wife clicked that button, and nothing happened.

"What's the point?" she asked.

I said, "You can click it."

"But what's the big deal?" she was baffled.

"You can click it,“ I said.

“That's the big deal."

Hi HN,

Author here.

Tools like Pretext help you avoid DOM reflow by measuring texts without the DOM and returns the height.

Layoutmaster does that too, but it goes beyond a simple measurer and solves the full layout with a real layout engine that’s as fast and as capable as the browser itself. It then hands you the solved layout via “pieces” — fragments with exact coordinates, baselines, and paint metadata for you to easily and precisely recreate the layout in HTML, canvas, or WebGL.

The APIs are stateless and extremely simple, yet they answer all your layout questions. Enamored by the “animated dragon swimming through texts” demo from Pretext? You can easily create that with just a few lines of code instead of hundreds.

form() Given a width, how does this lay out and how tall does it get? No DOM. No rendering. Just pieces.

fit() Given a bounded box, what fits and what overflows? Every character accounted for. Nothing disappears quietly.

plan() Parse once, never re-measure. The same plan drives form(), fit(), and flow() without repeating any work. The Book Masonry demo runs on this.

flow() Content does not always fit in one box. flow() carries text through multiple regions — columns, panels, spreads.

pour() Not every surface is a rectangle. Fill any shape — a circle, a polygon, an image silhouette, a video frame.

produce() Hand it a document. Get back pages. Publishing-grade pagination.

Thank you. The architecture to get an HTML/CSS input layer in front of VMPrint is already there via a component called Transmuter. I have made transmuters to allow markdown with custom syntax support as input, and they work extremely well. Full support of HTML/CSS will be still be difficult, but a well-defined subset should be easy. The sibling Layoutmaster project also demonstrates this -- you can hand it a DOM element and it automatically grabs the styles and contents, converts them into the JSON AST, then feeds them to the engine for instant layout.

VMPrint was a document pipeline and indeed somewhat crossed path with Typst, but I’ve since carved out its engine module, stripped away all dependencies so it's a pure math engine now that can be used anywhere.

My first experiment was to wrap it in a set of APIs called Layoutmaster. They work natively with the browser’s text systems to bypass DOM overflow. It was very fast... faster than the browser in many cases. This made me wonder if it would be faster in Rust so I made a port just for fun.

Turns out, the TS version was fast -- over a thousand pages per second, but the Rust version is quite a bit faster. It's still not fully optimized though. Still working on it.

I have no intention to use it for document generation unless there is a demand for it. For now I’m more interested in how this native engine can help with frontend jobs like creating a native live-editing surface without a browser.

I understand your pain. That’s why I’ve ported my VMPrint layout engine to Rust. It’s early, but it already shows promising performance improvements over the original TypeScript-based engine, which is already very fast. The Rust version can create fully paginated, publishing-grade layout at around 8,500 pages (or 2,000,000 words) per second on a M4 MacBook. It’s even faster at advanced tasks like mixing texts with irregular exclusion fields. The TS version can do it under 1ms, but I don’t have a measure yet for the Rust version. Unfortunately, people have shown little interest in this kind of components, so I’m no longer inspired to release it in its raw form like I did with VMPrint. My plan is to use it to build a native markdown editor first to test it more fully and just to have fun with it, LOL.