Using fonts: Difference between revisions

From SuperMemo Help
Jump to navigation Jump to search
No edit summary
Line 9: Line 9:
== Where are the fonts defined?  ==
== Where are the fonts defined?  ==


The way you see fonts in SuperMemo can be defined in a number of ways. Here are the most often used methods:  
The way you see fonts in SuperMemo can be defined in a number of ways. Here are the most often used methods:  


#'''HTML (WYSIWYG)''': Inside the HTML component, which is the default text component, you can change fonts by choosing options from the '''Text : Font''' submenu of the [[component menu]], or using shortcuts such as ''Ctrl+B'' for bold, ''Ctrl+]'' to increase the size of the font, etc. Note that those operations may override your stylesheet settings and might prevent global change to fonts.
#'''HTML (WYSIWYG)''': Inside the [[HTML component]], which is the default text [[Glossary:Component|component]], you can change fonts by choosing options from the '''[[Component menu#Text|Text]] : Font''' submenu of the [[component menu]], or using shortcuts such as ''Ctrl+B'' for bold, ''Ctrl+]'' to increase the size of the font, etc. Note that those operations may override your stylesheet settings and might prevent global change to fonts.
#'''HTML code''': If you understand HTML, you can edit texts using components' HTML source code (e.g. by using ''Ctrl+Shift+F6'' over the component). Note that this method may override your stylesheet settings and might prevent global change to fonts.
#'''HTML code''': If you understand HTML, you can edit texts using [[Glossary:Component|component]]'s HTML source code (e.g. by using ''Ctrl+Shift+F6'' over the component). Note that this method may override your stylesheet settings and might prevent global change to fonts.
#'''Font registry''': Font [[Using registries|registry]] can be used to store reusable fonts (e.g. for plain text components, templates, or frequently used font definitions for HTML). Font registry can be inspected with '''[[Search menu|Search]] : Other registries : Font'''. You can use '''Text : Font : Edit font''' in [[Using text components|text components]] to modify a font linked from a registry. '''New font''' can be used to define a new font. Finally, you can use '''Link font''' to link a component with an existing font definition in the registry. The registry and the font definitions are stored in the [[Collection files|''registry/font.* files'']]. A definition of a registry-stored font in SuperMemo includes the typeface (e.g. ''Arial, Verdana'', etc.), size, color, and style (e.g. bold, italic, etc.).  
#'''Font registry''': Font [[Glossary:Registry|registry]] can be used to store reusable fonts (e.g. for plain text [[Glossary:Component|components]], [[Glossary:Template|templates]], or frequently used font definitions for HTML). Font [[Glossary:Registry|registry]] can be inspected with '''[[Search menu|Search]] : [[Search menu#Other registries|Other registries]] : Font'''. You can use '''[[Component menu#Text|Text]] : Font : Edit font''' in text [[Glossary:Component|components]] to modify a font linked from the registry. '''[[Component menu#Text|Text]] : Font : New font''' can be used to define a new font. Finally, you can use '''[[Component menu#Text|Text]] : Font : Link font''' to link a [[Glossary:Component|component]] with an existing font definition in the registry. The registry and the font definitions are stored in the [[Collection files|''registry/font.* files'']]. A definition of a registry-stored font in SuperMemo includes the typeface (e.g. ''Arial'', ''Verdana'', etc.), size, color, and style (e.g. bold, italic, etc.).  
#'''Options''': '''[[Tools menu|Tools]] : [[Options]] : [[Fonts tab in Options|Fonts]]''' makes it possible to define default fonts, font displayed in the [[Contents window|content window]], interface font, etc. If you check '''Use question and answer fonts in HTML''', you can define the font originally used when starting a new question or a new answer. Note that this font will override the stylesheet used in HTML components. Definitions of fonts defined in '''Options''' are stored in INI files: [[Collection files|''supermemo.ini'']] (if SuperMemo specific) and [[Collection files|''collection.ini'']] (if collection specific)  
#'''Options''': '''[[Tools menu|Tools]] : [[Options]] : [[Fonts tab in Options|Fonts]]''' makes it possible to define default fonts, font displayed in the [[Contents window|'''Contents''' window]], interface font, etc. If you check '''Use question and answer fonts in HTML''', you can define the font originally used when starting a new question or a new answer. Note that this font will override the stylesheet used in [[HTML component|HTML components]]. Definitions of fonts defined in '''[[Options]]''' are stored in INI files: [[Collection files|''supermemo.ini'']] (if SuperMemo specific) and [[Collection files|''collection.ini'']] (if collection specific)  
#'''Internet Explorer''': Default HTML font can be defined in Internet Explorer with '''Tools : Internet Options : General : Fonts'''. This font will affect HTML texts that do not define the ''<font>'' tag (i.e. have not been previously formatted), and do not use any stylesheet. Note that also: '''Tools : Internet Options : General : Accessibility''' in Internet Explorer can affect the way fonts are displayed in [[HTML component|HTML components]].  
#'''Internet Explorer''': Default HTML font can be defined in Internet Explorer with '''Tools : Internet Options : General : Fonts'''. This font will affect HTML texts that do not define the ''<font>'' tag (i.e. have not been previously formatted), and do not use any stylesheet. Note that also: '''Tools : Internet Options : General : Accessibility''' in Internet Explorer can affect the way fonts are displayed in [[HTML component|HTML components]].  
#'''Stylesheets''': Stylesheets in SuperMemo can be used to define fonts in HTML components. Several classes can have their font defined (e.g. texts, extracted texts, search highlights, references, etc.) in a SuperMemo stylesheet. The default stylesheet is defined in '''[[Tools menu|Tools]] : [[Options]] : [[Fonts tab in Options|Fonts]] : Stylesheet'''. Individual components or templates can have their stylesheet changed with options on the [[Component menu|component menu]] listed at '''Text : Style''' submenu. Stylesheets are you best way to globally change fonts in HTML components.
#'''Stylesheets''': Stylesheets in SuperMemo can be used to define fonts in [[HTML component|HTML components]]. Several classes can have their font defined (e.g. texts, <span class="extract">extracted texts</span>, <span class="SearchHighlight">search highlights</span>, <span class="reference">references</span>, etc.) in a SuperMemo stylesheet. The default stylesheet is defined in '''[[Tools menu|Tools]] : [[Options]] : [[Fonts tab in Options|Fonts]] : Stylesheet'''. Individual [[Glossary:Component|components]] or [[Glossary:Template|templates]] can have their stylesheet changed with options on the [[component menu]] listed at '''[[Component menu#Text|Text]] : Style''' submenu. Stylesheets are you best way to globally change fonts in [[HTML component|HTML components]].


