Show HN: resvg – a better SVG rendering library
5 pointsby RazrFalcon1 comments
numbers.contains(where: { $0 > 0 }) 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. <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
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.