fontisan 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +1 -1
- data/docs/WOFF_WOFF2_FORMATS.adoc +73 -0
- data/lib/fontisan/converters/woff2_encoder.rb +147 -242
- data/lib/fontisan/converters/woff_writer.rb +94 -59
- data/lib/fontisan/sfnt_font.rb +7 -2
- data/lib/fontisan/tables/head.rb +10 -0
- data/lib/fontisan/version.rb +1 -1
- data/lib/fontisan/woff2/collection_encoder.rb +288 -0
- data/lib/fontisan/woff2/directory.rb +37 -40
- data/lib/fontisan/woff2/encoder_rules.rb +73 -0
- data/lib/fontisan/woff2/glyf_loca_reconstruct.rb +400 -0
- data/lib/fontisan/woff2/glyf_loca_transform.rb +330 -0
- data/lib/fontisan/woff2/triplet_codec.rb +181 -0
- data/lib/fontisan/woff2.rb +5 -1
- data/lib/fontisan/woff2_font.rb +23 -40
- data/lib/fontisan/woff_font.rb +5 -2
- metadata +7 -3
- data/lib/fontisan/woff2/glyf_transformer.rb +0 -716
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47e074b8c2bbdcfa377c95733f56fdd978dfa4d824dbae3e29f3bd75935dddd6
|
|
4
|
+
data.tar.gz: a1a348db0bd6dde039c0a43f62ac3ab43792cc7414e995a72c47798663a1cd59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8917cc8c995f0ca2cbdc9e94ad5d5d629ab95d8809b7eb728d360f0743a2b26e5cfd059254497c5a1df10ddb3b53258ee703c441a106d4febd42b26ea3b6e08
|
|
7
|
+
data.tar.gz: d35a8138d7cdbc5389b619ed757863cc0d61e1d8d025655d0fb6736a21815f04d24802f24236fdffdc8d430192db79798f77f7b9343193e0c16035d2be8fc5eb
|
data/README.adoc
CHANGED
|
@@ -120,7 +120,7 @@ Font format support::
|
|
|
120
120
|
* TTF, OTF (CFF1), OTF2 (CFF2), TTC, OTC font formats (production ready)
|
|
121
121
|
* CFF2 with variable-font blend/vsindex operators, FDSelect, subroutines
|
|
122
122
|
* Adobe Type 1 fonts (PFB/PFA) with bidirectional conversion (see link:docs/TYPE1_FONTS.adoc[Type 1 Fonts Guide])
|
|
123
|
-
* WOFF/WOFF2 format support with reading, writing, and conversion (
|
|
123
|
+
* WOFF/WOFF2 format support with reading, writing, and conversion — fully compliant with W3C WOFF 1.0 (https://www.w3.org/TR/WOFF/[Recommendation 13 December 2012]) and WOFF 2.0 (https://www.w3.org/TR/WOFF2/[Recommendation 08 August 2024]) specifications. See link:docs/WOFF_WOFF2_FORMATS.adoc[WOFF/WOFF2 Guide].
|
|
124
124
|
* Apple legacy font support: 'true' signature TrueType fonts and dfont format (see link:docs/APPLE_LEGACY_FONTS.adoc[Apple Legacy Fonts Guide])
|
|
125
125
|
* SVG font generation and SVG-to-glyph conversion (complete)
|
|
126
126
|
|
|
@@ -8,6 +8,79 @@ including reading, writing, and conversion between these and other font formats.
|
|
|
8
8
|
WOFF is a wrapper around SFNT fonts (TTF/OTF) using zlib compression, while WOFF2
|
|
9
9
|
uses Brotli compression for better compression ratios and table transformations.
|
|
10
10
|
|
|
11
|
+
== W3C specification compliance
|
|
12
|
+
|
|
13
|
+
Fontisan's WOFF and WOFF2 implementations are fully compliant with the
|
|
14
|
+
W3C Recommendations:
|
|
15
|
+
|
|
16
|
+
* **WOFF 1.0** (W3C Recommendation, 13 December 2012):
|
|
17
|
+
https://www.w3.org/TR/WOFF/[spec] — reading and writing
|
|
18
|
+
* **WOFF 2.0** (W3C Recommendation, 08 August 2024):
|
|
19
|
+
https://www.w3.org/TR/WOFF2/[spec] — reading and writing
|
|
20
|
+
|
|
21
|
+
=== WOFF 2.0 (spec section references below)
|
|
22
|
+
|
|
23
|
+
Compliance covers every normative requirement of the WOFF2 spec:
|
|
24
|
+
|
|
25
|
+
* *Section 3.2 (WOFF2 Header)*: 48-byte header with correct signature
|
|
26
|
+
(`wOF2`), flavor, file length, reserved=0, totalSfntSize,
|
|
27
|
+
totalCompressedSize, version, and meta/private offset/length fields.
|
|
28
|
+
* *Section 4.1 (Table directory)*: flags byte structure (bits 0-5 tag
|
|
29
|
+
index, bits 6-7 transform version); optional 4-byte custom tag when
|
|
30
|
+
index=63; `transformLength` field present IFF table is transformed.
|
|
31
|
+
* *Section 4.2 (Collection directory)*: full support for flavor=`ttcf`
|
|
32
|
+
font collections — CollectionHeader + CollectionFontEntry per font,
|
|
33
|
+
with deduplicated tables shared across fonts via directory indices.
|
|
34
|
+
* *Section 5 (Compressed data)*: single Brotli stream of all tables in
|
|
35
|
+
directory order; `DSIG` table removed per encoder rule; `head.flags`
|
|
36
|
+
bit 11 set to indicate lossless modifying transform.
|
|
37
|
+
* *Section 5.1 (Transformed glyf table)*: 36-byte header (uint16
|
|
38
|
+
version + uint16 optionFlags + uint16 numGlyphs + uint16 indexFormat
|
|
39
|
+
+ 7 × uint32 stream sizes); 7 streams in spec order (nContour,
|
|
40
|
+
nPoints, flags, glyph, composite, bbox with bboxBitmap prefix,
|
|
41
|
+
instructions); optional overlapSimpleBitmap when optionFlags bit 0
|
|
42
|
+
is set; bboxBitmap semantics per spec (composite glyphs always have
|
|
43
|
+
explicit bbox, simple glyphs omit when calculated bbox matches,
|
|
44
|
+
empty glyphs MUST have all-zero bbox).
|
|
45
|
+
* *Section 5.2 (Triplet coordinate encoding)*: variable-length
|
|
46
|
+
coordinate codec with all 128 flag index variants (1-4 byte
|
|
47
|
+
payloads based on coordinate magnitude); bit 7 = off-curve flag.
|
|
48
|
+
* *Section 5.3 (Transformed loca table)*: `transformLength` MUST be 0;
|
|
49
|
+
loca data omitted from compressed stream (reconstructed by decoder
|
|
50
|
+
from glyf).
|
|
51
|
+
* *Section 5.4 (Transformed hmtx table)*: optional version 1 transform
|
|
52
|
+
exploiting `lsb == xMin` redundancy.
|
|
53
|
+
* *Section 5.5 (Table order constraints)*: loca MUST immediately
|
|
54
|
+
follow glyf in table directory; for collections, loca MUST
|
|
55
|
+
immediately follow its corresponding glyf with no other tables in
|
|
56
|
+
between.
|
|
57
|
+
|
|
58
|
+
Validation: fontisan's WOFF2 output is verified byte-identical to
|
|
59
|
+
fontTools' output for transformed glyf tables, and round-trips
|
|
60
|
+
correctly through the W3C `woff2_decompress` reference tool.
|
|
61
|
+
|
|
62
|
+
=== WOFF 1.0
|
|
63
|
+
|
|
64
|
+
* *Section 4 (WOFF Header)*: 44-byte header with correct signature
|
|
65
|
+
(`wOFF`), flavor, length, numTables, reserved=0, totalSfntSize,
|
|
66
|
+
version, and meta/private offset/length fields.
|
|
67
|
+
* *Section 5 (Table directory)*: 20-byte entries with tag, offset,
|
|
68
|
+
compLength, origLength, origChecksum. Tables sorted in input font
|
|
69
|
+
order per spec ("MUST be stored in the same order as the
|
|
70
|
+
well-formed input font").
|
|
71
|
+
* *Section 6 (Font data tables)*: tables compressed individually with
|
|
72
|
+
zlib (compress2-compatible); each table 4-byte aligned and
|
|
73
|
+
zero-padded to next boundary ("MUST begin on 4-byte boundaries and
|
|
74
|
+
be zero-padded to the next 4-byte boundary").
|
|
75
|
+
* *Section 7 (Extended metadata)*: optional block of XML data,
|
|
76
|
+
always zlib-compressed ("it is never stored in uncompressed form").
|
|
77
|
+
* *Section 8 (Private data)*: optional block of arbitrary bytes,
|
|
78
|
+
always 4-byte aligned.
|
|
79
|
+
|
|
80
|
+
Validation: fontisan's WOFF 1 output round-trips through fontTools
|
|
81
|
+
without errors; all 4-byte alignment, padding, and compression
|
|
82
|
+
requirements verified by spec-conformance specs.
|
|
83
|
+
|
|
11
84
|
=== Display WOFF/WOFF2 font information
|
|
12
85
|
|
|
13
86
|
Show metadata specific to WOFF/WOFF2 fonts including version, compression details,
|