FontSelection

From Inkscape Wiki
Revision as of 20:17, 15 April 2018 by Tavmjong (Talk | contribs) (Created page with "A page to track font selection issues: == Inkscape's Font Selection == Inkscape has two ways of selecting a new font: # Through drop-down menus (ComboBoxText) in the Text to...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A page to track font selection issues:

Inkscape's Font Selection

Inkscape has two ways of selecting a new font:

  1. Through drop-down menus (ComboBoxText) in the Text toolbar.
  2. Through a special widget in the Text and Font dialog.

The Glyph panel also allows a font to be selected but this only effects which glyphs are shown in that dialog.

All selection methods rely on the Inkscape FontLister class for generating the list of fonts to be shown.

GTK's Font Widget and Dialog

Gtk has it's own font selection widget and dialog. These differs from Inkscape's font selection widget in the following ways:

  • Inkscape disables Faux Font Face selection. Designers would rarely would want a synthesized face.
  • Inkscape lists fonts used in a document first. This includes CSS font fallback lists (e.g. "Times New Roman", Times, serif).
  • Inkscape shows fonts used in a document but are not found on the system appear with a strike-through.
  • Inkscape displays the names of generic CSS fonts using their CSS values ("Sans" appears as "sans-serif").
  • Inkscape includes only one entry for faces that cannot be distinguished uniquely by CSS (and Pango). The GTK font selector shows all faces but the rendering of some are incorrect.
  • Inkscape shows both the CSS name and the Display name for font faces.
  • Inkscape renames some weights to match CSS: "Book" -> "Normal", etc.
  • Inkscape has separate sections for family and style. The style options are updated when a new family is selected.
  • Inkscape does not show

Inkscape's FontLister

A class for listing fonts.

FontLister is a singleton... but it also tracks fonts used by a document. There really should be one instance per document. FontLister contains a Gtk::TreeModel for font family and one for font style. The style model is updated to match the selected font.

Three widgets use FontLister:

  1. FontSelector (TextEdit.cpp) [ListView]
  2. FontSelector (Glyphs.cpp) [ListView]
  3. Widget in Text Toolbar [ComboBoxText]

Each widget updates FontLister when selection is changed. FontLister should be updated once after which the three widgets should update the selected font/style. FIXED

One possible solution is to only update on document read and if a new font is added via the toolbar (the only place a new document font can be added).