typst / svg2pdf

Converts SVG files to PDF.
Apache License 2.0
273 stars 32 forks source link

Add the ability to list the fonts detected #45

Closed rgreinho closed 8 months ago

rgreinho commented 10 months ago

Adds a new CLI flag allowing the user to just list the fonts which are detected on the system.

Signed-off-by: Rémy Greinhofer remy.greinhofer@gmail.com

LaurenzV commented 10 months ago

Looks good to me! I'm sure it will be reviewed soon, it's just that the owners of this crate are pretty busy at the moment, so don't be surprised if it takes a while until they manage to review it. But they will review it eventually. 😄

laurmaedje commented 10 months ago

Needs rebase/merge because of new crate structure. That aside, I'm not sure whether the PostScript name is the most user-friendly thing to print. We could also group by typographic family and print the available variants like typst does. But maybe it's overkill here.

rgreinho commented 9 months ago

Rebased 👌

I can change the output no problem. However I am not sure what is the best overall, I just implemented what helped me with my use case.

reknih commented 9 months ago

Hey!

I think that stuff that does not change the behavior of the CLI but does something different altogether should be a subcommand, not a flag. I agree with @laurmaedje that the font families should be sorted by and displayed with their typographical families. I also get that showing PostScript names is useful, especially since the library is subject to two separate font resolution algorithms (CSS standalone and Typst/consumer). How about an output like this?

Helvetica
├ Helvetica
├ Helvetica-Bold
├ Helvetica-BoldOblique
├ Helvetica-Light
├ Helvetica-LightOblique
└ Helvetica-Oblique

svg2pdf fonts could have the same output as typst fonts and an --all option would switch to this view.

rgreinho commented 9 months ago

Yep, that sounds good! I can have a look at typst fonts, add the command, and implement the output you showed! 👍

(Also, just keeping in mind that we're doing all of this to try to solve https://github.com/typst/svg2pdf/issues/44 🙃).

rgreinho commented 9 months ago

Alright! I looked at typst and reorganized the code in a similar way.

There are now 2 commands, convert which converts an SVG file into a PDF file, and fonts which lists the fonts detected on the system.

Here is the output of the fonts command:

image

And here the output of the fonts --all command:

image

Let me know what you think, and if this iteration matches what you had in mind. If for any reason that is not the case, just provide some pointers and I'll make the necessary adjustments. :)

reknih commented 9 months ago

I would, if possible, prefer if svg2pdf file.svg would remain the main convert command and only fonts needs a subcommand. If that's not possible, this LGTM.

rgreinho commented 8 months ago

No problem! I'll give it a shot :)

rgreinho commented 8 months ago

Ok, so I rearranged it like that:

image

Let me know what you think, and if you like it, I'll start working on rebasing this branch onto master 🙃

laurmaedje commented 8 months ago

Looks good!

rgreinho commented 8 months ago

@laurmaedje @reknih rebase complete ✅

laurmaedje commented 8 months ago

Thank you for your work and patience!