Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For certain fonts, export as svg outputs incorrect svg's, while export as pdf works fine #5414

Open
Volker-Weissmann opened this issue May 2, 2024 · 1 comment

Comments

@Volker-Weissmann
Copy link

I downloaded https://fonts.google.com/specimen/Source+Code+Pro and ran this script:

#!/usr/bin/env python
import fontforge
F = fontforge.open("SourceCodePro-Regular.ttf")
for name in F:
    F[name].export(f"pdfs/{name}.pdf")
    F[name].export(f"svgs/{name}.svg")

The pdfs look fine:
image
Wheres certain svg's are blank:
image

This is not a bug in my image viewer, the svg's are clearly wrong:

$ cat Beta.svg 
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-10 0 610 1000">
   <g  />
</svg>

Gdb showed me that this suspicious-looking if-branch is taken:

    if ( !svg_sc_any(sc,layer) ) {
	/* I think a space is represented by leaving out the d (path) entirely*/
	/*  rather than having d="" */

I would be thankful if you could fix the issue, but I could also try to write a fix and open a PR, if you would prefer that.

OS: ArchLinux

$ fontforge --version
Copyright (c) 2000-2024. See AUTHORS for Contributors.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
 Version: 20230101
 Based on sources from 2024-04-05 14:41 UTC-ML-D-GDK3.
fontforge 20230101
build date: 2024-04-05 14:41 UTC
@Mercury13
Copy link

Solution for you: dereference links beforehand.
Solution for FontForge: add option “export recursively”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants