Better HN
topnewbestaskshowjobs
Log inSign up

raphlinus

14,081 karma · joined Mar 7, 2014 (12y ago) · 1,887 submissions

I do research on fundamental UI technology and 2D graphics, with a focus on Rust and fonts. @raph@mastodon.online
Submissions

comment 7y ago · link · parent

Apologies if this is off topic, but I'm interested in this same question, but with an emphasis on printing quality - one of the main things I want to use it for is proofing fonts. Right now I'm doing most of that on a 4k monitor, but print is the only way to reach really high resolution. I have an inkjet, but it doesn't come close to the quality needed.

comment 7y ago · link · parent

I propose the third generation neutrino be renamed to "tao" in commemoration.

comment 7y ago · link · parent

Pomax is already very well known for excellent technical writing, making arcane topics such as Bézier curves accessible to a wide audience.

comment 7y ago · link · parent

Nativeness is a scale, for sure. Druid tries to be more native in certain ways, such as using platform drawing API's (Direct2D on Windows) when they're appropriate. I think the main reason to choose druid over browsers is simply performance. Also, druid binaries are pretty small, for example the calculator is 792k.

comment 7y ago · link · parent

I'm genuinely curious. Is there a good example of a cross-platform wrapper around platform widgets? That was the original design brief of AWT, which turned out quite bad. Is there a successor which actually gets it right?

comment 7y ago · link · parent

To be clear, we're focusing on the use case of a font editor, where you're mostly interacting with highly custom views, much less so with layouts composed of stock widgets.

As I said elsewhere, increasingly we're in a world where there isn't a standard set of platform UI widgets. I think that was the case when we had Cocoa on macOS, but on Windows it's a choice between MFC, WinForms, WPF, WinUI, and those are only some of the choices offered by Microsoft itself.

It's a good question, though. It's possible somebody will figure out a good way to abstract over officially supported platform UI toolkits, and if so, that might become a compelling choice. This is one reason why the main point of my blog is that we need to figure out the best approach, rather than just assuming we know what to build.

comment 7y ago · link · parent

This is an interesting question, and one I did not directly address. One of the features of Rust is that it's practical to bind it to other languages, so I think writing a "GUI engine" in Rust that's designed to play scripts in other languages is feasible.

That said, it's not the main goal of the druid project. There, we're focusing on writing a real application in Rust. Dealing with language binding issues is hard, and anything that increases the scope too much puts the project at risk.

So if you want a multi-language GUI toolkit written in Rust, asking me is not the way to get that, because I'm not going to build that. But if you want to be part of a community effort to build it, I'd be open to collaboration.

comment 7y ago · link · parent

I also would love to see more discussion of this topic. There are some academic papers on functional reactive programming and so on, but now there's this huge wave of frameworks for declarative UI. I've found that there's a strong convergence on goals (one-way data binding, unification of initial creation and deltas, etc), but huge diversity in the way they're implemented.

And I also agree that IMGUI is one of the most interesting of these, mostly because it's very simple. You'll find makepad (mentioned in my blog post and in comments here) is fairly directly based on IMGUI ideas, but also has the ability to retain intermediate results. Also, I've been admiring the architecture of Jetpack Compose, and feel it's true to the ideals of IMGUI - you can think of it as IMGUI + "positional memoization."

And yeah, it's one thing to build toys and another to build real applications. This is one reason the focus of druid is to build a font editor, as opposed to making a GUI toolkit first and hoping for adoption.

comment 7y ago · link · parent

Using the widget set provided by the platform is not easy, and that's not what druid tries to do. Rather, there's a platform abstraction layer (druid-shell) that takes care of all this stuff for you, and has all that nasty unsafe code in it, then it draws its own widgets. We try to feel more "native" in that we're using platform menus and so on. It's certainly possible to be more native (calling into Cocoa widgets) or less (using Web technology), but I think what we're doing is a good pragmatic approach.

Of course, things have gotten a bit postmodern, even on macOS there is no single widget toolkit, but basically a series of choices of what technology to build on. I'm actually not sure that binding other languages to SwiftUI is going to work well at all, but in Objective-C it works fine, just isn't very smooth. On Windows, I've generally found COM to be quite pleasant, and noises coming from Microsoft suggest that story will become even better.

