On Sat, 2017-10-21 at 14:27 -0600, Amelia Bellamy-Royds wrote:
It would be very useful if Inkscape was to suppport CSS @font-face, which could have relative URLs to fonts in the same folder or a subfolder.

This is a long term goal of mine. I looked at adding 'user fonts' to Inkscape some time ago (I was interested in adding SVG font support) but ran into problems with the FontConfig/Cairo/Pango stack.

Eduard: You've just added code to handle custom font directories in Inkscape. Is it possible to handle adding just specified font files?

Tav

With that support, Inkscape could find font files in the same folder, without having to scan for them -- it would know where to look.  For creating graphics, there could be an "import font" button that opens a file selector dialog, allowing the designer to find the font.  Then there would maybe be options for using the relative link or embedding the font (as a data URI in the CSS). Inkscape could then create the @font-face rules, ready for next time the file is opened.

~ABR

On 21 October 2017 at 12:29, Miguel Lopez <reptillia39@...3425...> wrote:

Personally, I'm of the opinion that if it just from the folder, then there's no reason to implement this functionality. If the fonts were say embedded into .svg, then I can see how would it be useful. For sharing Inkscape documents, this doesn't really solve anything.


On 10/21/2017 1:05 PM, Eduard Braun wrote:

Hi all,

I'm currently implementing functionality which allows Inkscape to use fonts *not* installed on the system [1].

  • Suppport for loading fonts from share/inkscape/fonts as well as the fonts dir in Inkscape's configuration directory is already added.
  • Support for custom locations configurable by the user is provided, too.
  • One task is left: load fonts from the location of the currently opened SVG document

While the last point could be especially interesting (e.g. it would allow people to simply distribute fonts required by an SVG alongside with it) it's also a bit tricky: fontconfig scans directories recursively. This means if the user were to open an SVG file somewhere at the top of the directory tree, fontconfig suddenly would scan *a lot* of directories for fonts.

So I basically want to collect some opinions:

  • Do you think this would be acceptable? In that case I'd probably implement a boolean setting which defaults to false and explains the risks.
  • Could it make sense to rephrase the task a bit to "load fonts from the 'fonts' directory in the folder of the currently opened SVG"? It might be an option to offer this functionality while reducing the risk of indexing a large amount directories, however discoverability of the feature would be significantly reduced.
  • Should I just skip the last task?
  • Other ideas?

Let me know what you think!

Best Regards,
Eduard

[1] https://gitlab.com/inkscape/inkscape/merge_requests/102