How to vectorize fonts when importing PDF?

Post questions on how to use or achieve an effect in Inkscape.
netheril96
Posts: 10
Joined: Sun Oct 03, 2010 4:12 am

How to vectorize fonts when importing PDF?

Postby netheril96 » Mon Jun 20, 2011 10:40 pm

I'm trying to convert a PDF file with Computer Modern fonts for formulas (generated by Asymptote), but Inkscape is not able to recognize it and automatically replaces them with some sans-serif font that looks ugly in math.
The import option under "Text handling" is only "import text as text", so is there a way to convert those fonts to path while importing?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to vectorize fonts when importing PDF?

Postby brynn » Wed Jun 22, 2011 3:38 am

Hi netheril96,
Try unchecking "Replace PDF fonts with closest-named installed fonts". I'm not clear if that imports the text as paths, but it would be worth trying anyway, I think.

I'm not familiar with the program Asymptote, but I assume the text can't be converted to paths before saving or exporting? The Inkscape dialog for saving as PDF includes the option to convert the text to paths. But apparently not this program?

User avatar
flamingolady
Posts: 687
Joined: Wed Jun 10, 2009 1:40 pm

Re: How to vectorize fonts when importing PDF?

Postby flamingolady » Wed Jun 22, 2011 11:52 am

I just tried something else that may or may not work for you. Type your text (always duplicate it), then click on Object, then Pattern, then Objects to Pattern. Make a rectangle box exactly the same size as your text, convert it to a path, then fill it with the new 'pattern' of text (which is using the Fill and Sroke menu, click on the checkerboard looking box, then use the drop down menu and select your text.
That might work, or possibly you could then at least export it as a png which would keep it intact.
dee

netheril96
Posts: 10
Joined: Sun Oct 03, 2010 4:12 am

Re: How to vectorize fonts when importing PDF?

Postby netheril96 » Mon Jul 04, 2011 11:02 pm

flamingolady wrote:I just tried something else that may or may not work for you. Type your text (always duplicate it), then click on Object, then Pattern, then Objects to Pattern. Make a rectangle box exactly the same size as your text, convert it to a path, then fill it with the new 'pattern' of text (which is using the Fill and Sroke menu, click on the checkerboard looking box, then use the drop down menu and select your text.
That might work, or possibly you could then at least export it as a png which would keep it intact.
dee


I know how to do that, but I don't want to do it by hand; I need Inkscape to automatically vectorize all text upon importing.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: How to vectorize fonts when importing PDF?

Postby ~suv » Tue Jul 05, 2011 1:11 am

netheril96 wrote:I need Inkscape to automatically vectorize all text upon importing.
This is not yet supported by the current stable release (but a known feature request).

If you can install a recent development snapshot (0.48+devel), test opening the PDF file from within Inkscape as "Adobe PDF via cairo-poppler (*.pdf)" (Note: experimental, work-in-progress, might not be included in the next stable release) - it will not convert text to paths based on embedded fonts of the PDF file AFAICT, but does use installed fonts if available: the imported text is created as paths (clones linked to glyph paths as <symbol>'s in the <defs> section).

Alternatively write a script to use ghostscript for converting texts into outlines of PDF files, before opening the PDF file in Inkscape (a sample command line is here, a quick google search will return many other examples). Such a command could be daisy-chained as external script in an Inkscape input extension.

netheril96
Posts: 10
Joined: Sun Oct 03, 2010 4:12 am

Re: How to vectorize fonts when importing PDF?

Postby netheril96 » Tue Jul 05, 2011 1:28 am

~suv wrote:
netheril96 wrote:I need Inkscape to automatically vectorize all text upon importing.
This is not yet supported by the current stable release (but a known feature request).

If you can install a recent development snapshot (0.48+devel), test opening the PDF file from within Inkscape as "Adobe PDF via cairo-poppler (*.pdf)" (Note: experimental, work-in-progress, might not be included in the next stable release) - it will not convert text to paths based on embedded fonts of the PDF file AFAICT, but does use installed fonts if available: the imported text is created as paths (clones linked to glyph paths as <symbol>'s in the <defs> section).

Alternatively write a script to use ghostscript for converting texts into outlines of PDF files, before opening the PDF file in Inkscape (a sample command line is here, a quick google search will return many other examples). Such a command could be daisy-chained as external script in an Inkscape input extension.


Sadly what I want is exactly to convert text to paths based on embedded fonts of the PDF file. There is in fact a tiny program pdf2svg (http://www.cityinthesky.co.uk/opensource/pdf2svg) based on Cairo and Poppler able to do this, but it is restricted to Linux and I don't want switch to Linux every time I convert PDF to SVG. Maybe developers can just incorporate the code of pdf2svg into Inkscape.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: How to vectorize fonts when importing PDF?

Postby ~suv » Tue Jul 05, 2011 1:36 am

netheril96 wrote:but it is restricted to Linux and I don't want switch to Linux every time I convert PDF to SVG.

AFAICS you never told what OS/platform you are working on (and need a solution for) …

netheril96
Posts: 10
Joined: Sun Oct 03, 2010 4:12 am

Re: How to vectorize fonts when importing PDF?

Postby netheril96 » Tue Jul 05, 2011 2:00 am

~suv wrote:
netheril96 wrote:but it is restricted to Linux and I don't want switch to Linux every time I convert PDF to SVG.

AFAICS you never told what OS/platform you are working on (and need a solution for) …


I was talking about Inkscape, which is multi-platform.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: How to vectorize fonts when importing PDF?

Postby ~suv » Tue Jul 05, 2011 2:20 am

netheril96 wrote:
~suv wrote:
netheril96 wrote:but it is restricted to Linux and I don't want switch to Linux every time I convert PDF to SVG.

AFAICS you never told what OS/platform you are working on (and need a solution for) …

I was talking about Inkscape, which is multi-platform.

Sorry for thinking you might be interested in interim solutions.

You are welcome to implement the missing feature in the current code base. [1] The request is known and needs to be addressed by writing code based on current routines in Inkscape for PDF import (using the shared external poppler and cairo libraries). The feature is not intentionally omitted in Inskcape, but the currently active core of the developer team is small, and as with other open source projects, contributions are often driven by personal interest of a developer in fixing or adding certain features.

[1] edited later: Apologies again - I know this phrase is not helpful to users looking for a cross-platform solution. At the moment, I am not aware of an internal command/function available in the latest stable release (0.48.1) to achieve your request (vectorize (embedded) fonts when importing PDF). Maybe the next stable version (0.49) will include such an option (which certainly was planned to be added - based on the dropdown list in the PDF import dialog), maybe you'll need to wait for a later release.


Return to “Help with using Inkscape”