font substitution is silent

Bug #168658 reported by Aglnl
86
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
John Smith

Bug Description

It's great to have font substitution, however it should not be completely
silent/automatic.
When I load an SVG into 0.45 and I'm missing a font, I don't see anything
indicating that a font was missing and which one was substituted.

I only noticed because some of the artwork was stuffed up and the font
curves looked different from what they were supposed to be.

It'd be good to get a dialog indicating which font is missing, and a list
of alternative fonts/actions to undertake.
It could even link to a number of (free) font sites online to try and pick
up the missing font, for instance.

In any case, the complete automated silence is what got me. That's just
dangerous.

Tags: fonts
Revision history for this message
Mercury (mercury13) wrote :

Changing to wishlist. Again comparing with old outdated Corel Draw 5 - if a font is missing, it suggest an alternative.

Changed in inkscape:
importance: Undecided → Wishlist
vonHalenbach (lustik)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

At least it would be nice to get a warning when opening a file with missing fonts as a first step.
And manual kerning should be removed if the font was replaced.

I think this problem has two parts. One is a bug (user doesn't get feedback and original information is silently discarded) and the other can be a nice feature addition in the future (the font alternatives dialog).
IMO the "bug" part should be addressed as soon as possible.

Revision history for this message
Brandon Rhodes (brandon-rhodes) wrote :

I think that errors should be printed to stderr when Inkscape is run in batch mode and cannot find a font. I am trying to advocate the use of Inkscape in the rendering tool chain of a professional print shop, but it would be a disaster for a customer to submit an SVG file and receive their several-hundred-dollar printing job back, only to discover that we had silently replaced one of their designer's carefully-chosen fonts with Helvetica! :-)

If the font-fallback code could just provide some external indication that a font is missing, then my toolchain can halt and ask for human intervention before making a costly mistake.

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

After some incidents with this "feature" I changed my mind about this issue: This is a bug, not a feature request.
A missing font should be replaced by the default font but the text elements with missing fonts should be marked so the user notice that a substitution took place.
A designer choose a font family because he wants that font for his design, not a similar font or another one, and if the font isn't present in the computer that opens the file, then there is a problem and the appearance of the original design isn't preserved.
The substitution should be performed only to assure the editability of the text, not to fix the problem automatically. There are so many variations of popular families that is possible that a substitution for a font with a similar name ends up in a complete mess (there are minor width variations between similar fonts that may break the appearance of a text block, displacing words beyond the box limits, for instance).
The user has to know that the text was replaced. The XML tree keeps the name of the original font, even after a substitution, so it shouldn't be a big deal to detect a text element with a font mismatch and apply some highlighting.
The result of an overlooked font substitution can be a real catastrophe if the design goes to a print shop. And that sounds pretty bad to me, enough to turn this wishlist item into a high priority bug.

Changed in inkscape:
importance: Wishlist → High
Revision history for this message
AnnaMarburg (marburgster) wrote :

Not only does inkscape silently replace fonts, it does so even if you un-tick the "Replace PDF fonts by closest-named installed fonts" box

This happened to me with inkscape-0.47pre3-2.leopard+.dmg; OSX 10.6.1.

The file started life as a map in ESRI's ArcMap software, was exported as an .ai file and then modified by my office's graphics department using a recent version of adobe illustrator and sent to me as a .pdf

Adobe reader indicates that the pdf contains 3 fonts: HelveticaNeueCE - Roman, N261 and N268. N261 and N268 are embedded, so it looks like illustrator made names for them, as I cant find them on the web.

N261 appears to be the text that was in the original map (I think it's arial ) Inkscape uses Bitstream Vera Sans - which turns out to be acceptable for my purposes. The text added by my graphics department using illustrator (don't know the version, but it's recent) is in font N268. Inkscape replaces N268 with Helvetica CY - as the text was written in english, displaying it in cyrillic characters is quite problematic.

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

I just found that Adobe type1 are always replaced by the first font in the list of available fonts, no matter what import option you chose.

jazzynico (jazzynico)
tags: removed: all-platforms
Revision history for this message
John Smith (john-smithi) wrote :

Initial patch to warn via command line when font substitution happens, can be used in a batch mode setting.
No UI dialog is displayed.
Tested with svg files on 0.48+dev/Ubuntu 11.10

What is the best way to propagate these warnings up from the text renderer to the UI ?

Could we set the substituted font name in the '-inkscape-font-specification' style but leave the 'font-family' as the original font.
When the document is fully loaded compare the original font with the substituted font and highlight via UI any differences then ?

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

Here's an idea about how to highlight the font replacement on the artwork.
The idea is to use the same "style" used to highlight text selections but with inverted hue.

Revision history for this message
John Smith (john-smithi) wrote :

How about this dialog that lists the replaced fonts and gives the user the option to select all the affected objects.
With the objects selected the user has full control to do whatever they want
* Replace the font using the Text tool, or
* Highlight by setting the background / text color, or
* Highlight by using a Filter like Morphology->'Outline' that can be toggled on and off.

@gez, I like the proposal, but instead of a special font substitution highlight mode (that would need show/hide controls) if we select the objects, the user can do any kind of highlighting, deleting or replacing without a special mode.

Changed in inkscape:
assignee: nobody → John Smith (john-smithi)
Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote : Re: [Bug 168658] Re: font substitution is silent

I like the idea, but I see a problem.
First, automatic and multiple replacements are a problem. You can have, say
5 replacements and three or them are fine but the other three aren't. How
do you tackle that?
I mean, if the replacement feature did a good job finding similar fonts for
a part of the replaced fonts but a crappy job with the rest, how do you fix
it with your dialog?
The "select all the affected objects" box doesn't help at all.
In my opinion, automatic replacement is a double-edged knife. For
typography purists there's no such thing as a replacement, and the only
replacement that can be tolerated is when you have the right font but it
has a slightly different name.
When you care about typography you want your fonts to be the right fonts,
not others.
And doing automatic replacements without highlighting the replaced fonts is
dangerous. Sometimes a replaced text object in the middle of others can
spoil the entire piece if you send it to print like that.

If a dialog like yours is used, we need to see what elements were changed
in their context and offer the user the ability to approve or not the
change, but in a single font basis.

Revision history for this message
John Smith (john-smithi) wrote :

I propose we limit the scope of this bug to the most important and basic feature of "warning of font substitutions" including:

  1. Warning the user that font substitutions happened (with a warning dialog and command line warning)
  2. Listing the missing fonts - so the user knows exactly what is needed for a perfect layout
  3. Selecting/highlighting the text objects that have been substituted so the user can examine further

The more advanced feature could be moved to separate feature requests

  a) An interactive font alternative suggestion dialog
  b) Linking to font repositories to try and find missing fonts, etc...

