Update docs and add sample image for label workflows.
Capture design notes for merge-print and PNG fit behavior, clean up Ruby README formatting, and include a new sample PNG for print testing. Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
= pTouch Label ノート
|
||||||
|
|
||||||
|
== 差込印刷機能追加(案)
|
||||||
|
|
||||||
|
SVG ファイルを template として、JSON/YAML ファイルで受け取った内容を差込印刷する。
|
||||||
|
|
||||||
|
SVG template の text element の data-field attribute をキーにして 印字テキストを JSON/YAML ファイルのデータで置き換える
|
||||||
|
|
||||||
|
----
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 124 124" fill="none">
|
||||||
|
<rect width="124" height="124" rx="24" fill="#FFFFFFFF"/>
|
||||||
|
<text fill="#000000" x="5" y="60" data-field="label" font-size="40">
|
||||||
|
Label
|
||||||
|
</text>
|
||||||
|
</svg>
|
||||||
|
----
|
||||||
|
|
||||||
|
という SVG ファイルと
|
||||||
|
|
||||||
|
^^^^
|
||||||
|
label: "ラベル"
|
||||||
|
----
|
||||||
|
|
||||||
|
という YAML ファイルを受け取ったら、
|
||||||
|
|
||||||
|
SVG の text の中身のテキストを"ラベル" に置き換えるという感じです。
|
||||||
|
|
||||||
|
== PNG 自動拡大・縮小(後日実装メモ)
|
||||||
|
|
||||||
|
PNG でも、現在テープ幅(printable_dots)に合わせた自動拡大・縮小を可能にしたい。
|
||||||
|
既定動作は現状維持(自動拡大・縮小 OFF)とし、オプションで ON/OFF を切り替える。
|
||||||
|
|
||||||
|
実装方針(案):
|
||||||
|
|
||||||
|
- lib 側に「現在テープ幅へ raster をフィットする」共通 API を追加する。
|
||||||
|
- PNG/SVG とも最終的に raster になるため、fit 処理は共通化する。
|
||||||
|
- CLI には `--fit-current-tape`(仮)を追加し、明示時のみ有効化する。
|
||||||
|
- まずは `contain` 相当(縦横比維持で収める)を実装する。
|
||||||
|
|
||||||
|
検討ポイント:
|
||||||
|
|
||||||
|
- 1bit 画像の縮小品質(単純 nearest だと潰れやすい)。
|
||||||
|
- 既存の length x width 表示/内部座標との整合。
|
||||||
|
- 既存ユーザー互換性(デフォルト OFF を維持)。
|
||||||
|
|||||||
@@ -5,12 +5,10 @@
|
|||||||
## 前提
|
## 前提
|
||||||
|
|
||||||
1. リポジトリルートで共有ライブラリをビルドする(`libptouch.so` が `build/` に生成されます)。
|
1. リポジトリルートで共有ライブラリをビルドする(`libptouch.so` が `build/` に生成されます)。
|
||||||
|
```bash
|
||||||
```bash
|
|
||||||
cmake -S .. -B ../build
|
cmake -S .. -B ../build
|
||||||
cmake --build ../build
|
cmake --build ../build
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Ruby 3.0 以上と `ffi` gem。
|
2. Ruby 3.0 以上と `ffi` gem。
|
||||||
|
|
||||||
## インストール(開発時)
|
## インストール(開発時)
|
||||||
@@ -37,7 +35,7 @@ C の `ptouch-print` と同様の流れで、**PNG/SVG 入力**(`-w`/`-H` や
|
|||||||
SVG は現在装着テープの印字可能幅に合わせて自動拡大・縮小します(USB 接続が必要)。
|
SVG は現在装着テープの印字可能幅に合わせて自動拡大・縮小します(USB 接続が必要)。
|
||||||
後方互換のため `ptouch-print-png` も引き続き使えます。
|
後方互換のため `ptouch-print-png` も引き続き使えます。
|
||||||
|
|
||||||
オプションは C 側に合わせ、**`-p` / `--pid`** で USB 製品 ID(16 進可)を指定できます。省略時は PT-P900W(`Libptouch::USB_PID_PTP900W` = `0x2085`)。例: PT-P750W `0x2062`、PT-P710BT `0x20af`(`libptouch.h` / `Libptouch` 定数と同じ)。
|
オプションは C 側に合わせ、`**-p` / `--pid`** で USB 製品 ID(16 進可)を指定できます。省略時は PT-P900W(`Libptouch::USB_PID_PTP900W` = `0x2085`)。例: PT-P750W `0x2062`、PT-P710BT `0x20af`(`libptouch.h` / `Libptouch` 定数と同じ)。
|
||||||
また、`--template`(SVG)と `--data`(JSON/YAML)を使うと `data-field` 属性をキーにした差込印刷が可能です。
|
また、`--template`(SVG)と `--data`(JSON/YAML)を使うと `data-field` 属性をキーにした差込印刷が可能です。
|
||||||
`--trim-right[=DOTS]` を付けると、libptouch 側の共通処理でラベル右側の空白ドット列を削減します。`DOTS` 省略時は左余白ドット数を使い、取得失敗時は `0` にフォールバックします。
|
`--trim-right[=DOTS]` を付けると、libptouch 側の共通処理でラベル右側の空白ドット列を削減します。`DOTS` 省略時は左余白ドット数を使い、取得失敗時は `0` にフォールバックします。
|
||||||
|
|
||||||
@@ -104,4 +102,5 @@ ctx.dispose
|
|||||||
- `check_raster` / `print_raster` / `png_file_to_raster` / `svg_file_to_raster_fit_current_tape` / `status_bytes` / `status_hash` / `current_media_info`
|
- `check_raster` / `print_raster` / `png_file_to_raster` / `svg_file_to_raster_fit_current_tape` / `status_bytes` / `status_hash` / `current_media_info`
|
||||||
- `current_media_info` には `print_dpi` / `feed_dpi` / `tape_width_mm` / `printable_height_dots` / `min_feed_mm` などを含む(テープ幅方向は `printable_height_dots`)
|
- `current_media_info` には `print_dpi` / `feed_dpi` / `tape_width_mm` / `printable_height_dots` / `min_feed_mm` などを含む(テープ幅方向は `printable_height_dots`)
|
||||||
- `Libptouch.parse_status(raw)` … 32 バイトを Hash に展開(機種・テープ幅・**テープ種類**・色・**状態(status_kind)**・エラービット・`raw_hex` など)
|
- `Libptouch.parse_status(raw)` … 32 バイトを Hash に展開(機種・テープ幅・**テープ種類**・色・**状態(status_kind)**・エラービット・`raw_hex` など)
|
||||||
- C の `libptouch_status_fprint`(`FILE *`)は FFI からはバインドしていません。テキスト出力の代わりに `parse_status` / `status_hash` を使ってください。
|
- C の `libptouch_status_fprint`(`FILE` *)は FFI からはバインドしていません。テキスト出力の代わりに `parse_status` / `status_hash` を使ってください。
|
||||||
|
|
||||||
|
|||||||
BIN
samples/aBw70.png
Normal file
BIN
samples/aBw70.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
Reference in New Issue
Block a user