Debian Codegraph @

data/layouts/README.md

raw symbols SCIP
1 # libwacom SVG format requirements
2
3 SVG images have a dual purpose, providing an accurate representation of the
4 tablets and also providing the size and location of the various controls on
5 the device that can be queried by various applications that may need it.
6
7 To allow applications to identify each control in the SVG and also apply a
8 CSS if desired, the following naming convention applies:
9
10 ## Buttons
11
12 Each button ID in the SVG is built of the string "Button" with ID of the
13 button between 'A' and 'Z'. Additionally, the SVG class must contain the
14 button ID of the button between 'A' and 'Z' and the more generic class
15 "Button":
16
17 | Button ID | SVG id | SVG class |
18 |:---------:|:---------:|:----------:|
19 | `A` | `ButtonA` | `A Button` |
20 | `B` | `ButtonB` | `B Button` |
21 | ... | ... | ...
22 | `Z` | `ButtonZ` | `Z Button` |
23
24
25 For example:
26 ```xml
27 <path id="ButtonA" class="A Button"
28 d="m 180.5,0.0 0,73.0 94.5,0 a 68.0,68.0 0 0 1 65.0,-67.5 l 0,-5.5 -160.0,0 z" />
29 ```
30
31 If the button is a mode-switch button as well, the class list should also
32 contain "ModeSwitch":
33
34 ```xml
35 <path id="ButtonI" class="I ModeSwitch Button" ... />
36 ```
37
38 This allows applications to modify the appearance of all the buttons at once
39 via a CSS, yet allowing to customize the appearance of single buttons by
40 using the button ID.
41
42 ## Touch Rings/Strips
43
44 Touch rings and strips use the following convention:
45
46 | Type | SVG id | SVG class |
47 |--------------------|:--------:|:------------------:|
48 | First touch ring | `Ring` | `Ring TouchRing` |
49 | Second touch ring | `Ring2` | `Ring2 TouchRing` |
50 | First touch strip | `Strip` | `Strip TouchStrip` |
51 | Second touch strip | `Strip2` | `Strip2 TouchStrip` |
52
53 For example:
54 ```xml
55 <circle id="Ring" class="Ring TouchRing" cx="342.0" cy="74.5" r="50.5" />
56 ```
57
58 ### Fake buttons to indicate interactions
59
60 Additional "fake" buttons (i.e. actual controls not found on the real
61 device) may be added to touch controls to help indicate the type of action
62 expected on the control. For example a circular motion arrow on a touch ring
63 or vertical motion arrow on a touch strip.
64
65 Where the controls are present, they should be named using the following
66 convention:
67
68 | Type | SVG id | SVG class |
69 |--------------------|:--------:|:------------------:|
70 | First touch ring, rotating clockwise | `RingCW` | `RingCW Button ` |
71 | First touch ring, rotating counterclockwise | `RingCCW` | `RingCCW Button` |
72 | Second touch ring, rotating clockwise | `Ring2CW` | `Ring2CW Button ` |
73 | Second touch ring, rotating counterclockwise | `Ring2CCW` | `Ring2CCW Button` |
74 | First touch strip, moving up | `StripUp` | `StripUp Button` |
75 | First touch strip, moving down | `StripDown` | `StripDown Button` |
76 | Second touch strip, moving up | `Strip2Up` | `Strip2Up Button` |
77 | Second touch strip, moving down | `Strip2Down` | `Strip2Down Button` |
78
79 For example:
80
81 ```xml
82 <g>
83 <circle id="Ring" class="Ring TouchRing" cx="342.0" cy="74.5" r="50.5" />
84 <path id="RingCCW" class="RingCW Button"
85 d="m 372.5,103.0 -3.5,-3.5 c 17.5,-17.5 7.0,-42.5 3.5,-53.1 7.0,7.0 21.5,39.0 0,56.5 z" />
86 <path id="RingDown" class="RingCCW Button"
87 d="m 340.0,35.5 -3.5,7.0 7.0,0 z" />
88 ...
89 ```
90
91 The use of those "fake" buttons is left at the discretion of the designer
92 and is not mandatory nor enforced. Multiple controls may be present, e.g.
93 it's allowed to add both a CW and CCW motion indicator.
94
95
96 ## Labels
97
98 The role of the labels in the SVG is to give applications an indication on
99 where to place the caption for each button. The actual content of the text
100 in the SVG image may not be relevant, what matters is the actual location.
101
102 Applications should hide the labels (using CSS) or replace the text with an
103 appropriate caption.
104
105
106 The convention is to prefix the type with "Label" for the SVG id and append
107 "Label" to the type for the SVG class:
108
109 | Type | SVG id | SVG class |
110 |--------------------|:--------:|:------------------:|
111 | Button 'A' label | `LabelA` | `A Label` |
112 | Button 'B' label | `LabelB` | `B Label` |
113 | Button 'C' label for a mode-switch button | `LabelC` | `C ModeSwitch Label` |
114 | Label for first touch ring, rotating clockwise | `LabelRingCW` | `RingCCW Ring Label` |
115 | Label for first touch ring, rotating counterclockwise | `LabelRingCCW` | `RingCCW Ring Label` |
116 | Label for second touch ring, rotating clockwise | `LabelRing2CW` | `Ring2CCW Ring2 Label` |
117 | Label for second touch ring, rotating counterclockwise | `LabelRing2CCW` | `Ring2CCW Ring2 Label` |
118 | Label for first touch strip, moving up | `LabelStripUp` | `StripUp Strip Label` |
119 | Label for first touch strip, moving down | `LabelStripDown` | `StripDown Strip Label` |
120 | Label for second touch strip, moving up | `LabelStrip2Up` | `Strip2Up Strip2 Label` |
121 | Label for second touch strip, moving down | `LabelStrip2Down` | `Strip2Down Strip2 Label` |
122
123 For example:
124 ```xml
125 <text id="LabelD" class="D Label" x="534.0" y="115.0" style="text-anchor:start;">D</text>
126 ...
127 <text id="LabelRingCCW" class="RingCCW Ring Label" x="404.0" y="165.0" style="text-anchor:start;">CCW</text>
128 ```
129
130 ### Caption leader lines
131
132 To match the buttons with their corresponding labels, the SVG must also
133 provide a leader line for each label in the form of a line that links
134 each button and its label.
135
136 Each leader line follows the same naming convention as the labels, using
137 the special name "Leader" in place of "Label", ie:
138
139 | Type | SVG id | SVG class |
140 |--------------------|:--------:|:------------------:|
141 | Button 'A' leader | `LeaderA` | `A Leader` |
142 | Button 'B' leader | `LeaderB` | `B Leader` |
143 | Button 'C' leader for a mode-switch button | `LeaderC` | `C ModeSwitch Leader` |
144 | Leader for first touch ring, rotating clockwise | `LeaderRingCW` | `RingCCW Ring Leader` |
145 | Leader for first touch ring, rotating counterclockwise | `LeaderRingCCW` | `RingCCW Ring Leader` |
146 | Leader for second touch ring, rotating clockwise | `LeaderRing2CW` | `Ring2CCW Ring2 Leader` |
147 | Leader for second touch ring, rotating counterclockwise | `LeaderRing2CCW` | `Ring2CCW Ring2 Leader` |
148 | Leader for first touch strip, moving up | `LeaderStripUp` | `StripUp Strip Leader` |
149 | Leader for first touch strip, moving down | `LeaderStripDown` | `StripDown Strip Leader` |
150 | Leader for second touch strip, moving up | `LeaderStrip2Up` | `Strip2Up Strip2 Leader` |
151 | Leader for second touch strip, moving down | `LeaderStrip2Down` | `Strip2Down Strip2 Leader` |
152
153 For example:
154
155 ```xml
156 <path id="LeaderRingCCW" class="RingCCW Ring Leader"
157 d="m 372.5,110.0 l 0.0,55.0 l 30.0,0.0" />
158 ```
159
160 ## Tips For Creating New Layouts
161
162 Layouts use very simple SVG rules. WISIWYG editors such as Inkscape are
163 very convenient to design new layouts but usually produce a much more
164 complex SVG markup so files that are produced with those editors should
165 be cleaned. To help with this task, there is a script called `clean_svg.py`
166 in the tools folder.
167 Besides cleaning the markup and removing editor specific tags, `clean_svg.py`
168 also automates the naming of the elements.
169
170 ### Automatic Naming with Inkscape and `clean_svg.py`
171
172 In Inkscape, be sure to group the button, leader and label elements
173 and assign the group's ID to the desired logical name. e.g.: Assigning
174 "A" to the group's ID and running the `clean_svg.py` script with that
175 SVG, will assign "ButtonA"/"B Button" to the ID and class of the first
176 rect/circle element found in the group; it also analogously assigns the ID
177 and class of the first path and text elements found in that group.
178
179 `clean_svg.py` needs two arguments, the SVG file path and the name of
180 the tablet, e.g.:
181
182 ```
183 ./clean_svg.py /path/to/svg_file.svg "My Brand New Tablet Name"
184 ```