Thanks for the awesome work on this application, makes recording demos much easier!
Let me know if there's any more info I can provide or testing to do.
Problem
While using this tool to generate recordings I noticed an odd behavior in how I had to specify font-family name.
For some reason the name I had to specify was another option that pops up in fc-list (typically the last one), which would end up not matching the value in FontBook on MacOS. This made determining the correct name of the font more difficult.
For example the following would work: --font-family "JetBrainsMono NFM"
But the more usual name for the font would fail: --font-family "JetBrainsMono Nerd Font Mono"
Solution
The problem is caused by the old version of fontdb being used. Prior 0.11.0 the library would choose the first valid value for the font family and that is all it would look at in the call to query.
There are some tied dependencies here, in particular the version of fontdb needs to match the one used in resvg / usvg, or at least be compatible.
The first version of resvg and usvg that use a version of fontdb >= 0.11.0 is the very next version 0.29.0. And 0.29.0 depends on 0.12.0. So this seems like a good upgrade path.
Once fontdb is able to query the font no real change is needed other than handling a slightly different return type.
Error: no faces matching font families JetBrainsMono Nerd Font Mono
Side Effect
Since this implementation returns the first font family in the output of fontdb.query verbose logging is no longer guaranteed to write the exact font family name provided as input. The first font family as written in the fontdb docs states: "Where the first family is always English US, unless it's missing from the font".
[INFO agg] selected font families: ["JetBrainsMono Nerd Font Mono"]
This can be changed back by modifying the implementation of find_font_family to return the input name if face_info.families is not empty rather than returning the first value in that list.
Thanks for the awesome work on this application, makes recording demos much easier!
Let me know if there's any more info I can provide or testing to do.
Problem
While using this tool to generate recordings I noticed an odd behavior in how I had to specify font-family name.
For some reason the name I had to specify was another option that pops up in
fc-list
(typically the last one), which would end up not matching the value in FontBook on MacOS. This made determining the correct name of the font more difficult.For example the following would work:
--font-family "JetBrainsMono NFM"
But the more usual name for the font would fail:--font-family "JetBrainsMono Nerd Font Mono"
Solution
The problem is caused by the old version of
fontdb
being used. Prior 0.11.0 the library would choose the first valid value for the font family and that is all it would look at in the call toquery
.The following commit fixed this by processing a list of font-families: https://github.com/RazrFalcon/fontdb/commit/8ffb890242d451bfd3d392618be8dd6d5b54ce39
There are some tied dependencies here, in particular the version of
fontdb
needs to match the one used inresvg
/usvg
, or at least be compatible.The first version of
resvg
andusvg
that use a version offontdb
>= 0.11.0 is the very next version 0.29.0. And 0.29.0 depends on 0.12.0. So this seems like a good upgrade path.Once
fontdb
is able to query the font no real change is needed other than handling a slightly different return type.The only other change introduced is the removal of the
keep_named_groups
option in the call toconvert_text
in commit: https://github.com/RazrFalcon/resvg/commit/d5e5fcfdc2132b7fc8177fa5abbd1ddf893a3cc0Testing
After building I was able to verify the both of the following succeed:
The latter usually fails with the following:
Side Effect
Since this implementation returns the first font family in the output of
fontdb.query
verbose logging is no longer guaranteed to write the exact font family name provided as input. The first font family as written in the fontdb docs states: "Where the first family is always English US, unless it's missing from the font".For instance both of these commands:
Output:
This can be changed back by modifying the implementation of
find_font_family
to return the inputname
ifface_info.families
is not empty rather than returning the first value in that list.