comment 7y ago · link · parent

Yes. Just based on numbers :)

comment 7y ago · link · parent

The main signal is the locale setting, which can have a list of languages in it. For example, you could have Finnish as your primary language, with Hong Kong Chinese second. Then CJK will get rendered as zh-Hant-HK.

Apps can set locale explicitly to override that, but almost none do. Probably the motivating example is a translation app, which can then render both, say, Chinese and Japanese correctly.

Input methods are technically a separate setting from your locale list, which is maybe confusing but that's the way it is.

comment 7y ago · link · parent

Well, it's O(nm) where m is the number of candidate breaks on the line. The amount of time spent Knuthing and Plassing is not too bad, but where it does hurt you is that you have to measure the substrings with potential hyphenation breaks. And even if rasterization is more costly, layout hurts because often you have to do lots of it in bulk, when materializing new content, where rasterizing usually scales with the number of pixels you have to draw. And in Android that basically has to happen on the UI thread (offloading it to an async thread is theoretically possible but a major pain).

I haven't been involved in day-to-day engineering on Android in 3 years though. Maybe of the current team will feel like chiming in.

comment 7y ago · link · parent

It's disabled in editing, and you're absolutely right about that.

I never got any negative feedback about accessibility problems. My guess is that since they are standard in print sources, they're manageable.

comment 7y ago · link · parent

#text stream in xi.zulipchat.com (requires registration, is open to anybody with a Github account).

comment 7y ago · link · parent

I believe it was the default from Marshmallow through Pie, but as of 10 it's default off because the powers that be decided that performance was more important. And it was actually on even without full justification, as it improves appearance and density for ragged-right text as well. One of the things we tuned is trying to avoid a final line with just one word on it - in that case, it's far more likely to insert a hyphen to avoid that. I think that's really nice in mobile, where screen real estate is at such a premium.

I gave a talk at ATypI 4 years ago on Android typography, it might be interesting: https://youtu.be/L8LD0BM-Vjk

comment 7y ago · link · parent

This is a great reference, but ten years out of date. Unfortunately there is no really good central place to get updated information on this.

For almost five years, I was tech lead of the text stack in Android. There are a few things about the architecture not to like, but overall it is a world-class implementation - it has refinements like hyphenation and Knuth-Plass style paragraph layout, and of course emoji. It also had the benefit of Roozbeh Pournader's work for much of that time, so it gets Unicode and locales right. Among other things, I claim it does one of the best jobs on the "CJK problem" of any stack out there, using both font selection and the locl OpenType feature to adapt rendering for the preferred language(s). It's open source of course, but does suffer from thin public documentation.

Another good source is Chromium, which tends to be a bit more open, with discussions in the bug tracker and published documents, such as https://www.chromium.org/teams/layout-team/eliminating-simpl...

I'm interested in building the next stack in Rust, and have done some work in this direction. I'd love to see solid documentation as part of that effort, but of course writing takes time and effort, and the target audience is quite specialized.

comment 7y ago · link · parent

I think that's fair. We had an experimental collaborative editing prototype running on Fuchsia, but that was never officially part of the scope of the project. So this is all about whether technology developed for multiuser collaboration is helpful for the single user case.

A good example is inserting indentation in response to, say, the "Enter" key. In a synchronous model, this is pretty straightforward. You calculate the indentation as essentially a function of the contents of the buffer and the delta (the insert of the newline), then any other typing gets processed after that. In a CRDT model, the additional typing can be interleaved in any order, and the merge operation has to converge to the correct results. You can think about how bad that is: the user could type a hundred lines of code, complete with complex editing operations including cut and paste, deletions, undo, and then the auto-indent plugin wakes up, calculates the diff, and sends it to the core. Meanwhile, the user has typed another hundred lines, including more cut'n'pasting of the affected lines. This is perhaps unrealistic, but the CRDT model requires it. And I think it is possible to solve it (I wrote some "rope science" articles, then there was more discussion in several issues), but it's a hugely intricate puzzle compared with just applying it synchronously, and the benefit is not worth it. It's quite practical to compute indentation for any realistic source file in under a millisecond, if you've got a nice fast language.

