nbk2pdf 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8a59dbe4f22c150b38ba4f0ced7c4a43e8b76019de55375e4736a1486ca3f94
4
- data.tar.gz: b47999b9bd68c439c3ae69b9c594e2409cc0aadf62c4e7bb8f6be4d91013a74e
3
+ metadata.gz: 64fd3b6e1a6523298f069b406c0cf7a3b0b1d0df87cf843c665f5cb10b31f638
4
+ data.tar.gz: 022be27e074f4f6d0301ea10d10666d461aabdfe4aca1d8bba8751d3ffd23912
5
5
  SHA512:
6
- metadata.gz: c5a5ad8a48bd46a812fa9d3653ad7fc709b9fc7b7b16f15c06568a58b6dc71a37d2b74519795b8b72d95e57425f5c3437f9a86151795a051334273f0caf23628
7
- data.tar.gz: 15384d80e7360a9df1adaf7212060ccbf25716f57225d5757db70defb039a51c025ebd5e1656dafc682315581d05596794b2846da6f49fce566f0e240d0920db
6
+ metadata.gz: 4d8f4247ffe944e73d631dcadc50f01fe463f0c79296b20e0fca9dc2cdbeb1c4c8eeea4b7a1b88bc1729aa8dfddc961b0ac37c0f3861b92b36f892e9dab48646
7
+ data.tar.gz: bf6aacb7f72b3b4fd86f48f005be933e2f4826f3a3997cacf31a9a1c66489975e0e16b2ef41f09780bc3d4d905e0f27226f851b75bc8e9ff87bc06446e67d814
data/CHANGELOG.md CHANGED
@@ -4,29 +4,14 @@ All notable changes to this project are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [Unreleased]
7
+ ## [1.0.1] - 2026-10-20
8
8
 
9
- ### Added
10
-
11
- - Handwriting on a PDF goes onto a copy of that PDF. Pass the PDF on the device
12
- as the path, or let `sync` pick it up with the notebooks. The ink is placed in
13
- the frame the device records for it, and the original pages, links and named
14
- destinations are kept.
15
- - `--annotations` adds the ink as PDF ink annotations instead of drawing it
16
- into the page. Their appearance keeps the pressure taper.
17
- - Reader for the device's reader data store (`.yjr`), where the notes on a
18
- document are recorded.
9
+ ### Fixed
19
10
 
20
- ### Changed
11
+ - Ink moved with the lasso is drawn where it was moved to, not where it was
12
+ first written.
21
13
 
22
- - `sync` writes notebooks into `DIR/notebooks/` and PDFs written on into
23
- `DIR/documents/`, keeping the folders they have under `documents/` on the
24
- Kindle. It used to put every notebook straight into `DIR`.
25
- - The notebook holding a PDF's ink is no longer converted as a notebook of its
26
- own when its PDF can be found; the ink goes onto the PDF instead.
27
- - Depends on `combine_pdf`, to read and write existing PDFs.
28
-
29
- ## [1.0.0] - 2026-09-19
14
+ ## [1.0.0] - 2026-10-19
30
15
 
31
16
  Initial release, under the GNU General Public License v3.0 or later.
32
17
 
@@ -49,7 +34,18 @@ Initial release, under the GNU General Public License v3.0 or later.
49
34
  - A template shape whose op stream cannot be read to the end is dropped whole
50
35
  rather than drawn truncated.
51
36
  - `nbk2pdf sync [DIR]`, which mounts a Kindle connected over USB through gvfs
52
- when it is not mounted already and converts every notebook on it.
37
+ when it is not mounted already and converts what is on it. Notebooks go into
38
+ `DIR/notebooks/`, and PDFs written on into `DIR/documents/`, keeping the
39
+ folders they have under `documents/` on the Kindle.
40
+ - Handwriting on a PDF goes onto a copy of that PDF. Pass the PDF on the device
41
+ as the path, or let `sync` pick it up with the notebooks. The ink is placed in
42
+ the frame the device records for it, and the original pages, links and named
43
+ destinations are kept. The notebook holding that ink is not converted on its
44
+ own when its PDF can be found.
45
+ - `--annotations` adds the ink as PDF ink annotations instead of drawing it
46
+ into the page. Their appearance keeps the pressure taper.
47
+ - Reader for the device's reader data store (`.yjr`), where the notes on a
48
+ document are recorded.
53
49
  - Pages go on US Letter by default, scaled to fit and centred, since the
54
50
  device's own 446.4 x 595.2 pt page matches no standard sheet. `--paper`
55
51
  chooses another size, and `--paper native` keeps the device's own.
@@ -18,6 +18,17 @@ module KindleNotebook
18
18
  Stroke = Struct.new(:xs, :ys, :pressures, :thickness, :color, :brush_type, keyword_init: true) do
19
19
  def dot? = xs.size < 2
20
20
  def highlighter? = brush_type == HIGHLIGHTER_BRUSH
21
+
22
+ # Ink moved with the lasso keeps its recorded points and gains an affine
23
+ # matrix [a b c d tx ty], applied as x' = ax + cy + tx, y' = bx + dy + ty.
24
+ def transform(matrix)
25
+ return self unless matrix.is_a?(Array) && matrix.size == 6
26
+
27
+ a, b, c, d, tx, ty = matrix.map(&:to_f)
28
+ points = xs.zip(ys).map { |x, y| [(a * x) + (c * y) + tx, (b * x) + (d * y) + ty] }
29
+ self.xs, self.ys = points.transpose
30
+ self
31
+ end
21
32
  end
22
33
 
23
34
  # One drawing primitive of a page template, in template units.
@@ -302,7 +313,7 @@ module KindleNotebook
302
313
  ys: coordinates(points["nmdl.position_y"], count, origin[1]),
303
314
  pressures: pressures(points["nmdl.pressure"], count),
304
315
  **pen(node)
305
- )
316
+ ).transform(Ion.unwrap(node["$98"]))
306
317
  rescue StrokeDecoder::DecodeError => e
307
318
  @warnings << "stroke #{Ion.unwrap(node["$598"]) || "?"}: #{e.message}"
308
319
  nil
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  module KindleNotebook
6
- VERSION = "1.0.0"
6
+ VERSION = "1.0.1"
7
7
 
8
8
  # The name this library is published and invoked under.
9
9
  PROGRAM = "nbk2pdf"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nbk2pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Avseyev