== How are texts encoded?  ==
== How are texts encoded?  ==

Revision as of 15:29, 3 March 2016

With the universal adoption of Unicode since SuperMemo 15, fonts should not longer be a headache as they used to be in previous versions of SuperMemo for Windows.

You still, however, have a confusing array of choices, and if you are not sure which component and which encoding you should use, use the default HTML component. This means that you do not need to change anything to start using fonts and richly formatted texts.

If you still want to explore all options available, you may wish to know that the way you use fonts in SuperMemo depends on the type of the component, the way the font is defined, and the way the texts are encoded. The number of possible combinations of these three may lead to a substantial confusion (not only among SuperMemo beginners). If fonts and encodings are important for your learning material (e.g. if you learn foreign languages using non-Latin alphabets), it is important that you make good choices in the way you use fonts before you embark on a major expansion of your collection. The summary overview below will help you understand the terminology of fonts as well as the pros and cons of different choices.

Where are the fonts defined?

The way you see fonts in SuperMemo can be defined in a number of ways. Here are the most often used methods:

  1. HTML (WYSIWYG): Inside the HTML component, which is the default text component, you can change fonts by choosing options from the Text : Font submenu of the component menu, or using shortcuts such as Ctrl+B for bold, Ctrl+] to increase the size of the font, etc. Note that those operations may override your stylesheet settings and might prevent global change to fonts.
  2. HTML code: If you understand HTML, you can edit texts using component's HTML source code (e.g. by using Ctrl+Shift+F6 over the component). Note that this method may override your stylesheet settings and might prevent global change to fonts.
  3. Font registry: Font registry can be used to store reusable fonts (e.g. for plain text components, templates, or frequently used font definitions for HTML). Font registry can be inspected with Search : Other registries : Font. You can use Text : Font : Edit font in text components to modify a font linked from the registry. Text : Font : New font can be used to define a new font. Finally, you can use Text : Font : Link font to link a component with an existing font definition in the registry. The registry and the font definitions are stored in the registry/font.* files. A definition of a registry-stored font in SuperMemo includes the typeface (e.g. Arial, Verdana, etc.), size, color, and style (e.g. bold, italic, etc.).
  4. Options: Tools : Options : Fonts makes it possible to define default fonts, font displayed in the Contents window, interface font, etc. If you check Use question and answer fonts in HTML, you can define the font originally used when starting a new question or a new answer. Note that this font will override the stylesheet used in HTML components. Definitions of fonts defined in Options are stored in INI files: supermemo.ini (if SuperMemo specific) and collection.ini (if collection specific)
  5. Internet Explorer: Default HTML font can be defined in Internet Explorer with Tools : Internet Options : General : Fonts. This font will affect HTML texts that do not define the <font> tag (i.e. have not been previously formatted), and do not use any stylesheet. Note that also: Tools : Internet Options : General : Accessibility in Internet Explorer can affect the way fonts are displayed in HTML components.
  6. Stylesheets: Stylesheets in SuperMemo can be used to define fonts in HTML components. Several classes can have their font defined (e.g. texts, extracted texts, search highlights, references, etc.) in a SuperMemo stylesheet. The default stylesheet is defined in Tools : Options : Fonts : Stylesheet. Individual components or templates can have their stylesheet changed with options on the component menu listed at Text : Style submenu. Stylesheets are you best way to globally change fonts in HTML components.

