Debian Codegraph @

site/graphite_techAbout.md

raw
1 ---
2 layout: default
3 title: Graphite technical overview
4 nav_order: 20
5 parent: About Graphite
6 ---
7
8 # Graphite technical overview
9
10 * [Introduction](graphite_techAbout#introduction)
11 * [Graphite font tables](graphite_techAbout#graphite-font-tables)
12 * [Graphite engine implementations](#graphite-engine-implementations)
13 * [Graphite and OpenType](graphite_techAbout#graphite-and-opentype)
14
15 ## Introduction
16
17 The Graphite system consists of:
18
19 * Graphite Description Language (GDL) - a rule-based programming language that is used to describe the behavior of a writing system
20 * the Graphite compiler - used to compile the GDL program along with a font to generate the Graphite-enabled version of the font
21 * the Graphite engine - uses the Graphite font to assist a text-processing application in performing text layout
22
23 {: .image-tight }
24 ![Graphite system architecture](assets/images/graphite_arch_diagram.png)
25
26 <figcaption>Graphite system architecture</figcaption>
27
28 The compiler takes as input a TrueType font and a GDL program that has been written to correspond to it. The output of the compiler is a font that has been extended by including several tables used by the Graphite engine (see [Graphite font tables below](graphite_techAbout#graphite-font-tables)).
29
30 An application makes use of Graphite by hooking the Graphite engine into its text layout module. The Graphite engine uses the font, particularly the Graphite-specific tables, to perform text layout.
31
32 The dotted arrow between the engine and the output device indicates a difference between the original Graphite engine (SilGraphite) and the Graphite2 rework. The original engine contains a module that actually performs output by communicating with the output device. This is not included in Graphite2; the engine returns glyph and positioning information to the application, which performs the actual drawing.
33
34 ## Graphite font tables
35
36 To create a Graphite-enabled font, the compiler adds several TrueType tables to the font file. These tables include:
37
38 * **Silf** - contains the main logic, including finite state machine for rule matching, constraints, and rule action code
39 * **Glat** - glyph attributes table
40 * **Gloc** - indexes for Glat table
41 * **Feat** - feature table, similar to Apple's feat table
42 * **Sill** - language table, containing mappings between language codes and features
43
44 The [&#x2197; compiler package](https://github.org/silnrsi/grcompiler){:target="_blank"} contains more complete documentation of these tables and their formats.
45
46 ## Graphite engine implementations
47
48 There are two existing implementations of the Graphite engine. The original engine is packaged under the name "SilGraphite"; the initial implementation was done in 2000. The Graphite2 engine implementation began in 2010.
49
50 The [&#x2197; SilGraphite engine](https://sourceforge.net/projects/silgraphite){:target="_blank"} is currently used by OpenOffice, XeTeX, FieldWorks, and WorldPad. It includes some features not included in Graphite2, but is considerably slower. [&#x2197; Graphite2](https://projects.palaso.org/projects/graphitedev){:target="_blank"} represents a significant (10x) optimization in terms of speed and greatly improved robustness, but does not include a few features such a ligature component handling and cross-line-boundary contextualization. Graphite2 is used by LibreOffice and Firefox.
51
52 The two engines support different APIs. The Graphite2 API was specifically developed to be more compatible with the approach to text layout used by most commercial software. See the [application development page](graphite_devApp) for API documentation.
53
54 ## Graphite and OpenType
55
56 OpenType is the most prevalent smart font technology. Given the extra costs of supporting Graphite in addition to OpenType, what are the gains?
57
58 Graphite and OpenType are not competing technologies. Applications may support both Graphite and OpenType rendering and fonts may be developed that work with both Graphite and OpenType.
59
60 [Read more...](graphite_aboutOT)