The proposed dialog (in comment #9) is intended to cover the basic features only.

Revision history for this message
John Smith (john-smithi) wrote :

@gez, thanks for the feedback. A few followup comments and questions ...

> Comment #2 : I think this problem has two parts. One is a bug (user doesn't get feedback and original information is silently discarded) and the other can be a nice feature addition in the future (the font alternatives dialog). IMO the "bug" part should be addressed as soon as possible.

I completely agree with this. I think my suggested dialog covers the "bug" part of the problem - it warns the user of missing fonts and lists the missing fonts.

> Comment #4 : The text elements with missing fonts should be marked so the user notice that a substitution took place.

Agreed, and i think my suggested dialog does this by selecting all the affected text elements.

> Comment #10: The "select all the affected objects" box doesn't help at all.

I dont agree. Selecting all the substituted text gives the user clear visual feedback on what objects have been substituted. Once selected the user can apply any kind of filtering, coloring or highlighting to further examine if the substitutions are acceptable or not.

Instead of selecting the affected text elements would you prefer to apply a filter - such as Fill and Transparencey->'Fill Background', or Morphology->'Outline' to highlight the elements ?

Revision history for this message
su_v (suv-lp) wrote :

The patch from comment #7 outputs a warning to the console when using the default font 'Sans' e.g. for a new text object:

** (inkscape:66881): WARNING **: Failed to load font 'Sans' substituted with 'Bitstream Vera Sans'.

IMHO in this situation this warning should not occur: 'Sans' is a valid, generic font name - used in Inkscape as default font since 0.48 (default prefs) - and substituted depending on the system font configuration. Inkscape should not default to a font and at the same time warn about it when using it.

Revision history for this message
su_v (suv-lp) wrote :

> used in Inkscape as default font since 0.48 (default prefs)

See <http://wiki.inkscape.org/wiki/index.php/Release_notes/0.48#Notable_bug_fixes>:
«The default font has been changed to Sans, eliminating problems when the former default font, Bitstream Vera Sans, is not available. (Sans is a Pango pseudo-font.) »

Revision history for this message
John Smith (john-smithi) wrote :

Attached patch for basic font substitution warnings :
* Show a dialog listing which fonts have been substituted and the ability to select those affected objects
* Write warning message to the console when fonts have been substituted
* Inkscape preference (Tools->Text->Font warning dialog .. is there a better place??) to turn the warnings on/off (default is off)
* No warnings for "Sans" and "sans-serif" font substitutions - since they are assumed as "defaults"

Please test if you can, there may be some undetected cases.

Changed in inkscape:
status: Confirmed → In Progress
Revision history for this message
John Smith (john-smithi) wrote :

Committed to trunk as r11522.

By default this warning dialog is not shown.
Can be turned on in the Preference dialog : Tools->Text->"Show font substitution warning dialog"

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

The error message isn't quite right in all cases. Inkscape support CSS font fallbacks. You can have a list of fonts such as:

Gobbly Gook, Times New Roman, serif

If Gobbly Gook is not present, Times New Roman will be used. The error message incorrectly reports that another font is being substituted (DejaVu Sans on my Linux system).

Two other notes:

1. The correct fallback fonts of last resort should be "sans-serif" and "serif". These are defined by CSS. I changed the old default "Sans" to sans-serif a couple of months ago. "Sans" is a Cairo thing and not defined by CSS.

2. The font selection entry box will show a warning sign if the font for a selected text object is not present (first font in case of a font list).

Revision history for this message
su_v (suv-lp) wrote :

> 1. The correct fallback fonts of last resort should be "sans-serif" and "serif".

@Tav - inkscape doesn't handle 'sans-serif' well yet:
Bug #1002757 Regressions with new default font 'sans-serif' (r11393)
<https://bugs.launchpad.net/inkscape/+bug/1002757>

Revision history for this message
su_v (suv-lp) wrote :

r11522 breaks building with GTK3:

  CXX ui/dialog/font-substitution.o
../../src/ui/dialog/font-substitution.cpp: In member function ‘void Inkscape::UI::Dialog::FontSubstitution::show(Glib::ustring, GSList*)’:
../../src/ui/dialog/font-substitution.cpp:94: error: ‘CheckButton’ is not a member of ‘Gtk’
../../src/ui/dialog/font-substitution.cpp:94: error: ‘cbSelect’ was not declared in this scope
../../src/ui/dialog/font-substitution.cpp:94: error: expected type-specifier
../../src/ui/dialog/font-substitution.cpp:94: error: expected `;'
../../src/ui/dialog/font-substitution.cpp:99: error: ‘CheckButton’ is not a member of ‘Gtk’
../../src/ui/dialog/font-substitution.cpp:99: error: ‘cbWarning’ was not declared in this scope
../../src/ui/dialog/font-substitution.cpp:99: error: expected type-specifier
../../src/ui/dialog/font-substitution.cpp:99: error: expected `;'
../../src/ui/dialog/font-substitution.cpp:104: error: invalid conversion from ‘Gtk::Box*’ to ‘Gtk::VBox*’
make[3]: *** [ui/dialog/font-substitution.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Revision history for this message
John Smith (john-smithi) wrote :

Hopefully r11524 fixes the GTK3 compile issue (#19).

su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
Revision history for this message
su_v (suv-lp) wrote :

> Hopefully r11524 fixes the GTK3 compile issue (#19).

Confirmed with GTK3/x11 3.4.3, gtkmm 3.4.0 on OS X 10.7.4 - thx :)

Revision history for this message
John Smith (john-smithi) wrote :

r11533 : Fix for CSS font fallbacks (#17)

@Tav, thanks for finding that.

>2. The font selection entry box will show a warning sign if the font for a selected text object is not present (first font in case of a font list).
Could show the substituted font in the tooltip perhaps.

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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