How are texts encoded?

Character encoding is a code that matches a set of characters with a specific sequence of numbers. Computers store all texts as numbers. For example, in ASCII encoding, numbers 97, 98, and 99 code for characters a, b, and c. Thus a sequence 97-98-99 codes for abc. SuperMemo uses 3 basic character encoding systems: ANSI, UTF-8 and 16-bit Unicode. ANSI is used to represent simple texts made of up to 255 characters taken from any number of 255-character sets. In ANSI encoding, interpretation of individual codes depends on the character encoding table called a code page. Unicode is used to represent texts with virtually all commonly used characters. UTF-8 encoding is used to represent Unicode characters with 8-bit characters in such a way that all ASCII texts are unchanged and all non-ASCII characters have the most significant bit set.

Character encodings used in SuperMemo

  • ANSI: ANSI is only used in SuperMemo for compatibility with older versions of SuperMemo. Those texts cannot use more than 255 characters, but use minimum space. Fonts used with this encoding are also referred to as OEM fonts and can be defined with the help of code pages (some older collections may still be based on code pages and OEM fonts). Internally, SuperMemo converts all character strings to Unicode (UTF-16).
  • Unicode: UTF-16 encoding is used throghout SuperMemo as the default encoding. UTF-16 texts can use virtually all commonly used characters. HTML components represent Unicode characters using HTML codes. For example: the letter µ is represented as a sequence of ASCII characters: &#181; where 181 is its Unicode number. You can inspect HTML representation of non-ASCII characters in HTML components with Shift+Ctrl+F6 (File : View source)
  • UTF-8: To reduce the size of collections, UTF-8 is used to encode Unicode characters in the text registry (Search : Texts). This makes it possible to uniformly encode all ANSI and Unicode texts and quickly search these texts using the same fast low-level search procedure (e.g. using Search : Find elements). Use View : Encoding on the registry menu to inspect all encodings of a given registry member text:
    • Unicode name (i.e. the way the text is displayed for you),
    • Unicode double-byte codes (i.e. the numeric way the text is encoded internally in SuperMemo), and
    • UTF-8 encodings (i.e. the way the text is stored on the disk).

Some Q&A files may also be UTF-8 encoded. If so, you should decode these files on Q&A import (check Decode UTF-8 box in the import dialog box)

Different components use fonts differently

Component type HTML Text, sound, Spell-Pad RTF Image, Video Binary, OLE
Encoding Unicode Unicode Unicode No character encoding,
bitmapped
The server application, such as MS Word, Power Point, etc. determines how the fonts are displayed
Font definitions Hard-wired into HTML code via typeface references, defined in stylesheets, or taken from the default settings of Internet Explorer Stored in the font registry (unless the default font is used as determined in Tools : Options : Fonts) Hard-wired into RTF files No reusable font definition; font representation is part of the file Depends on the server application
Modifiable yes yes yes no (except dedicated image or video editors) Depends on the server application
Globally modifiable no (if defined in HTML)

yes (if defined in stylesheets, templates, or in the browser)

yes, by:

  1. changing templates
  2. modifying registry fonts themselves
no no (except through object reuse) no (except through object reuse)
Searchable no, fonts are not registered with the font registry members (i.e. there is no link between texts and registry fonts) yes (except when the default question font or the default answer font is used) no, fonts are not registered with the font registry no no
Pros Universal application, supports Unicode, supports stylesheets Small size, speed Unicode All imaginable texts can be displayed All imaginable texts can be displayed and be editable with the server application
Cons May not globally modifiable (if defined inside HTML), large size of collections (if defined inside HTML), Internet Explorer required Limited to 255 character sets (i.e. only 255 characters possible in a single component) Not globally modifiable, large size of collections, format supported only for backward compatibility with earlier SuperMemos (may be phased out in the future) Pictures are not an efficient way of representing texts (size, convenience of editing, etc.) Depend on the server application
Not integrated with SuperMemo
Typical use Incremental reading,
Default text format
Redistributable collections,
template-based collections with many elements (for small size),
language learning with code page fonts
Legacy collections Mathematical formulas, demos, presentations, etc. Specialist application that depends on the server application

Further reading