Comment 4 for bug 179589

Revision history for this message
KoRi (koen-ribus) wrote :

After some testing with pdfs created in different ways I think that there is not a general way to recreate the original font names from the names specified in the pdf. Spaces are removed, but for example Times New Roman can get shortened to Times, ...

A possible solution is to scan the available fonts and compare their names with the names in the pdf to see which one matches best, taking into account that spaces can be removed, ... Fonts that are not availble, will not get a reasonable match and can be replaced by a default font.

The attached patch can be used to test this idea ... However when this solution is chosen, some points should be clarified to ensure that everything is handled in the correct way:

- For now I only search for a match if the pdf specifies no 'font family' ... Maybe the best match to the specified family should be found when it is specified? (The only application I tested that seems to specify the family in the pdf was Adobe Illustrator and it includes the spaces ... as such it does not need matching ... but that's no guarantee of course).

- What value should '-inkscape-font-specification' get?

- If no reasonable match is found (ie. the font is probably not available) now a default font is chosen but it maybe (?) the font specification from the pdf should be kept in the svg for a possible substitution with the correct font later in time. However this would require a similar substitution at the "svg-side" ... A more general tought regarding this is whether svg-files are garanteed to specify the font names correctly (also if they come from other applications)? If not, shouldn't font substitution occur also on loading (and importing) svg files?

Would appreciate if I could get some feedback on whether / how to proceed on this track. Thanks.