Skip to content

Instantly share code, notes, and snippets.

@zkamvar
Created November 2, 2014 00:24
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save zkamvar/2abc7fa4af33345699ae to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
#
# This script was created because I had a problem with inkscape not recognizing
# fonts generated by R's pdf generator. This will go through and make these fonts
# scaleable.
#
# Workflow: Generate PDF > open in inkscape > save as svg > run this script
#
# Usage: perl -i inkscape_pdf_font.pl <my_file.svg>
#
# Note, that the i flag means "inline"
use strict;
use warnings;
while(<>){
s/(x=\"[[:digit:][:punct:]]+?)[[:blank:]].+?$/$1"/g;
print $_;
}
@mgdondon
Copy link

This tip is very usefull, thank you.

I only had to use perl -i.bak inkscape_pdf_font.pl <my_file.svg>

instead of perl -i inkscape_pdf_font.pl <my_file.svg>

to run the script and avoid a message Can't do inplace edit without backup

@zkamvar
Copy link
Author

zkamvar commented Nov 16, 2014

Good to know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment