Skip to content

Rewrite artery-font-format in Rust - #2289

Open
RTUnreal wants to merge 4 commits into
masterfrom
riir_poc2
Open

Rewrite artery-font-format in Rust#2289
RTUnreal wants to merge 4 commits into
masterfrom
riir_poc2

Conversation

@RTUnreal

Copy link
Copy Markdown
Collaborator

No description provided.

@RTUnreal

RTUnreal commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

@JulianGro can I ask you to change the Docker images to include rustup and (if you want to) change the workflows to install the Rust toolchain with information from rust-toolchain.toml? You are welcome to push to this branch, as I will not touch it while waiting for the updated images stuff.

@JulianGro
JulianGro self-requested a review as a code owner June 5, 2026 18:42
@JulianGro

Copy link
Copy Markdown
Member

I don't see any way to explicitly install the toolchain in the documentation. However, it looks like it will just use the rust-toolchain.toml automagically? https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file

@HifiExperiments

Copy link
Copy Markdown
Member

it’s very cool that this works but it makes me a little nervous. it seems like we’re swapping a very lightweight dependency for a new dependency on rust and a copy of the library that we now have to maintain, as well as a new language to worry about

@LexiBigCheese

Copy link
Copy Markdown

there's plenty of rust devs on their way, myself included.

@JulianGro

JulianGro commented Jun 6, 2026

Copy link
Copy Markdown
Member

it’s very cool that this works but it makes me a little nervous. it seems like we’re swapping a very lightweight dependency for a new dependency on rust and a copy of the library that we now have to maintain, as well as a new language to worry about

I get what you mean. Integrating Rust seems like a build-system mess waiting to happen. My main worries here are:

  • Not being able to do offline builds in the future, because now we have to pull in Rust dependencies in addition to Conan dependencies.
  • CMake. Since Rust uses a different build system, as far as I can tell. There are certainly questions about if Rust is going to take the right build flags from CMake or Conan.
  • Mixing Rust and C++ making things more complicated rather than easier. I am assuming that we will never end up with a 100% Rust codebase, especially because of our heavy dependency on other C++ projects, such as Qt and v8.

Since this is replacing an external library, maybe we could start the Rust experiment by making this an external library as well and linking against it?

Of course, generally speaking I am more for fixing whatever is wrong with artery-font-format and upstreaming that.

I was going to just wait and see what comes out of this, but this generally seems like a lot of trouble considering that, as far as I understand, this is supposed to just fix one rare crash. Like, if I am involved in this, it takes me away from other things, such as improving things on the C++ side.

There is just too many questions for me to be opposed though. Like, I was opposed to Conan as well, let Edgar cook, and realized that it is just way better than the VCPKG stuff we had at the time. Granted my initial worry of having to maintain it myself came true and the amount of work it entailed was a lot more than it seemed.

@LexiBigCheese

Copy link
Copy Markdown

https://github.com/corrosion-rs/corrosion can be used to put a rust crate into a cmake build script

@HifiExperiments

Copy link
Copy Markdown
Member

maybe I just lack context on the crash? I thought we had the ability to apply patches to dependencies, and this library is so small that I would think that would be preferable. upstreaming a fix would also be nice, though I wouldn’t be surprised if any crash was because of misuse on our side.

I understand the benefits of rust and having started learning it myself a little. but by doing this we’re missing out on future updates to the library (…not that it updates frequently). at least with replacing polyvox we theoretically reduced some complexity…though I’ll point out that also introduced new issues

@JulianGro

Copy link
Copy Markdown
Member

I thought we had the ability to apply patches to dependencies(…)

Yes, we can apply patches through Conan. We don't necessarily need stuff to be upstreamed.

@RTUnreal

RTUnreal commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator Author

it’s very cool that this works but it makes me a little nervous. it seems like we’re swapping a very lightweight dependency for a new dependency on rust and a copy of the library that we now have to maintain, as well as a new language to worry about

The idea is to enable devs to implement/rewrite/replace stuff in Rust if they see the need or wish for it. This is more of a proof of concept, which shows how to do it in practice. I want to replace more components with stuff written by us or crates from the Rust ecosystem, which is easier to integrate than stuff from Conan.

https://github.com/corrosion-rs/corrosion can be used to put a rust crate into a cmake build script

I have seen that, but I choose to implement it manually for the flexibility and because it doesn't support workspaces, iirc, and the official way of integration is FetchContent_Declare. But you are welcome to show me how to integrate it more sensibly.

* Not being able to do offline builds in the future, because now we have to pull in Rust dependencies in addition to Conan dependencies.

Offline builds are possible when everything in cargo was pulled once.

* CMake. Since Rust uses a different build system, as far as I can tell. There are certainly questions about if Rust is going to take the right build flags from CMake or Conan.

The idea is to build static libraries and link them with cmake

* Mixing Rust and C++ making things more complicated rather than easier. I am assuming that we will never end up with a 100% Rust codebase, especially because of our heavy dependency on other C++ projects, such as Qt and v8.

While it might not work for everyone, I believe in some cases it is worth the effort, especially, where correctness is wished or implementation in Rust is much easier to achieve.

Since this is replacing an external library, maybe we could start the Rust experiment by making this an external library as well and linking against it?

Of course, generally speaking I am more for fixing whatever is wrong with artery-font-format and upstreaming that.

That would require a complete rewrite anyway, as the structure of the library is a mess. The reimplementation should be (for our use case) on par with the upstream impl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants