Better HN
topnewbestaskshowjobs
Log inSign up

RazrFalcon

86 karma · joined Oct 7, 2016 (10y ago) · 35 submissions

Submissions

comment 2y ago · link · parent

>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.

comment 3y ago · link · parent

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 })

comment 3y ago · link · parent

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.

comment 3y ago · link · parent

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.

comment 4y ago · link · parent

>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...

comment 4y ago · link · parent

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.

comment 5y ago · link · parent

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.

comment 5y ago · link · parent

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.

comment 5y ago · link · parent

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

comment 6y ago · link · parent

>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.

comment 6y ago · link · parent

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

comment 6y ago · link · parent

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.

13.

Show HN: resvg – a better SVG rendering library

5 points · by RazrFalcon · 7y ago · 1 comment

comment 8y ago · link · parent

I came here to write the same. svgcleaner[1] will reduce it from 8.4KiB to 1.3KiB (compressed with zopfli). Which is 85% smaller.

And a manually crafted one is just 477B. And 261B compressed. Which is just 3% of the original.

Now we can talk about bloatedness.

  <svg width="601" height="751" xmlns="http://www.w3.org/2000/svg">
    <rect width="600" height="750" rx="38" fill="white" stroke="black"/>
    <rect x="16" y="16" width="568" height="718" rx="24" fill="none" stroke="black" stroke-width="15"/>
    <text text-anchor="middle" font-family="Arial" font-size="150" font-weight="bold">
        <tspan x="300" y="200">FPS</tspan><tspan x="300" y="350">LIMIT</tspan><tspan x="300" y="660" font-size="350">15</tspan>
    </text>
  </svg>
[1]: https://github.com/RazrFalcon/svgcleaner

comment 8y ago · link · parent

Yes. I have nVidia and it's a total pain. Not only with sublime.

comment 8y ago · link · parent

Glad that they have a lot of HiDPI fixes, but it still unusable on linux... [0]

[0]: https://github.com/SublimeTextIssues/Core/issues/2028

comment 8y ago · link · parent

wine notepad.exe

comment 8y ago · link · parent

I'm not saying that you should ditch an existing C++ project.

But it doesn't mean that C++ as good as Rust. It's just wrong.

comment 8y ago · link · parent

Yes. C++ has all of this in a crippled form. But it doesn't mean that C++ in on par with Rust.

comment 8y ago · link · parent

So nothing about ADT, pattern matching, modules, better std, explicit unsafe and cargo?

comment 8y ago · link · parent

Except Inkscape which is extremely slow. Especially on 4K.

comment 8y ago · link · parent

If we are talking about C++ then the problem is that there a too many build systems and all of them are incompatible.

CMake is quite popular (and maybe most popular) but it's a complete horror in comparison to other build systems, especially for other languages (like Cargo for Rust).

If you need some specific example: try to add a git-based dependency with a specific branch in CMake.

comment 9y ago · link · parent

SVG is not a colored paths container. There are far more things that it can do and far more ways to optimize it.

Instead of SVGO you can use svgcleaner[1] with zopfli, which is a bit better.

Yes, nothing compares to manual optimizations, but if you created an SVG using a vector editor - there is no point in manually removing all the garbage it adds in.

1: https://github.com/RazrFalcon/svgcleaner

comment 9y ago · link · parent

>I know it will be supported by the community

They won't. Projects like Atom and VSCode thrives because they have big companies behind them. Remove them - and the project will die.

There are tons of abandoned text editors on GiHub.

comment 9y ago · link · parent

xi-editor looks like the best solution for me.

comment 9y ago · link · parent

There is DeaDBeeF on Linux which has the lowest appetite among GUI audio players.

comment 9y ago · link · parent

Can you provide a minimal example?

comment 9y ago · link · parent

Did someone try to render an SVG using it? I'm using QtWebKit for now, but it's just a huge pain.

comment 9y ago · link · parent

Yes. You can't beat PNG in low resolution, because it's hard to make SVG pixel-prefect on all resolutions. But on modern devices, with high DPI - it's not a problem. And you will get a high size reduction (but with some runtime cost).

comment 9y ago · link · parent

It doesn't supported well even in modern browsers. There are so many edge-cases that are completely ignored.

Yes, you probably newer encounter them, but they are still there.

12