File: features.txt

package info (click to toggle)
graphite2 1.3.13-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 23,300 kB
  • sloc: cpp: 14,690; cs: 1,998; ansic: 1,673; python: 1,481; perl: 184; xml: 123; sh: 96; makefile: 58
file content (76 lines) | stat: -rw-r--r-- 2,592 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
== Font Features ==

Graphite fonts have user features. These are values that can be set to control
all kinds of rendering effects from choosing particular glyph styles for a group
of languages to how bad sequences should be displayed to almost anything.

A font (strictly speaking a face) has a set of features. Each feature has an
identifier which is a 32-bit number which can take the form of a tag
(4 characters) or if the top byte is 0 a number. Also each feature can take one
of a set of values. Each feature has a UI name from the name table. In addition
each value also has a UI name associated with it. This allows an application to
list all the features in a font and to show their names and values in a user
interface to allow user selection.

Feature values are held in a FeatureVal which is a compressed map of feature id
to value. The map is indexed via a FeatureRef which may be quered from a face
given an id. It is also possible to iterate over all the FeatureRefs in a face.

A face has a default featureVal corresponding to each language the face supports
along with a default for other languages. A face may be asked for a copy of one
of these default featureVals and then it may be modified to account for the
specific feature settings for a run.

[source, c]
----
include::../tests/examples/features.c[]
----

<1> The easiest way to turn a char[4] into a string is to append a nul, hence we
    make a char[5].

<2> Query the face for the default featureVal of the given lang or 0 for the
    default. The lang is a uint32 which has been converted from the string and
    is 0 padded (as opposed to space padded).

<3> Iterate over all the features in a font querying for the featureRef.

<4> Get the label in US English, for the feature name.

<5> Get the id for the feature name so that applications can refer to it.
    The id may be numeric or a string tag.

<6> Iterate over all the possible values for this feature and find the one the
    is equal to the value for the feature in the default featureVal. Then print
    out its details.

A sample run of.

----
./features ../fonts/Padauk.ttf ksw
----

Gives this output.

----
Khamti style dots (kdot)
	False (0)
Filled dots (fdot)
	False (0)
Lower dot shifts left (lldt)
	True (1)
Tear drop style washwe (wtri)
	True (1)
Long U with Yayit, long UU with Hato (ulon)
	False (0)
U and UU always full height (utal)
	False (0)
Insert dotted circles for errors (dotc)
	True (1)
Slanted hato (hsln)
	Sgaw style slanted leg with horizontal foot (1)
Disable great nnya (nnya)
	False (0)
Variant tta (vtta)
	False (0)
----