Regressions with new default font 'sans-serif' (r11393)

Bug #1002757 reported by su_v
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
John Smith

Bug Description

In revision 11393 Inkscape's default font was changed to 'sans-serif'. AFAICT this breaks several aspects of font handling in the text tool and the 'Text and Font …' dialog: The underlying issue seems to be that Inkscape does not recognized 'sans-serif' as "installed" font (related to case-sensitive parsing of font names (?)).

Steps to reproduce (quit inkscape first):
 1) mv ~/.config/inkscape ~/.config/inkscape.bkp
 2) launch inkscape (opens new empty document)
 3) switch to the text tool
    (note: font family selector in the controls bar is empty)
 4) create new text object #1 (regular text)
    (note: text tool reports "Font not found on system")
 5) switch back to the select tool, select text object #1
    (note: status line message reports <no name found>)
 6) open 'Text > Text and Font…'
    (note: font preview area is empty)
 7) switch to the text tool
 8) create new text object #2 with different text content
 9) select a different font from the dropdown list on the
    text tool controls bar for text object #2
    (note: font preview area shows content of text object #2,
           using the just assigned font family)
10) switch back to the select tool, select text object #1
    (note: font preview area is stuck displaying the content
           of previously selected text object #2)

Details:
1) Text Tool (controls bar):
- The font family selector is empty now when activating the Text tool (before clicking on the canvas to create a new text object).
- The font family selector of a newly created text (font family "sans-serif") warns about "Font not found on system".
- The font style selector is empty and does not allow to set a bold or italic style for text with default font (>= r11586).
- (…)

2) Status Bar:
- The message in the status bar for such a text object with the new 'sans-serif' default font doesn't inform about the font family:
"Text (<no name found>, 40px) in layer Layer 1."

3) 'Text > Text and Font…' dialog:
- The generic font family 'sans-serif' is not listed, other generic font names like 'Sans', 'Serif' and 'Monospace' however are.
- This new default font cannot be restored from within the 'Text and Fonts…' dialog (because 'sans-serif' cannot be selected).
- Due to the "missing" font, the dialog does not render a preview of such a text object with the new default font 'sans-serif'.
- If switching between a text object with the new default font ('sans-serif') and a text object using an "installed" font family, the preview sticks to the content of the last selected object with a font found to be installed on the system, and does not update when reselecting the text object with the new default font ('sans-serif') -> the dialog shows a preview text not related to the currently selected object.
- (…)

Related reports:
- Bug #379885 “Generic font-family names not recognized in font lister”
  <https://bugs.launchpad.net/inkscape/+bug/379885>
- Bug #667091 “Fonts initially indicated as 'not found on system'”
  (Possibly fixed in in earlier revision 10491)
  <https://bugs.launchpad.net/inkscape/+bug/667091>
- Bug #932048 “Text and Font dialog : Make consistent with text toolbar”
  <https://bugs.launchpad.net/inkscape/+bug/932048>
- Bug #1088475 “sans-serif text cannot be formatted”
  <https://bugs.launchpad.net/inkscape/+bug/1088475>
- (…)

Tested and confirmed on Mac OS X 10.5.8 with
- fontconfig 2.8.0, freetype 2.4.5, cairo 1.10.2, pango 1.28.4
and on OS X 10.7.4 with
- fontconfig 2.9.0, freetype 2.4.9, cairo 1.12.2, pango 1.30.0
using the same default font backend as on linux (i.e. inkscape/Gtk+ running under X11).

Note: the native font backend of pango on Mac OS X (pango 1.28: ATSUI, pango 1.30.0: CoreText) introduce additional issues which are _not_ in the scope of this bug report.

fontconfig does find a match for 'sans-serif' on both test systems:
$ fc-match sans-serif
Vera.ttf: "Bitstream Vera Sans" "Roman"
$ fc-match Sans-Serif
Vera.ttf: "Bitstream Vera Sans" "Roman"
$ fc-match sans
Vera.ttf: "Bitstream Vera Sans" "Roman"
$ fc-match Sans
Vera.ttf: "Bitstream Vera Sans" "Roman"
$

