psdparse 0.2.1__tar.gz → 0.2.2__tar.gz

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.
Files changed (40) hide show
  1. {psdparse-0.2.1 → psdparse-0.2.2}/PKG-INFO +1 -1
  2. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psddata.h +10 -1
  3. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdengine.cpp +16 -5
  4. {psdparse-0.2.1 → psdparse-0.2.2}/pyproject.toml +1 -1
  5. {psdparse-0.2.1 → psdparse-0.2.2}/python/psdparse_module.cpp +8 -0
  6. {psdparse-0.2.1 → psdparse-0.2.2}/.gitignore +0 -0
  7. {psdparse-0.2.1 → psdparse-0.2.2}/CMakeLists.txt +0 -0
  8. {psdparse-0.2.1 → psdparse-0.2.2}/CMakePresets.json +0 -0
  9. {psdparse-0.2.1 → psdparse-0.2.2}/LICENSE +0 -0
  10. {psdparse-0.2.1 → psdparse-0.2.2}/Makefile +0 -0
  11. {psdparse-0.2.1 → psdparse-0.2.2}/README.md +0 -0
  12. {psdparse-0.2.1 → psdparse-0.2.2}/docs/ARCHITECTURE.md +0 -0
  13. {psdparse-0.2.1 → psdparse-0.2.2}/docs/PYTHON_API.md +0 -0
  14. {psdparse-0.2.1 → psdparse-0.2.2}/docs/ROADMAP.md +0 -0
  15. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/CMakeLists.txt +0 -0
  16. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/bmp.cpp +0 -0
  17. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psd_cli.cpp +0 -0
  18. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdbase.h +0 -0
  19. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psddesc.cpp +0 -0
  20. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psddesc.h +0 -0
  21. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdengine.h +0 -0
  22. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdfile.cpp +0 -0
  23. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdfile.h +0 -0
  24. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdimage.cpp +0 -0
  25. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdlayer.cpp +0 -0
  26. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdlayer.h +0 -0
  27. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdparse.cpp +0 -0
  28. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdparse.h +0 -0
  29. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdresource.cpp +0 -0
  30. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdresource.h +0 -0
  31. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdwrite.cpp +0 -0
  32. {psdparse-0.2.1 → psdparse-0.2.2}/psdparse/psdwrite.h +0 -0
  33. {psdparse-0.2.1 → psdparse-0.2.2}/python/CMakeLists.txt +0 -0
  34. {psdparse-0.2.1 → psdparse-0.2.2}/tests/conftest.py +0 -0
  35. {psdparse-0.2.1 → psdparse-0.2.2}/tests/test_header.py +0 -0
  36. {psdparse-0.2.1 → psdparse-0.2.2}/tests/test_images.py +0 -0
  37. {psdparse-0.2.1 → psdparse-0.2.2}/tests/test_layers.py +0 -0
  38. {psdparse-0.2.1 → psdparse-0.2.2}/tests/test_save.py +0 -0
  39. {psdparse-0.2.1 → psdparse-0.2.2}/tests/test_text.py +0 -0
  40. {psdparse-0.2.1 → psdparse-0.2.2}/tools/psd_export.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: psdparse
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Fast PSD (Photoshop) reader/writer — C++17 core with pybind11 bindings
5
5
  Keywords: psd,photoshop,parser,image,graphics
6
6
  Author-Email: wamsoft <wtnbgo@gmail.com>
@@ -414,14 +414,23 @@ namespace psd {
414
414
  tracking(0), kerning(0), autoKerning(false), sizeInherited(false) {}
415
415
  };
416
416
 
417
+ // 段落単位の情報 (EngineDict/ParagraphRun)。 段落は本文中の改行 (\r) 区切り。
418
+ struct TextParagraph {
419
+ int length; // 段落の文字数 (UTF-16 コードユニット, RunLengthArray)
420
+ int justification; // 行揃え 0=左 1=右 2=中央 (3..=両端揃え系)
421
+
422
+ TextParagraph() : length(0), justification(0) {}
423
+ };
424
+
417
425
  // テキストレイヤ情報 (追加レイヤ情報 'TySh' 由来)。
418
426
  struct TextLayerData {
419
427
  bool present; // テキストレイヤとしてパースできたか
420
428
  u16str text; // 本文全体 (改行は \r)
421
429
  double transform[6]; // アフィン変換 xx,xy,yx,yy,tx,ty
422
430
  std::string orientation; // "horizontal" / "vertical"
423
- int justification; // 段落の行揃え 0=左 1=右 2=中央 (先頭段落)
431
+ int justification; // 段落の行揃え 0=左 1=右 2=中央 (先頭段落; 後方互換)
424
432
  std::vector<TextStyleRun> runs;
433
+ std::vector<TextParagraph> paragraphs; // 段落別 (行揃えが段落で変わる box text 用)
425
434
 
426
435
  TextLayerData()
427
436
  : present(false), transform{1,0,0,1,0,0},
@@ -289,12 +289,23 @@ namespace {
289
289
  }
290
290
  }
291
291
 
292
- // 行揃え (先頭段落の Justification)
293
- Node *paraArr = dget(dget(engine, "ParagraphRun"), "RunArray");
292
+ // 段落別の行揃え (ParagraphRun)。 out.justification は先頭段落 (後方互換)
293
+ // out.paragraphs に全段落分 (length + justification) を格納する。
294
+ Node *paraRun = dget(engine, "ParagraphRun");
295
+ Node *paraArr = dget(paraRun, "RunArray");
296
+ Node *paraLen = dget(paraRun, "RunLengthArray");
294
297
  if (paraArr && paraArr->kind == Node::ARRAY && !paraArr->arr.empty()) {
295
- Node *props = dget(dget(paraArr->arr[0], "ParagraphSheet"), "Properties");
296
- Node *just = dget(props, "Justification");
297
- if (just && just->kind == Node::NUMBER) out.justification = (int)just->num;
298
+ for (size_t i = 0; i < paraArr->arr.size(); i++) {
299
+ TextParagraph p;
300
+ if (paraLen && paraLen->kind == Node::ARRAY && i < paraLen->arr.size() &&
301
+ paraLen->arr[i]->kind == Node::NUMBER)
302
+ p.length = (int)paraLen->arr[i]->num;
303
+ Node *props = dget(dget(paraArr->arr[i], "ParagraphSheet"), "Properties");
304
+ Node *just = dget(props, "Justification");
305
+ if (just && just->kind == Node::NUMBER) p.justification = (int)just->num;
306
+ out.paragraphs.push_back(p);
307
+ }
308
+ out.justification = out.paragraphs[0].justification; // 後方互換
298
309
  }
299
310
  }
300
311
 
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "psdparse"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Fast PSD (Photoshop) reader/writer — C++17 core with pybind11 bindings"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -63,6 +63,14 @@ py::object layerText(const psd::LayerInfo &l) {
63
63
  runs.append(rd);
64
64
  }
65
65
  d["runs"] = runs;
66
+ py::list paras;
67
+ for (const auto &p : t.paragraphs) {
68
+ py::dict pd;
69
+ pd["length"] = p.length; // UTF-16 code units
70
+ pd["justification"] = p.justification; // 0=left 1=right 2=center
71
+ paras.append(pd);
72
+ }
73
+ d["paragraphs"] = paras; // 段落別行揃え (段落=改行区切り)
66
74
  return std::move(d);
67
75
  }
68
76
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes