fonts changed on pdf import

Bug #219709 reported by tony_dambrosio
126
This bug affects 23 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Unassigned

Bug Description

Can't say for certain. It may well be that it's the "changes font names" bug ... however, from where I am seeing things all that happens is the fonts on import of a PDF file are not the ones that reside on the imported file. Since the file reads properly on Adobe Reader, on Foxit Reader, and also as input to Corel Draw I have faith the file's OK.
I noticed another bug reported re. font sizes. The sizes seemed OK since the full page still appeared as a full page, properly filled.

Thanks for looking. This is a remarkable piece of work and I realize it's forever in progress. I'd like to avoid saving up for the next Corel, but my version's getting a little long in the tooth. Still, I need the PDF import ability for some small booklet composition jobs.

I've included the file it's chewing up, just for reference.

Thanks,

Tony

Tony D'Ambrosio in Rindge, NH

Revision history for this message
tony_dambrosio (tonythedamb) wrote :
Revision history for this message
tony_dambrosio (tonythedamb) wrote :

Neglected to mention ... I'm on XP with a fairly recently built machine and 2 Gig of memory.

Thanks again.

Tony

Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

Confirmed opening Adobe Illustrator files (pdf) as well.
I can see the right fonts on canvas, but if I select a text element the status area displays the default font "Bitstream Vera Sans".
The problem comes when I open the font dialog to change spacing, size or any style atribute. Since the text element is reported as Vera Sans, any change leads to loosing the font selection and fall into Vera Sans.

Although I'm not an expert in XML and I don't know if this is true, I think I found something that may be causing this: In the text created inside inkscape, the style attributes are in the svg:text tag.
In the imported text the only style attribute is the font-size, while the other style attributes are inside a span tag, under the svg:text tag.

Changed in inkscape:
importance: Undecided → High
status: New → Confirmed
jazzynico (jazzynico)
tags: added: fonts import-export pdf
Revision history for this message
Barry (barry-mackichan) wrote :

I'd like to add: please, please fix this bug in version .47. We are trying to create mathematical labels for figures by running pdfTeX and converting the results to SVG. The various results I've gotten include:
  1. all fonts converted to the default -- with the file run through pdfTeX. The PDF file includes subsets of the various Computer Modern fonts, which are Type 1 and probably not installed as system fonts (Windows XP).
  2. by running XeLaTeX, I can make the non-math fonts come from an Open Type font. These characters come through, but the characters in the math (Computer Modern) do not.
  3. the solution seemed to be to make sure all the characters came from installed Open Type fonts, so I compiled with XeLaTeX using the unicode-math package. The resulting PDF file contains only two fonts -- one for ordinary text and one for math. This file ought to import, but it crashes Inkscape.

I will download gdb and run a stack trace if you think that will help at this point.

I am attaching the PDF file and the two fonts referenced by it.

Revision history for this message
Barry (barry-mackichan) wrote :
Revision history for this message
Barry (barry-mackichan) wrote :
Revision history for this message
Levi Kilcher (levi-kilcher) wrote :

Bump.

My understanding is that this is due to the fact that inkscape does not currently handle embedded fonts. It would be very nice if it did. Clearly this is a difficult issue though... How do textext and the "render latex" extensions handle latex fonts? Do they just write paths?

I've looked around, but couldn't find a blueprint/timeline for this. Anyone?

I think this bug is related:
https://bugs.launchpad.net/inkscape/+bug/295564

su_v (suv-lp)
tags: added: importing
removed: import-export
Revision history for this message
Brian Cox (b-cox) wrote :

I have a similar import problem, but it exists in Illustrator as well.
When I generate a PDF graphic using the stats language R, if my plots use the open or closed circle they are replaced by "q". Why a q? In illustrator I can select all of the q's and then replace them with the open circle font that illustrator has. In inkscape there does not seem to be a function to do this or an open circle font. If I use any PDF viewer they are open circles so it is some kind of import problem. Since R is open source and Inkscape is open source maybe the open source people could all share their font sets so they are more compatible? I have attached an example plot.

For R I am using
               _
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 2
minor 11.1
year 2010
month 05
day 31
svn rev 52157
language R
version.string R version 2.11.1 (2010-05-31)

For inkscape
Inkscape 0.48.0 r9654

I am using Ubuntu 10.10 LTS
on a System76 laptop

Thanks
Brian

Revision history for this message
Brian Cox (b-cox) wrote :

oops attachment

Revision history for this message
Brian Cox (b-cox) wrote :
Revision history for this message
su_v (suv-lp) wrote :

@Brian Cox - please add your comments to bug #668701 which is about this specific problem when importing PDFs generated with R.

Revision history for this message
Brian Cox (b-cox) wrote :

Great thanks for pointing me to this. I keep finding it hard to look for "R" in these bug databases.

Revision history for this message
Vera Kre (vera-kreuter) wrote :

I'm having the same problem (fonts changed when importing pdf) and found something that might be useful in fixing this:

The font used in the pdf is called "Unit-Light"; on importing it is changed to "Sans", size is kept.
When you navigate to a text element in the XML Viewer you can see that "font family" is set to "Unit", "-inkscape-font-specification" to Unit-Light. If I set "font family" to "Unit-Light" the text element is displayed with the correct font.
So it seems these style attributes aren't set correctly when importing the pdf - the information on the font is there, but in the wrong place.

The full set of style attributes of one of the text elements is:
"font-size:11.03999996px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Unit;-inkscape-font-specification:Unit-Light"

(Some system information: Win XP, Inkscape version 0.48.1)

Revision history for this message
Yao (chunlinyao) wrote :

Confirmed at (Ubuntu 11.04, Inkscape 0.48.1 r9760)

Revision history for this message
mogliii (mogliii) wrote :

Any update on this issue? I am using 0.48.2 on Windows 7. Making plots with matplotlib (python) and LaTeX fonts for publication inclusion, and would like to import into Inkscape to add some arrows, labels... . But when i import, the Computer Modern Serif font is changed to Sanserif one. When I select text, it shows in the font selector "Computer Modern" and an exclamation mark ("Font not found on system").
The font required is called "CMU Serif" on my system, and if I change the font manually for each text it looks good. But this does not work for special characters and takes a while.
Can you please include option to convert text to paths based on embedded fonts for pdf import? Or a selection dialog allowing to specify which font will be used instead?

At least pdf import shouldn't break the visual appearance of the original pdf.

Revision history for this message
Alvin Penner (apenner) wrote :

@Barry : the file test57.pdf appears to be loading properly into Inkscape 0.48.2 on Windows 7, could you re-test to see if the problem still exists on your machine?

Revision history for this message
Alvin Penner (apenner) wrote :

@mogliii : could you attach the pdf file that is causing the problem? Also, could you attach the CMU font as well? I can test this on a recent build of Inkscape, Windows XP, but I do not have the CMU fonts installed and am not exactly clear which one you are using. The font will probably have the name cmu???.otf.

Revision history for this message
David H (davidh-blinker) wrote :

result of viewing test57.pdf in 0.48.2

Revision history for this message
David H (davidh-blinker) wrote :

I still see the bug, if I interpret it correctly, in 0.48.2 r9819 from the Ubuntu Maverick-backports repository. See file above.

What is also puzzling is that I have an example that actually converts uppercase letters to lowercase. Can anyone comment if this is directly related or not?

Revision history for this message
Simon (info-ised) wrote :

Bump.

I also have problems with importing pdf's created with asymptote, which uses latex fonts. I avoid the problem by converting the pdf to svg using pdf2svg utility and then import svg. It appears that pdf2svg converts fonts to paths.

If inkscape does not handle embedded fonts, could it just convert them to paths on import?

Revision history for this message
Julien-Charles Lévesque (jclevesque) wrote :

Also have the same issues importing PDF's generated with matplotlib using LaTeX fonts (i.e., Computer Modern Roman, etc.).

I have a few of these fonts installed on my system (well obviously, since I am able to compile the documents with both LaTeX and matplotlib), however I cannot see most of them when I browse the fonts list of inkscape. Inkscape does have most Latex fonts in 10pt size, but NOT in 12pt size, which seems to be the problem since matplotlib generates its figures with 12pt size fonts by default.

Didn't find anyplace to download those fonts so that inkscape can use them... I did see a package on CTAN with them, but they are all prefixed with 'BKM-' and I think that messes up inkscape's font name matching.

Anyways I am attaching the figure I used to test it out. Here is the output of pdffonts for the file :

$pdffonts mplfig.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
CMR12 Type 1 yes no no 17 0
CMSY10 Type 1 yes no no 21 0
CMMI12 Type 1 yes no no 13 0

Revision history for this message
Alvin Penner (apenner) wrote :

- a fix for comment 3, above, has been committed to bzr rev 11661. The style attribute has been moved from the <tspan> node to the <text> node.
- the result is that the font family is now displayed in the status line at the bottom.
- I am not sure if this addresses all the issues raised in this report, could you re-test and see if the problem is fixed?

