Commit 77e51db
authored
Add Letter Spacing (#174)
### Description
Adds a `letterSpacing` parameter that determines the amount of space
between characters. The parameter is a multiplier of the font's
character width so `1.0` indicates no space, `2.0` indicates a full
character width's space. This is exactly as described in #153.
In detail:
- The letter spacing parameter modifies a stored `kern` variable that is
used for all default attributes.
This PR also adds documentation for a couple undocumented parameters in
the initializer and moves `lineHeight` into the `STTextViewController`
initializer for a cleaner `CodeEditTextView`.
### Related Issues
* closes #153
### Checklist
- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code
### Screenshots
The below recording shows a placeholder settings adjusting the letter
spacing, as well as the spacing being applied while typing.
https://user-images.githubusercontent.com/35942988/230160550-c540523c-4fb9-4984-8564-5bdebb7fbcb3.mov1 parent cfceb13 commit 77e51db
File tree
4 files changed
+64
-11
lines changed- Sources/CodeEditTextView
- Controller
- Tests/CodeEditTextViewTests
4 files changed
+64
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
45 | | - | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| 84 | + | |
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
| |||
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | | - | |
| 103 | + | |
| 104 | + | |
95 | 105 | | |
96 | | - | |
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
| |||
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| |||
Lines changed: 24 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
79 | 95 | | |
80 | 96 | | |
81 | 97 | | |
| |||
92 | 108 | | |
93 | 109 | | |
94 | 110 | | |
| 111 | + | |
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
100 | 117 | | |
101 | | - | |
| 118 | + | |
| 119 | + | |
102 | 120 | | |
103 | 121 | | |
104 | 122 | | |
105 | 123 | | |
106 | 124 | | |
107 | 125 | | |
108 | 126 | | |
| 127 | + | |
109 | 128 | | |
110 | 129 | | |
111 | 130 | | |
| |||
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
125 | | - | |
| 144 | + | |
126 | 145 | | |
127 | 146 | | |
128 | 147 | | |
| |||
234 | 253 | | |
235 | 254 | | |
236 | 255 | | |
237 | | - | |
| 256 | + | |
238 | 257 | | |
239 | 258 | | |
240 | 259 | | |
| |||
252 | 271 | | |
253 | 272 | | |
254 | 273 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | 274 | | |
259 | 275 | | |
260 | 276 | | |
| |||
293 | 309 | | |
294 | 310 | | |
295 | 311 | | |
296 | | - | |
| 312 | + | |
| 313 | + | |
297 | 314 | | |
298 | 315 | | |
299 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
193 | 196 | | |
194 | 197 | | |
195 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
196 | 218 | | |
| 219 | + | |
0 commit comments