turbo-html2pdf 0.6.0 → 0.7.0

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.
package/README.md CHANGED
@@ -201,7 +201,7 @@ fs.writeFileSync('out.pdf', pdf) // %PDF-1.7
201
201
 
202
202
  ## Status
203
203
 
204
- `v0.6.0` is the release version for npm, PyPI and crates.io; registry
204
+ `v0.7.0` is the release version for npm, PyPI and crates.io; registry
205
205
  verification follows the root `PUBLISHING.md`. The core engine is heavily tested (the `turbo-html2pdf-core`
206
206
  crate holds 100% line coverage with a cyclomatic-complexity ≤ 5 gate). Bindings:
207
207
  Node (napi) and WebAssembly. See [`docs/`](https://github.com/miaskiewicz/turbo-html2pdf/blob/main/docs/) for the full guide and
@@ -90,6 +90,19 @@ Notes:
90
90
  - Inter is the static OTF (CFF) build from the upstream `rsms/inter` v4.1
91
91
  release; all other families are TrueType (`glyf`) outlines.
92
92
 
93
+ - `ic-fixture/IcFixture.ttf` is a test fixture only (never bundled): a box-glyph
94
+ face written by `scripts/make-ic-fixture-font.py` in this repository (no third-party
95
+ outlines; it is covered by the repository's MIT licence). It maps U+6C34 to a 0.9em
96
+ advance so the CSS `ic` unit has a glyph to measure (turbo-dom#237).
97
+
98
+ Test fixtures only (not bundled; `test_support::fixture_fonts()` and the Chrome
99
+ controls load them for the bidi comparisons, miaskiewicz/turbo-dom#238):
100
+
101
+ | Family | Faces | License | License file |
102
+ |------------------|---------|---------|-----------------------------|
103
+ | Noto Sans Hebrew | Regular | OFL 1.1 | `noto-sans-hebrew/OFL.txt` |
104
+ | Noto Sans Arabic | Regular | OFL 1.1 | `noto-sans-arabic/OFL.txt` |
105
+
93
106
  ## Sources
94
107
 
95
108
  - Inter — https://github.com/rsms/inter (release v4.1, `extras/otf/`)
@@ -98,6 +111,8 @@ Notes:
98
111
  - PT Serif — https://fonts.google.com/specimen/PT+Serif
99
112
  - Fira Code — https://github.com/tonsky/FiraCode (release 6.2)
100
113
  - IBM Plex Mono — https://fonts.google.com/specimen/IBM+Plex+Mono
114
+ - Noto Sans Hebrew — https://github.com/notofonts/hebrew (notofonts.github.io `hinted/ttf`)
115
+ - Noto Sans Arabic — https://github.com/notofonts/arabic (notofonts.github.io `hinted/ttf`)
101
116
 
102
117
  The SIL Open Font License 1.1 permits embedding the font (including subsetted) in
103
118
  documents and bundling with software, provided the copyright + license notices
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbo-html2pdf",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Fast native HTML/CSS + Jinja templating to PDF for Node — no headless browser, no Chromium.",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
package/src/convert.rs CHANGED
@@ -104,7 +104,8 @@ impl ImageResolver for MapResolver {
104
104
  }
105
105
 
106
106
  /// Build a [`FontRegistry`] from caller-supplied faces. Each face is parsed via
107
- /// [`FontFace::from_bytes`] and tagged with its `family`/`weight`/`italic`, so
107
+ /// [`FontFace::from_web_font_bytes`] (Chrome 156 web-font kerning, turbo-dom#240)
108
+ /// and tagged with its `family`/`weight`/`italic`, so
108
109
  /// author CSS `font-family`/bold selects the right face via the cascade.
109
110
  ///
110
111
  /// Unparseable blobs are skipped (the registry simply has fewer faces); the
@@ -114,7 +115,9 @@ pub fn build_registry(fonts: Vec<JsFont>) -> FontRegistry {
114
115
  for font in fonts {
115
116
  let weight = font.weight.unwrap_or(400);
116
117
  let italic = font.italic.unwrap_or(false);
117
- if let Some(face) = FontFace::from_bytes(font.data.to_vec(), font.family, weight, italic) {
118
+ if let Some(face) =
119
+ FontFace::from_web_font_bytes(font.data.to_vec(), font.family, weight, italic)
120
+ {
118
121
  reg.add(face);
119
122
  }
120
123
  }
package/src/lib.rs CHANGED
@@ -454,11 +454,10 @@ fn build_stamp_watermark(w: JsStampWatermark) -> napi::Result<StampWatermark> {
454
454
  /// render-time mark (`FontRegistry::new().select(&[], 400, false)`).
455
455
  fn resolve_stamp_face(font: Option<Buffer>) -> napi::Result<FontFace> {
456
456
  match font {
457
- Some(bytes) => {
458
- FontFace::from_bytes(bytes.to_vec(), "watermark", 400, false).ok_or_else(|| {
457
+ Some(bytes) => FontFace::from_web_font_bytes(bytes.to_vec(), "watermark", 400, false)
458
+ .ok_or_else(|| {
459
459
  errors::from_invalid_font("stamp watermark font: not a valid TrueType/OTF font")
460
- })
461
- }
460
+ }),
462
461
  None => Ok(FontRegistry::new()
463
462
  .select(&[], 400, false)
464
463
  .expect("bundled sans face")
Binary file
Binary file
Binary file
Binary file
Binary file