Commit 84004b8
committed
cff: Humanify user facing way "delta"s are handled
[why]
At the moment the delta values are not de- or encoded. The delta format
is a packed format to have the smallest possible values in the array of
numbers (i.e. relative to the previous number).
But usually users do not face this but are shown absolute values; in
all other font specific applications.
For example
BlueValues [ 500, 550 ] // User sees the BlueZone is from 500 to 550
Encoded as [ 500, 50 ]
opentype.js at the moment does not translate these deltas in any way and
users must know this and use the inconvenient 'packed' encoding format.
[how]
Convert the read relative delta values to absolute coordinates in the
blueValues (and other) properties, that users can interact with.
On font encoding time the absolute coordinates are converted back to
relative ones and encoded in the font file.
[note]
https://adobe-type-tools.github.io/font-tech-notes/pdfs/5176.CFF.pdf
The second and subsequent numbers in a delta are encoded as the
difference between successive values. For example, an array a0,
a1, ..., an would be encoded as: a0 (a1–a0) (a2–a1) ..., (an–a(n–1))
This is done because small numbers can be encoded with fewer bytes and
the total aim is to reduce the size.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>1 parent aea28e5 commit 84004b8
2 files changed
+30
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
311 | 322 | | |
312 | 323 | | |
313 | 324 | | |
| |||
1416 | 1427 | | |
1417 | 1428 | | |
1418 | 1429 | | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
1419 | 1445 | | |
1420 | 1446 | | |
1421 | 1447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
0 commit comments