Revision history for this message
insaner (insaner) wrote :

hi alvin,
 definitely not fixed yet, as of r12268. the problem is mostly that it doesnt import the embedded fonts from the pdf. so if the font isnt found in the system.. it uses something else.

Revision history for this message
Daniel (daniel1001) wrote :

I have a pdf file here where the fonts aren't imported correctly.

If I use this online service to convert the pdf to svg, I get a perfect result:
http://www.network-science.de/tools/misc2svg/

misc2svg is also recommended by Wikipedia because Inkscape sometimes doesn't work for this.
http://en.wikipedia.org/wiki/Wikipedia:Graphic_Lab/Resources/PDF_conversion_to_SVG

Inkscape is already very great, but if it could accomplish this, it would be just perfect to me!

I used inkscape_r12359-201306081541.

Revision history for this message
vlad seghete (vloodo) wrote :

@Daniel you get the same result if you use pdf2svg. The reason is, both these tools convert the text inside PDFs to paths. Inkscape does not offer this option anymore (does anybody know why?) when importing PDFs, but that is a different issue. The problem seems to be more general than just Inkscape as I can't find *any* tool that can convert from PDF to SVG while keeping he embedded fonts embedded. Even then, I am not sure that Inkscape could use SVG embedded fonts. Can someone confirm my assertions?

Revision history for this message
Daniel (daniel1001) wrote :

I would be absolutely fine with converting text to paths since this gives a perfect result. I don't want to edit the document, I just want to crop it to a certain rectangle and paste that as SVG (not as bitmap) into my document.

Revision history for this message
Christoph Buchner (bilderbuchi) wrote :

I have the same problem as comment #21

Revision history for this message
r.koebler (r.koebler) wrote :

I have the same problem, and I would like Inkscape to include an option to import text as paths, like pdf2svg does.

When converting a PDF with pdf2svg to SVG, and then opening the SVG with Inkscape, the text usually looks exactly the same as in the PDF (since it was converted to paths). But since most users probably don't know pdf2svg, it would be nice if Inkscape would include an option in the import-dialog to import text as paths -- either by implementing it in Inkscape, or by calling pdf2svg (if available) from the Inkscape-dialog.

Revision history for this message
Christopher Andrews (machba) wrote :

I had a .pdf image created in AI which I attempted to open in Inkscape, the font did not appear as it should even though the font was installed on the PC. Further investigation showed the TrueType Font filename, in Windows>Fonts, differed from the font referenced in the font selection dropdown in Inkscape, other fonts could be selected and showed as they should in the opened image in Inkscape. However, other fonts whose selection dropdown reference differed from the filename shown in Windows>Fonts also did not appear as they should when selected.

I opened this pdf in another program where the font did display correctly and I was able to export the image as an .SVG file. Opening the .SVG file in Inkscape still did not display the font correctly either on opening the file or selecting/reselecting the font.

Revision history for this message
Celina cruz (celina27) wrote :

Hi,
I have the same problem!

Revision history for this message
Jonathan Hofinger (jhofinger) wrote :

Okay, trying to disect this issue based on tests in 1.0 on Windows 10:

1) OP's file is loaded correctly. It looks nearly identical and the text contains the attribute
font-family:'Times New Roman'. This looks fixed.
2) For the Latex formula pdf in comment #4: The LModern Font fails to install for me, but you might want to import the file with the Poppler import. There's typically no reason to edit Latex-compiled formulas in Inkscape. The Asana Font is recognized and used.
3) #8 is about incorrect symbols imported from R plots, which has been fixed (https://bugs.launchpad.net/inkscape/+bug/190541).
4) For comment #15 it seems we never got an example file. So I generated one myself and migrated the issue to https://gitlab.com/inkscape/inbox/-/issues/3416.
5) For comment #20, again, use the Poppler import which converts the text to glyphs (which are embedded in the PDF file).
6) Comment #21: idem. Just because you can compile a Latex document doesn't mean you have the fonts installed (in a sense that they are visible to Inkscape). Latex doesn't even store fonts in a standard ttf / whatever format, but uses their own proprietary one.
7) Regarding #24: The misc2svg service has been discontinued, but again, the file imports fine using Poppler import.
8) Regarding #29 and #30: There's not enough information to replicate the issue (e.g. example file), and also no mention of Inkscape version. If you still experience this issue, please open a report in
http://inkscape.org/report.

Closed by https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.