fontisan 0.4.40 → 0.4.41
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/TODO.bug-fixes/06-instance-woff2-output.md +24 -0
- data/TODO.bug-fixes/README.md +6 -5
- data/lib/fontisan/variation/instance_writer.rb +24 -2
- data/lib/fontisan/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '080dc8ffc4c406353a04ba6fddbd0e597e3fb0b77edefbaba42a9dfcfe2b15ae'
|
|
4
|
+
data.tar.gz: 4e7fa9e0d8c93f03438d92c4b94a031a1f5d3d8e4bd367a344d4bb2016fc3664
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d15e8c36f17173e7ad8ebd12439568378e3455b4d5a332bd2ce8054655d5f2f2e0b6b171966fd3beff01a29931f2bff237bab458dcc992702f214f80b82d2b53
|
|
7
|
+
data.tar.gz: 330d2c58519661c079b41b371b15ce1d71f7f3c3f43982ee43efbcfb3f849673971900412a530fff5f1fe8e4a1cbff28db1ce74eee2000846523f1eb8e562930
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 06 — Variable font instance WOFF2 output
|
|
2
|
+
|
|
3
|
+
## Priority
|
|
4
|
+
P1
|
|
5
|
+
|
|
6
|
+
## Problem
|
|
7
|
+
`Variation::InstanceWriter` raises `Fontisan::Error` for WOFF2 output
|
|
8
|
+
instead of writing the file. Variable font instances can be written
|
|
9
|
+
to TTF, OTF, and WOFF but not WOFF2.
|
|
10
|
+
|
|
11
|
+
## Goal
|
|
12
|
+
Wire the existing WOFF2 encoder into the instance writer so
|
|
13
|
+
`write(format: :woff2)` produces a valid WOFF2 file.
|
|
14
|
+
|
|
15
|
+
## Approach
|
|
16
|
+
The instance writer already calls `write_sfnt` for TTF/OTF and
|
|
17
|
+
`write_woff` for WOFF. Add a `write_woff2` method that:
|
|
18
|
+
1. Writes the SFNT tables to a temp TTF
|
|
19
|
+
2. Loads the temp TTF
|
|
20
|
+
3. Encodes to WOFF2 via `Converters::FormatConverter`
|
|
21
|
+
|
|
22
|
+
## Acceptance criteria
|
|
23
|
+
- `instance_writer.write(format: :woff2)` produces a valid WOFF2 file
|
|
24
|
+
- The WOFF2 file decodes back to the correct instance tables
|
data/TODO.bug-fixes/README.md
CHANGED
|
@@ -6,12 +6,13 @@ Each file is `NN-short-name.md` where `NN` is the priority order.
|
|
|
6
6
|
## Priorities
|
|
7
7
|
|
|
8
8
|
### P0 — Correctness bugs (wrong data for specific font types)
|
|
9
|
-
- [01 — CFF Expert charset placeholder](01-cff-expert-charsets.md)
|
|
10
|
-
- [02 — CFF2 subroutine call stubs](02-cff2-subroutine-stubs.md)
|
|
9
|
+
- [x] ~~[01 — CFF Expert charset placeholder](01-cff-expert-charsets.md)~~ ✓ Done (v0.4.40)
|
|
10
|
+
- [x] ~~[02 — CFF2 subroutine call stubs](02-cff2-subroutine-stubs.md)~~ ✓ Done (v0.4.40)
|
|
11
11
|
|
|
12
12
|
### P1 — Feature gaps (non-functional code paths)
|
|
13
|
-
- [03 — Variation subsetter placeholders](03-variation-subsetter-placeholders.md)
|
|
14
|
-
- [04 — UFO image compile round-trip](04-ufo-image-compile-roundtrip.md)
|
|
13
|
+
- [x] ~~[03 — Variation subsetter placeholders](03-variation-subsetter-placeholders.md)~~ ✓ Done (v0.4.40)
|
|
14
|
+
- [x] ~~[04 — UFO image compile round-trip](04-ufo-image-compile-roundtrip.md)~~ ✓ Done (v0.4.40)
|
|
15
|
+
- [06 — Variable font instance WOFF2 output](06-instance-woff2-output.md)
|
|
15
16
|
|
|
16
17
|
### P2 — Documentation cleanup
|
|
17
|
-
- [05 — Stale CFF comment](05-stale-cff-comment.md)
|
|
18
|
+
- [x] ~~[05 — Stale CFF comment](05-stale-cff-comment.md)~~ ✓ Done (v0.4.40)
|
|
@@ -105,8 +105,7 @@ module Fontisan
|
|
|
105
105
|
when :woff
|
|
106
106
|
write_woff(output_tables, output_path, source_format)
|
|
107
107
|
when :woff2
|
|
108
|
-
|
|
109
|
-
"WOFF2 output not yet implemented (planned for Phase 6)"
|
|
108
|
+
write_woff2(output_tables, output_path, source_format)
|
|
110
109
|
end
|
|
111
110
|
end
|
|
112
111
|
|
|
@@ -324,6 +323,29 @@ module Fontisan
|
|
|
324
323
|
"Failed to write WOFF output: #{e.message}"
|
|
325
324
|
end
|
|
326
325
|
|
|
326
|
+
# Write WOFF2 format
|
|
327
|
+
#
|
|
328
|
+
# @param tables [Hash<String, String>] Output tables
|
|
329
|
+
# @param output_path [String] Output file path
|
|
330
|
+
# @param source_format [Symbol] Source format (for flavor detection)
|
|
331
|
+
# @return [Integer] Number of bytes written
|
|
332
|
+
def write_woff2(tables, output_path, source_format)
|
|
333
|
+
require "tmpdir"
|
|
334
|
+
sfnt_version = sfnt_version_for_format(source_format)
|
|
335
|
+
|
|
336
|
+
Dir.mktmpdir("fontisan-woff2-") do |dir|
|
|
337
|
+
temp_ttf = File.join(dir, "instance.ttf")
|
|
338
|
+
FontWriter.write_to_file(tables, temp_ttf, sfnt_version: sfnt_version)
|
|
339
|
+
|
|
340
|
+
font = FontLoader.load(temp_ttf)
|
|
341
|
+
woff2_data = Converters::Woff2Encoder.new.convert(font)
|
|
342
|
+
File.binwrite(output_path, woff2_data)
|
|
343
|
+
end
|
|
344
|
+
rescue StandardError => e
|
|
345
|
+
raise Fontisan::Error,
|
|
346
|
+
"Failed to write WOFF2 output: #{e.message}"
|
|
347
|
+
end
|
|
348
|
+
|
|
327
349
|
# Get SFNT version for output format
|
|
328
350
|
#
|
|
329
351
|
# @param format [Symbol] Output format
|
data/lib/fontisan/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fontisan
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.41
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -138,6 +138,7 @@ files:
|
|
|
138
138
|
- TODO.bug-fixes/03-variation-subsetter-placeholders.md
|
|
139
139
|
- TODO.bug-fixes/04-ufo-image-compile-roundtrip.md
|
|
140
140
|
- TODO.bug-fixes/05-stale-cff-comment.md
|
|
141
|
+
- TODO.bug-fixes/06-instance-woff2-output.md
|
|
141
142
|
- TODO.bug-fixes/README.md
|
|
142
143
|
- TODO.improvements/01-cbdt-cblc-gid-stable-propagation.md
|
|
143
144
|
- TODO.improvements/02-collection-outline-priority.md
|