Revision history for this message
jazzynico (jazzynico) wrote :

Confirmed on Debian Wheezy, Inkscape revision 11457.

All fc-match commands return: DejaVuSans.ttf: "DejaVu Sans" "Book".

Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.49
status: New → Triaged
su_v (suv-lp)
description: updated
Revision history for this message
Alvin Penner (apenner) wrote :

proposing to raise the importance of this bug to "High". It is very unnerving to encounter an error message on the first usage of the text tool with an empty preferences file. Attached is a screenshot of what happens on Windows XP, recent build. When choosing the text tool, the font family box is initially blank. Then after typing some text, the name sansserif appears with an error symbol.

the behaviour of 0.48.3.1 is preferable. The word Sans appears immediately, and I am given to understand that this means default, which on my system is Arial, which is fine.

su_v (suv-lp)
description: updated
ScislaC (scislac)
tags: added: blocker
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

"Sans' is not defined by CSS. It will work with Pango but will not work as expected with other SVG renderers. Reverting back to "Sans" is not the answer. Change was made in revision 11393.

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

A possible solution is to replace some pango font family names with generic css equivalents whilst still using those pango fonts
Sans -> sans-serif
Serif -> serif
Monospace -> monospace

One issue is that existing files with those fonts (Sans , Serif, Monospace) will see the warning (!) in the text toolbar about unknown font, however the correct font should be rendered.

Any thoughts ?

Changed in inkscape:
assignee: nobody → John Smith (john-smithi)
Revision history for this message
su_v (suv-lp) wrote :

On 14/12/2012 06:45, John Smith wrote:> One issue is that existing files with those fonts (Sans , Serif,
> Monospace) will see the warning (!) in the text toolbar about unknown
> font, however the correct font should be rendered.

While rendering is identical, the solution in the patch seems to transfer the problem to those _editing_ text in existing files created with Inkscape's prior default font ('Sans') or e.g. with 'Monospace':
- The text tool controls bar can't style an "unknown" font ('Sans', 'Monospace', …):
The style selector has no effect (bold, italic, etc.), and does not reflect how the font is actually rendered on-canvas.
- Inconsistent information about font name:
The 'Text and Font…' dialog and the status bar show a different font name ('sans-serif', 'monospace') than the text tool controls bar ('Sans', 'Monospace').

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

We should fix the problems with the style selector and with the Text and Font dialog, status bar, and Text-Tool controls. Going back to "Sans" I don't think is a valid option.

A little history. At one point the default font was Bitstream Vera Sans. This font was likely only installed on Linux systems and caused problems for those who didn't have the font installed. I changed it a couple of years ago to Sans based on what Pango does (incorrectly, I now believe). This causes problems for those viewing the SVG outside of Inkscape since there is no font (that I know of) simply called Sans. Pango will match Sans to the generic CSS font name "sans-serif" and thus use the CSS "sans-serif" fall-back font so viewing old Inkscape files shouldn't be a problem.

A related problem is that Pango is happy to manufacture oblique/italic font faces from regular fonts by slewing the regular face. This is probably valid for content viewers but probably not for content creators (e.g. Inkscape). It will also happily list bold font faces where none actually exist (but does not manufacture a bold face). It would be better if we could generate a list of font faces that are actually installed on a users computer. (Note, the creation of oblique/italic/bold font faces where none exist is probably a configuration option, at least on Linux; see: /etc/fonts/conf.d/90-synthetic.conf.)

A final problem that we should address is that Inkscape wraps a font list with single quotes. This breaks the use of font lists in other SVG renders. Single quotes should be put around individual fonts if the font name contains a space.

CSS Font specification (which SVG 1.1 references):
http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-specification

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

On 16/12/2012 08:41, Tavmjong Bah wrote:
> A final problem that we should address is that Inkscape wraps a font
> list with single quotes. This breaks the use of font lists in other SVG
> renders. Single quotes should be put around individual fonts if the font
> name contains a space.

