Hacker News new | past | comments | ask | show | jobs | submit | RazrFalcon's comments login

>RustyBuzz is quite limited when compared with HarfBuzz.

As the main author of rustybuzz I'm surprised to hear this. If you need a text shaper, rustybuzz is mostly a drop-in replacement for harfbuzz.

Text shaping and TrueType parsing are hard problems, but Rust does not make them more complicated. Quite the opposite. In fact, rustybuzz is written in 100% safe Rust. I would even go further and say that Rust is the only sane option for solving text-related tasks.


While I do like Swift and wish Rust would look as nice, it doesn't have references and lifetimes. Those two alone make code way nicer.

Anonymous closure arguments, aka $0, are probably the ugliest part of its syntax.

    numbers.contains(where: { $0 > 0 })


You're basically describing Swift:

    public func read(path: URL) throws -> Array<UInt8> {
        let file = try FileHandle(forReadingFrom: path)
        let bytes = try file.readToEnd() ?? Data()
        return Array(bytes)
    }
Yes, the example above is not generic and not even idiomatic Swift, but it's a good glimpse into how Rust could look like.

Hopefully someday Swift would become more safe, less tied to ObjC legacy and actually cross-platform. It's a shame that such a nice language is basically Apple-only.


You are looking for Val I think: https://www.val-lang.dev/


At least Swift exists :)

But sure, there are a lot of interesting languages out there. I would love to use something other than Rust, but there are simply no choice.


A small nitpick as the resvg author: the repo located here https://github.com/RazrFalcon/resvg I'm not sure why the author linked some random, outdated fork. If you're trying to beat SVG, you should have done a better research.

But yes, SVG is extremely bloated and under-documented. Especially SVG 2. The core resvg codebase is close to 20 KLOC, while the whole package is like 50 KLOC.

On the other hand, resvg is an exception, because it doesn't rely on any system and/or 3rd party libraries. 95% of the code in the final binary was written by one person (me). Not because it was strictly required, but because it was fun. resvg is basically an epitome of RIIR.


Oh, hi!

> A small nitpick as the resvg author: the repo located here https://github.com/RazrFalcon/resvg

Oh, i didn't see this. Thanks for some more correct and real numbers, i will correct them in the article later!

> I'm not sure why the author linked some random, outdated fork.

because it appears way higher up on the google search if you search for "svg rendering library". Sorry i didn't recognize that it's a fork!

Nice work then! I should check it out for SVG rendering and parsing.

How much work would it be to port over the C# SVG→TinyVG converter to Rust based on resvg? Considering that you already have a well done parser compared to mine...


>How much work would it be to port over the C# SVG→TinyVG converter to Rust based on resvg?

Probably a day, as long as you know Rust. I can take a look into it if you're interested. usvg (the SVG parser of resvg) is specifically designed to convert a real world SVG with all its quirks into a machine readable, minimal SVG/XML.

One thing to note is that usvg doesn't preserve text at the moment (will be converted into paths automatically) and Quadratic curves.

PS: I also have a longer, but still unfinished rant [0] over SVG complexity if you're interested.

[0] https://github.com/RazrFalcon/resvg/blob/master/docs/renderi...


> One thing to note is that usvg doesn't preserve text at the moment (will be converted into paths automatically) and Quadratic curves.

I mean, that sounds perfect in my ears as TinyVG doesn't has text/font support anyways and you need to perform the conversion at one point or another.

> Probably a day, as long as you know Rust. I can take a look into it if you're interested

That would be rad! I'll try to do that myself as well, but my last experience with Rust is over two years away, so i'd be happy to see a pro doing the work!


Apart from SVG, there are long-standing and well-established formats for vector graphics: Enhanced Metafile (EMF) and Encapsulated PostScript (EPS). Why not use them instead of a new file format?


IIRC EMF is specified as basically “whatever win32 GDI does”, it never was meant as portable format. And PostScript is a Turing-complete programming language - not really a way to make anything simpler, let alone SVG.


RIIR : Rewrite It In Rust.

Just because I had to lookup this, for me, new acronym.


If you're looking for a small, fast CPU-based 2D library, you might be interested in https://github.com/RazrFalcon/tiny-skia

Just like Skia, all pixel accesses is SIMD accelerated.

It doesn't have C bindings, but they can be trivially implemented.


Ah, that's the thing.. I don't have a reason/need for using a fast 2d library. It's that Pixie's Nim API makes me want to have a reason. Like maybe it'd be fun to write a modern plotting backend with it! Currently even one of Julia-lang's best plot backends uses a C-based plotting library, GR [1]. It's a pain to use from raw C bindings though. :/ Also while Rust is great, I'm too lazy to program in it. All them `& mut<RC<box<mything>>` things. ;) (Yes I know that's not real Rust code...) Though tiny-skia does look like a well done library!

1: https://gr.readthedocs.io/


I'm sure you will be interested in https://github.com/RazrFalcon/resvg-test-suite

From a quick glance, pixie should pass 10-20% of those tests. Yes, SVG is that complex.


Well, it's based on SVG, which is also RGBA8888 sRGB only (effects can optionally use LinearRGB).


>because they support binary dependencies

Without an ability to tweak build flags. Which makes them useless. And since they are not really crossplatform either, you better stick with portage, which is still far behind cargo.


So useless, that they get used daily by millions of C++ developers, and was one of the top requested features for vcpkg.

Sword fighting gets tiresome after a while, and not all businesses enjoy shipping source code anyway.


Three chars limit for keywords and some std types, e.g. `Vec`, `len`, `str`.


I respect your opinion, but I tend to disagree. The terseness is a feature I like.


I'm using QtC daily too, and it's far from perfect.

- It still can't handle most of the CMake projects.

- Refactoring/autocompletion/go-to-definition doesn't work on a heavy-templated code.

- Clang must be patched to work correctly (at least code analyzer doesn't work out of the box).

- Code generation sometimes produces malformed code.

- No ANSI escape codes support in terminal/output.

- Random crashes.

IDEA with Rust plugin is years ahead.


personally I think the best IDE in the world is Visual Studio for C#.

I think Rust has the _potential_ to be better, but it's years off and requires the rust community to change how they think.

I'm interested in the IDE due to the authors claims, but I don't really see him making this IDE better than VS + C#. If he can, that would be amazing though.


> I think Rust has the _potential_ to be better, but it's years off and requires the rust community to change how they think.

The said change already happened and Rust devs are currently refactoring in depth their compiler to make it IDE-friendly (taking a lot of inspiration from Roslyn). This is tons of work though and even if it's currently going well, it won't be there before next year.

See this talk if you're interested in this kind of things: https://m.youtube.com/watch?v=7_7ckOKZCJE&list=PLgC1L0fKd7Uk...


oh interesting, it turns out I don't follow rust closely enough :)

I think when rust tooling gets "there", it's going to be able to do some really cool things that no one else can do.


(The work is also directly inspired by the C# work)


That's what I meant when I said it was inspired by Roslyn. Did I miss other things from C# that Rust is borrowing* here?

* pun obviously intended


No, I just cannot read, sorry!


Ahah no worries ;)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: