4 ms·
Author: > The current state of the code is quite rough. The code isn't well organized, and it's basically not ready for prime time. From what I can see in htt
by elcapitan 10y ago
Author:
> The current state of the code is quite rough. The code isn't well organized, and it's basically not ready for prime time.
From what I can see in https://github.com/google/font-rs/blob/master/src/font.rs https://github.com/google/font-rs/blob/master/src/font.rs, this is what is missing:
* support of CFF-based fonts (that is "postscript-flavored outlines" (i.e. cubic) OTF files)
* "Advanced Typographic Tables" (see Opentype spec: https://www.microsoft.com/typography/otspec/otff.htm https://www.microsoft.com/typography/otspec/otff.htm), this is what is needed to render more complex non-latin languages like Arabic etc, because it defines context-specific replacements and positioning, but also opentype-level kerning
* support for the kerning table
* support for slightly more exotic TTF variations like EOT and WOFF for webfonts
* hinting support for smaller rendering sizes
Most of these things are supported by Freetype, and are probably a considerable amount of work to add. Once you add them into the rendering calculations, the abstractions in the code would have to be refactored and the code would become more complex and probably slower.
Having said that, it's still a nice implementation and easy to read, something I wouldn't necessarily say about Freetype ;)
- pcwalton 10y ago> Once you add them into the rendering calculations, the abstractions in the code would have to be refactored and the code would become more complex and probably slower. These features don't have much to do with the core rasterization algorithm, which is where the vast majority of the time is typically spent. So I wouldn't expect things to go slower.
- elcapitan 10y agoThe hinting is definitely rasterization related, isn't it?
- pcwalton 10y agoWell, sure, but it's increasingly common to just not do hinting these days. For example, Mac, iOS, and Android (from what I can gather) don't. In any case, hinting just changes point positions. It doesn't affect the way the rasterizer works at a fundamental level, I don't believe.
- johncolanduoni 10y agoFor CFF at least, hinting instructions are integrated tightly with the rendering instructions. I'm not sure about TrueType outlines though.
- a_e_k 10y agoIn the case of TrueType hinting with the interpreter, it can. The SCANTYPE instruction [1] allows the hint program to request different scan conversion settings. It's mainly used to change the dropout control mode. Without dropout control, the rule is strictly that pixels whose centers are inside of the glyph are drawn. At small scales, this can lead to features smaller than a pixel disappearing, so dropout control adds additional rasterization rules to draw some pixels even if they're slightly outside of the glyph. I've seen that FreeType supports them, and I'm sure it must have a complexity and performance impact on them. Granted, it's less useful with antialiasing, but is still a case where hinting affects the rasterizer's operation. [1] https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html#SCANTYPE https://developer.apple.com/fonts/TrueType-Reference-Manual/...
- jahewson 10y agoFreeType does not support EOT. FreeType also doesn't handle Advanced Typographic Tables. For that you need HarfBuzz. Note that rendering and shaping are usually considered to be separate processes - one doesn't expect a font rendering library to handle shaping Other than hinting nothing you've mentioned should affect the rasterization performance.