AFAIU this has been reported as separate bug earlier:
- Bug #1029080 “inkscape adds messed font family to style attribute”
  <https://bugs.launchpad.net/inkscape/+bug/1029080>

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

Any suggestions on how to improve the handling of existing files with "Sans" etc text ?
* One option would be to automatically convert Sans to sans-serif on load ...

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

I don't think automatically converting Sans to sans-serif is a good idea, somebody may be relying on the font being named Sans (for example, in post-processing the file or in scripting). We've seen this kind of problem before (e.g. with guides). We could have a generic pop-up window in opening a file, asking the user if Inkscape should do the conversion... maybe one pop-up with a list of all detected problems and check boxes for what gets converted.

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

There is a dialog (Preferences->Tools->Text->Font substitution warning) that lists all substituted fonts and selects them on canvas so users can action them (bug #168658).

Shall we commit this fix and potentially improve the font substitution dialog (once there is consensus on how it should work) ?

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

Committed as r12089.
Any suggestions to improve handling of existing font names (Sans , Serif, Monospace) welcome.

Changed in inkscape:
status: Triaged → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

John Smith wrote on 2013-02-02:
> Committed as r12089.

With my main setup for inkscape trunk builds [1], text handling with revision >= 12089 becomes tediously slow: long delays when entering new text until the characters appear one by one on-canvas, long delays when dragging a text object around the canvas with the select tool.

I fail to reproduce it in other build envs which have varying OS (Mac OS X 10.5, 10.7, Ubuntu 12.04, 12.10), architectures (32bit, 64bit), older or newer versions of the dependencies, different backends (X11, Quartz) and fewer installed fonts (Ubuntu VMs only use the minimal set installed with the distro).

Any ideas what to look out for?

-----
[1] This used to be my most stable and reliable build environment for inkscape trunk for now:
OS X 10.7.4, XQuartz 2.7.4 (xorg-server 1.13.0), llvm-gc-4.2, GTK+/X11 2.24.13, gtkmm 2.24.2, glib 2.32.4, glibmm 2.32.1, boost 1.49.0, pango 1.30.1, fontconfig 2.9.0 (with mostly vanilla config)), 2695 fonts listed by fontconfig (1075 distinct families).

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

John Smith wrote on 2013-02-02:
> Any suggestions to improve handling of existing font names
> (Sans , Serif, Monospace)

Latest changes wrt to text&fonts (r12093) trigger a crash if trunk is launched using old preferences from stable (default font: 'Sans'), see bug #1114243.

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

~suv (suv-lp) wrote 23 hours ago
> With my main setup for inkscape trunk builds [1], text handling with
> revision >= 12089 becomes tediously slow: (…)

Problem no longer reproduced with r12096 compiled this morning - no idea what caused it to only show up with that particular build setup, but I'm happy to report that it's gone now :-)

tags: removed: blocker
Revision history for this message
André S. (anschitech) wrote :

I think I saw a related behaviour.
First off, my documents saved with the 0.48 Inkscape did look strange in 0.91 r137725.
I used Sans as my font, but after loading, it was displayed with a non-sans font and even choosing sans-serif did not fix it.
I work on a Windows system and had to change all text blocks to Arial to fix it for me.
I think that should be fixed, since at least for me it broke all my older files, that are no longer displayed correctly in the 0.91 release.

Revision history for this message
André S. (anschitech) wrote :

Today I opened a file where Inkscape reports a "Courier" font. And the 0.48 release used then a courier font.
But 0.91 displays a sans-serif font where it should display a serif font.
This is from an import of a pdf file.
Again: this worked with the 0.48 release.
Not OK. :(

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
jazzynico (jazzynico) wrote :

@André S. Confirmed on Windows XP with 0.91. Looks like Bug #408653 "Inkscape font: Courier -> Sans" but for Windows users.
I'm going to open a new specific report.

Revision history for this message
jazzynico (jazzynico) wrote :

Follow-up report: Bug #1429793 "Inkscape font: Courier -> Sans (Windows)"
<https://bugs.launchpad.net/inkscape/+bug/1429793>

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.