10
66
Fork
You've already forked fcft
14

Add support for COLRv1 fonts #114

Open
opened 2025年10月10日 10:25:37 +02:00 by dnkl · 7 comments
Owner
Copy link
No description provided.
Author
Owner
Copy link

#115 adds a check for COLRv1 fonts, and rejects/skips (i.e. use the next fallback font instead) them. This at least fixes an issue where COLRv1 fonts caused "nothing" to be rendered.

https://codeberg.org/dnkl/fcft/pulls/115 adds a check for COLRv1 fonts, and rejects/skips (i.e. use the next fallback font instead) them. This at least fixes an issue where COLRv1 fonts caused "nothing" to be rendered.
Contributor
Copy link

What about addressing this by going all-in with using HarfBuzz, which supports COLRv1 since 13.0? Remove both the nanosvg and librsvg backends and let HarfBuzz handle all color glyphs: COLRv0, COLRv1, SVG, bitmap.

Foot, Fuzzel, and Fnott all aready use HarfBuzz.

What about addressing this by going all-in with using HarfBuzz, which supports COLRv1 since 13.0? Remove both the nanosvg and librsvg backends and let HarfBuzz handle all color glyphs: COLRv0, COLRv1, SVG, bitmap. Foot, Fuzzel, and Fnott all aready use HarfBuzz.
Contributor
Copy link

@cglogic, why the downvote for solving this with HarfBuzz?

@cglogic, why the downvote for solving this with HarfBuzz?

@markstos wrote in #114 (comment):

@cglogic, why the downvote for solving this with HarfBuzz?

First, read project description: A simple library for font loading and glyph rasterization using FontConfig, FreeType and pixman. Do you see HarfBuzz?

Second, HarfBuzz is a huge dependency. In the latest version they even added GPU side rasterization, if I remember correctly.

@markstos wrote in https://codeberg.org/dnkl/fcft/issues/114#issuecomment-12965778: > @cglogic, why the downvote for solving this with HarfBuzz? First, read project description: _A **simple** library for font loading and glyph rasterization using **FontConfig**, **FreeType** and **pixman**._ Do you see **HarfBuzz**? Second, HarfBuzz is a **huge** dependency. In the latest version they even added GPU side rasterization, if I remember correctly.
Contributor
Copy link

@cglogic Harfbuzz is already a dependency for fcft when packaged for Arch Linux, Debian and other distros. Are you using fcft in situation where the Harfbuzz features are not enabled?

Harfbuzz is already conditionally used in 29 places in fcft, so accepting it as hard dependency would be a significant simplification and align with the reality that most people are already using fcft build with harfbuzz as a dependency.

I learned some about the COLRv1 spec, and it looks like a huge effort to support it directly in fcft.

@cglogic Harfbuzz is already a dependency for fcft when packaged for Arch Linux, Debian and other distros. Are you using fcft in situation where the Harfbuzz features are not enabled? Harfbuzz is already conditionally used in *29* places in `fcft`, so accepting it as hard dependency would be a significant simplification and align with the reality that most people are already using fcft build with harfbuzz as a dependency. I learned some about the COLRv1 spec, and it looks like a huge effort to support it directly in `fcft`.
Author
Owner
Copy link

Foot, Fuzzel, and Fnott all aready use HarfBuzz.

This is incorrect; none of them have a direct dependency on HarfBuzz. They can use the font shaping capability that comes with a harfbuzz enabled fcft build. But they do not use harfbuzz themselves.

"My" projects aren't the only ones using fcft, and making harfbuzz a required dependency is not something I'm considering.

I would like for fcft to have COLRv1 support without requiring harfbuzz. Worst case, we provide optional COLRv1 support, when built with harfbuzz support enabled. From a quick look at its rasterizer API, it does appear to be possible to use FreeType managed fonts with it (that's good), but the rasterizer still needs us to implement the drawing primitives (at a minimum, lines and cubics).

All in all, we're not gaining that much by using harfbuzz' rasterizer. Right now, I consider it worthwhile to try to support COLRv1 by ourselves, without harfbuzz. That is, continue to, optionally, depend on harfbuzz for its shaping functionality - nothing else.

> Foot, Fuzzel, and Fnott all aready use HarfBuzz. This is incorrect; none of them have a direct dependency on HarfBuzz. They can use the font shaping capability that comes with a harfbuzz enabled fcft build. But they do not use harfbuzz themselves. "My" projects aren't the only ones using fcft, and making harfbuzz a required dependency is not something I'm considering. I would _like_ for fcft to have COLRv1 support without **requiring** harfbuzz. Worst case, we provide optional COLRv1 support, when built with harfbuzz support enabled. From a quick look at its rasterizer API, it _does_ appear to be possible to use FreeType managed fonts with it (that's good), **but** the rasterizer still needs **us** to implement the drawing primitives (at a minimum, lines and cubics). All in all, we're not gaining _that_ much by using harfbuzz' rasterizer. Right now, I consider it worthwhile to try to support COLRv1 by ourselves, without harfbuzz. That is, continue to, optionally, depend on harfbuzz for its shaping functionality - nothing else.
Author
Owner
Copy link

(at a minimum, lines and cubics).

It appears to be much more than that actually. Those were the draw functions. You also need to implement paint functions. These are, for example, all the gradiants used in COLRv1.

In short, "all" harfbuzz will do for us is parse the COLRv1 tables and translate to mid-level paint operations.

I already have the parsing done in an fcft branch. All that's left is the paint operations. So harfbuzz gives us nothing. Assuming my 5 minute read of the harfbuzz documentation is correct...

> (at a minimum, lines and cubics). It appears to be much more than that actually. Those were the _draw_ functions. You also need to implement _paint_ functions. These are, for example, all the gradiants used in COLRv1. In short, "all" harfbuzz will do for us is parse the COLRv1 tables and translate to mid-level paint operations. I already have the parsing done in an fcft branch. All that's left is the paint operations. So harfbuzz gives us nothing. Assuming my 5 minute read of the harfbuzz documentation is correct...
Sign in to join this conversation.
No Branch/Tag specified
master
colrv1
releases/3.3
rasterize-utf8
spacing
releases/3.2
releases/3.1
releases/3.0
releases/2.5
releases/2.4
releases/2.3
releases/2.2
releases/2.1
releases/2.0
releases/1.0
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.1.10
3.1.9
3.1.8
3.1.7
3.1.6
3.1.5
3.1.4
3.1.3
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.5.1
2.5.0
2.4.6
2.4.5
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.3.3
2.3.2
2.3.1
2.3.0
2.2.92
2.2.91
2.2.90
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.0
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.0
0.1.1
0.1.0
0.0.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fcft#114
Reference in a new issue
dnkl/fcft
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?