comment 7y ago · link · parent

I think that's overstating it a bit. What I would say is that the CRDT added a lot of complexity, and we weren't able to encapsulate that complexity into an "engine" as was originally hoped.

Previous HN discussion on the mini-retrospective might be interesting: https://news.ycombinator.com/item?id=19886883

comment 7y ago · link · parent

To clarify: it does not lend itself well to ShaderToy, because the computational model is hamstrung by the fact that the threads can't communicate with each other within a draw call. On a more modern GPU platform with compute shaders, you get a lot more of that, and I think interesting things will happen. I'm personally really looking forward to WebGPU, as I think it will make a lot of this stuff much more accessible.

comment 7y ago · link · parent

Memoirs found in a Bathtub, perhaps? One of my favorites.

comment 7y ago · link · parent

This is very cool work, and I'm happy to see it. I've been fascinated with Metamath for a very long time, finding its simplicity extremely appealing, and have also made a number of attempts (under the Ghilbert name) to fix the problems Mario so eloquently identifies. But I never quite got it to gel. It's clear Mario has the technical chops, and I hope this publication gets the MM family a little more academic respectability and notice.

comment 7y ago · link · parent

Monoid homomorphisms for the win. I discussed a very similar approach for computing the length of the longest line in a "rope science" article[1], as well as unquoting strings[2]. In this case, it was very nice to see actual code, and Futhark looks like a good language. For the string unescaping, I used Nvidia's Thrust, which is a templated C++ library; generally pretty similar to the Futhark code, and generally similar results.

[1]: https://xi-editor.io/docs/rope_science_01.html

[2]: https://raphlinus.github.io/personal/2018/04/25/gpu-unescapi...

comment 7y ago · link · parent

Have you met Liam Quin?

comment 7y ago · link · parent

I'm revising Inconsolata, making it into a variable font, and would like to gather data on the variants out there so I can make it satisfy the largest number of users. Feel free to file an issue on https://github.com/googlefonts/Inconsolata simply stating your preference.

comment 7y ago · link · parent

CIELab is not perfect, but is probably Good Enough, especially for the kinds of use cases as described in this article. One of its main flaws is lack of hue constancy, particularly in blue.

There are any number of colorspaces that have been proposed that are better. Some are complex and ad hoc, such as two different releases of CIECAM. Others are relatively simple, such as Jzazbz. IPT also comes up a lot. I think the issue is that there isn't anything resembling consensus on which of these "more perceptually uniform" color spaces we should use. So a bunch of efforts, including freieFarbe, use Lab.

comment 7y ago · link · parent

That was an interesting read, as my relationship with my dad was pretty similar at that age. I was coding image handling systems for newspapers (in 80286 assembly) with my dad handling the business side. We had some success - installations in a few newspapers and some banks in Iceland, but not making real money. The parts about the tension and fights sounded almost exactly like my story. Then I left home at 22 and came to grad school to UC Berkeley, all the way across the country, which was one of the best decisions I ever made.

I'm still doing 2D graphics software! It flows more or less directly from the work I did as a teenager.

comment 7y ago · link · parent

This turns out to be quite hard, because there are irreconcilable differences in the fundamentals of the different proof systems. That said, there's the Dedukti project, which is showing promising interop results between (at least) Coq and HOL style logics, and the work Mario Carneiro is doing trying to bridge between Metamath and more type-theory approaches.

comment 7y ago · link · parent

There's an entire theory of non-computable functions. Probably the most vivid introduction is the "busy beaver function."

comment 7y ago · link · parent

Quotients are not purely constructive, but they are present in Lean as an extension (this is covered in Chapter 1 of the book[1]).

[1]: https://leanprover.github.io/theorem_proving_in_lean/theorem...

comment 7y ago · link · parent

Maybe that wasn't the best way to phrase it, but the question was asked and Prof Buzzard replied basically that in Lean it's straightforward to express quotients, while in Coq you get "setoid hell". This specific statement is at 1:04:20 in the video. The question is at 1:00:02, and is probably useful for context.
1
474849
63