Should Inkscape use fonts from folder of currently opened SVG?
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
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
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.netmailto:Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
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.
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
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Inkscape-devel mailing listInkscape-devel@...1901...://lists.sourceforge.net/lists/listinfo/inkscape-devel
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Here's my question, how does this solve the issue with sharing document, and forgetting to share the fonts too? Maybe something like font lookup using database would solve this issue, or somehow embedding the font file into the svg file. Or maybe when you use compressed svg, you can save the font file there.
On 10/21/2017 4:27 PM, 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.
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...mailto: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
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.netmailto:Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.netmailto:Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On 21 October 2017 at 15:01, Miguel Lopez <reptillia39@...3425...> wrote:
Here's my question, how does this solve the issue with sharing document, and forgetting to share the fonts too? Maybe something like font lookup using database would solve this issue, or somehow embedding the font file into the svg file. Or maybe when you use compressed svg, you can save the font file there.
If you're creating SVG for the web, you'd usually have the fonts hosted separately on your web server (or via a 3rd-party service), so that the same font files can be used with many different web pages / graphics, without having to download them each time.
However, I agree that embedding the fonts in the SVG file should be an option. With CSS @font-face, you do that by converting the (binary) font file into a string called a data URI, which can then be used instead of a URL reference to a different file. In this way, you can embed any font in an SVG, not only the SVG font elements.
This is exactly the same mechanism that Inkscape already uses for photographs and other raster images: you have the choice to either have a link to another image file, or to embed it (by converting it to a data URI).
~ABR
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
Am 23.10.2017 um 15:19 schrieb Tavmjong Bah:
Eduard: You've just added code to handle custom font directories in Inkscape. Is it possible to handle adding just specified font files?
Yes, that would be "||FcConfigAppFontAddFile||" [1]. Code could be almost identical to what I implemented in "font_factory::AddFontsDir", except for taking a filename as input instead of a directory name.
One common downside: This obviously only works for pango's freetype/fontconfig backend and not pango's other (native) backends.
Regards, Eduard
[1] https://www.freedesktop.org/software/fontconfig/fontconfig-devel/fcconfigapp...
On Mon, 2017-10-23 at 15:19 +0200, Tavmjong Bah wrote:
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.
I've just added code to trunk that will load local ttf or otf fonts listed in a CSS @font-face rule. The code is rather primitive. It basically searches for sources that end in .ttf or .otf, assumes they are font files, and then loads the font file using FcConfigAppFontAddFile(). No refresh of the font-family menu list is done so the font will only appear in the menu if loaded before the menu is generated the first time (i.e. if the file with the @font-rule is specified on the command line). The 'font-family' part of the CSS @font-face rule is completely ignored so the font can only be used with its native name. And there is no GUI to edit a CSS @font-face rule.
Despite these limits, it can be used to load fonts in the same folder or in a subfolder...
Tav
participants (4)
-
Amelia Bellamy-Royds
-
Eduard Braun
-
Miguel Lopez
-
Tavmjong Bah