@clipen/clipen-cli 0.0.0-stage → 1.0.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.
Files changed (232) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -2
  3. package/apps/web/dist/assets/index-D5D2HiB1.js +14 -0
  4. package/apps/web/dist/assets/index-DIMuOXSu.css +1 -0
  5. package/apps/web/dist/favicon.svg +1 -0
  6. package/apps/web/dist/index.html +16 -0
  7. package/bin/clipen.js +157 -0
  8. package/clipen +18 -0
  9. package/install +25 -0
  10. package/package.json +52 -4
  11. package/pyproject.toml +28 -0
  12. package/requirements/asr-runtime.txt +13 -0
  13. package/requirements/runtime.txt +20 -0
  14. package/src/clipen/__init__.py +3 -0
  15. package/src/clipen/analysis/__init__.py +89 -0
  16. package/src/clipen/analysis/artifacts.py +416 -0
  17. package/src/clipen/analysis/audio.py +392 -0
  18. package/src/clipen/analysis/evidence.py +102 -0
  19. package/src/clipen/analysis/evidence_service.py +751 -0
  20. package/src/clipen/analysis/image_similarity.py +143 -0
  21. package/src/clipen/analysis/keyframes.py +171 -0
  22. package/src/clipen/analysis/models.py +230 -0
  23. package/src/clipen/analysis/qwen_worker.py +629 -0
  24. package/src/clipen/analysis/resources.py +21 -0
  25. package/src/clipen/analysis/runtime.py +64 -0
  26. package/src/clipen/analysis/service.py +626 -0
  27. package/src/clipen/analysis/setup.py +935 -0
  28. package/src/clipen/analysis/setup_cli.py +117 -0
  29. package/src/clipen/analysis/storage.py +2046 -0
  30. package/src/clipen/analysis/transcription.py +948 -0
  31. package/src/clipen/analysis/visual.py +176 -0
  32. package/src/clipen/annotations/__init__.py +10 -0
  33. package/src/clipen/annotations/models.py +22 -0
  34. package/src/clipen/annotations/storage.py +380 -0
  35. package/src/clipen/annotations/suggestions.py +120 -0
  36. package/src/clipen/asr_release.py +139 -0
  37. package/src/clipen/bootstrap.py +967 -0
  38. package/src/clipen/cli.py +84 -0
  39. package/src/clipen/controller/__init__.py +17 -0
  40. package/src/clipen/controller/app.py +1470 -0
  41. package/src/clipen/controller/server.py +543 -0
  42. package/src/clipen/domain/__init__.py +30 -0
  43. package/src/clipen/domain/errors.py +5 -0
  44. package/src/clipen/domain/media_time.py +117 -0
  45. package/src/clipen/domain/timeline.py +584 -0
  46. package/src/clipen/domain/validation.py +15 -0
  47. package/src/clipen/editing/EDITORIAL_REGRESSIONS.md +38 -0
  48. package/src/clipen/editing/PROGRAM_FORMAT.md +102 -0
  49. package/src/clipen/editing/README.md +115 -0
  50. package/src/clipen/editing/REFACTOR_DESIGN.md +241 -0
  51. package/src/clipen/editing/REFACTOR_HANDOFF.md +73 -0
  52. package/src/clipen/editing/__init__.py +15 -0
  53. package/src/clipen/editing/agent.py +13 -0
  54. package/src/clipen/editing/agent_models.py +134 -0
  55. package/src/clipen/editing/agent_repository.py +757 -0
  56. package/src/clipen/editing/agent_tools.py +532 -0
  57. package/src/clipen/editing/alignment.py +110 -0
  58. package/src/clipen/editing/alignment_setup.py +108 -0
  59. package/src/clipen/editing/alignment_worker.py +22 -0
  60. package/src/clipen/editing/change_report.py +71 -0
  61. package/src/clipen/editing/compiler.py +41 -0
  62. package/src/clipen/editing/component_looks.py +107 -0
  63. package/src/clipen/editing/component_review.py +78 -0
  64. package/src/clipen/editing/coordinator.py +374 -0
  65. package/src/clipen/editing/editorial_review.py +187 -0
  66. package/src/clipen/editing/evidence_jobs.py +295 -0
  67. package/src/clipen/editing/history_changes.py +131 -0
  68. package/src/clipen/editing/music_choices.py +15 -0
  69. package/src/clipen/editing/production_catalog.py +192 -0
  70. package/src/clipen/editing/production_limits.py +59 -0
  71. package/src/clipen/editing/production_media.py +226 -0
  72. package/src/clipen/editing/production_preview.py +180 -0
  73. package/src/clipen/editing/production_progress.py +141 -0
  74. package/src/clipen/editing/production_requirements.py +50 -0
  75. package/src/clipen/editing/production_tools.py +596 -0
  76. package/src/clipen/editing/program_audio.py +118 -0
  77. package/src/clipen/editing/program_direction.py +49 -0
  78. package/src/clipen/editing/program_story.py +53 -0
  79. package/src/clipen/editing/program_subtitles.py +134 -0
  80. package/src/clipen/editing/programme_review.py +73 -0
  81. package/src/clipen/editing/prompt_history.py +47 -0
  82. package/src/clipen/editing/recut.py +127 -0
  83. package/src/clipen/editing/refinement_references.py +188 -0
  84. package/src/clipen/editing/resolve_export.py +616 -0
  85. package/src/clipen/editing/resolve_titles.py +234 -0
  86. package/src/clipen/editing/skill_tools.py +575 -0
  87. package/src/clipen/editing/source_dialogue.py +82 -0
  88. package/src/clipen/editing/speech_coverage.py +30 -0
  89. package/src/clipen/editing/speech_quality.py +6 -0
  90. package/src/clipen/editing/tool_receipts.py +52 -0
  91. package/src/clipen/editing/versions.py +161 -0
  92. package/src/clipen/editing/visual_preview.py +93 -0
  93. package/src/clipen/editing/workbench.py +74 -0
  94. package/src/clipen/filesystem.py +25 -0
  95. package/src/clipen/finishing/README.md +103 -0
  96. package/src/clipen/finishing/__init__.py +1 -0
  97. package/src/clipen/finishing/audio.py +149 -0
  98. package/src/clipen/finishing/catalog.py +181 -0
  99. package/src/clipen/finishing/models.py +14 -0
  100. package/src/clipen/finishing/renderer.py +26 -0
  101. package/src/clipen/mcp_editing/__init__.py +5 -0
  102. package/src/clipen/mcp_editing/__main__.py +40 -0
  103. package/src/clipen/mcp_editing/server.py +353 -0
  104. package/src/clipen/media/__init__.py +50 -0
  105. package/src/clipen/media/discovery.py +266 -0
  106. package/src/clipen/media/models.py +360 -0
  107. package/src/clipen/media/preview.py +147 -0
  108. package/src/clipen/media/probe.py +446 -0
  109. package/src/clipen/media/service.py +317 -0
  110. package/src/clipen/media/storage.py +742 -0
  111. package/src/clipen/music_vocabulary.py +5 -0
  112. package/src/clipen/planning/__init__.py +9 -0
  113. package/src/clipen/planning/models.py +240 -0
  114. package/src/clipen/power.py +23 -0
  115. package/src/clipen/projects/__init__.py +26 -0
  116. package/src/clipen/projects/agent_schema.py +94 -0
  117. package/src/clipen/projects/annotation_schema.py +40 -0
  118. package/src/clipen/projects/deletion.py +269 -0
  119. package/src/clipen/projects/evidence_schema.py +52 -0
  120. package/src/clipen/projects/finishing_schema.py +34 -0
  121. package/src/clipen/projects/models.py +192 -0
  122. package/src/clipen/projects/picker.py +256 -0
  123. package/src/clipen/projects/preview_schema.py +29 -0
  124. package/src/clipen/projects/service.py +175 -0
  125. package/src/clipen/projects/storage.py +1478 -0
  126. package/src/clipen/projects/timeline_schema.py +32 -0
  127. package/src/clipen/projects/validation_schema.py +28 -0
  128. package/src/clipen/provider_registry.py +75 -0
  129. package/src/clipen/providers/__init__.py +43 -0
  130. package/src/clipen/providers/account.py +194 -0
  131. package/src/clipen/providers/claude.py +375 -0
  132. package/src/clipen/providers/claude_editing.py +111 -0
  133. package/src/clipen/providers/codex.py +1036 -0
  134. package/src/clipen/providers/codex_editing.py +91 -0
  135. package/src/clipen/providers/editing_agent.py +565 -0
  136. package/src/clipen/providers/errors.py +51 -0
  137. package/src/clipen/providers/recovery.py +270 -0
  138. package/src/clipen/py.typed +1 -0
  139. package/src/clipen/rendering/__init__.py +12 -0
  140. package/src/clipen/rendering/cover.py +126 -0
  141. package/src/clipen/rendering/custom_components.py +240 -0
  142. package/src/clipen/rendering/custom_render.py +197 -0
  143. package/src/clipen/rendering/fonts/anton-OFL.txt +93 -0
  144. package/src/clipen/rendering/fonts/bebasneue-OFL.txt +93 -0
  145. package/src/clipen/rendering/fonts/caveat-OFL.txt +93 -0
  146. package/src/clipen/rendering/fonts/chenyu-OFL.txt +93 -0
  147. package/src/clipen/rendering/fonts/delagothicone-OFL.txt +93 -0
  148. package/src/clipen/rendering/fonts/hachimarupop-OFL.txt +93 -0
  149. package/src/clipen/rendering/fonts/iansui-OFL.txt +93 -0
  150. package/src/clipen/rendering/fonts/manifest.json +145 -0
  151. package/src/clipen/rendering/fonts/playfairdisplay-OFL.txt +93 -0
  152. package/src/clipen/rendering/fonts/rocknrollone-OFL.txt +93 -0
  153. package/src/clipen/rendering/fonts/yomogi-OFL.txt +94 -0
  154. package/src/clipen/rendering/fonts/yuseimagic-OFL.txt +93 -0
  155. package/src/clipen/rendering/fonts/zenkurenaido-OFL.txt +93 -0
  156. package/src/clipen/rendering/fonts/zenmarugothic-OFL.txt +93 -0
  157. package/src/clipen/rendering/production_effects.py +64 -0
  158. package/src/clipen/rendering/program_components.py +193 -0
  159. package/src/clipen/rendering/program_creator.py +649 -0
  160. package/src/clipen/rendering/program_identities.py +255 -0
  161. package/src/clipen/rendering/program_motion.py +141 -0
  162. package/src/clipen/rendering/program_studio.py +168 -0
  163. package/src/clipen/rendering/program_styles.py +235 -0
  164. package/src/clipen/rendering/program_subtitles.py +52 -0
  165. package/src/clipen/rendering/renderer.py +708 -0
  166. package/src/clipen/rendering/storage.py +243 -0
  167. package/src/clipen/rendering/titles.py +360 -0
  168. package/src/clipen/skills/__init__.py +4 -0
  169. package/src/clipen/skills/builtin/SKILL.md +72 -0
  170. package/src/clipen/skills/builtin/assets/sample-daily-vlog.mp4 +0 -0
  171. package/src/clipen/skills/builtin/assets/sample-event-recap.mp4 +0 -0
  172. package/src/clipen/skills/builtin/assets/sample-food-review.mp4 +0 -0
  173. package/src/clipen/skills/builtin/assets/sample-product-demo.mp4 +0 -0
  174. package/src/clipen/skills/builtin/assets/sample-product-review.mp4 +0 -0
  175. package/src/clipen/skills/builtin/assets/sample-product-unboxing.mp4 +0 -0
  176. package/src/clipen/skills/builtin/assets/sample-shorts-highlight.mp4 +0 -0
  177. package/src/clipen/skills/builtin/assets/sample-travel-highlight.mp4 +0 -0
  178. package/src/clipen/skills/builtin/assets/sample-travel-vlog.mp4 +0 -0
  179. package/src/clipen/skills/builtin/assets/style-cinema.png +0 -0
  180. package/src/clipen/skills/builtin/assets/style-editorial.png +0 -0
  181. package/src/clipen/skills/builtin/assets/style-tpl-daily-vlog.png +0 -0
  182. package/src/clipen/skills/builtin/assets/style-tpl-event-recap.png +0 -0
  183. package/src/clipen/skills/builtin/assets/style-tpl-food-review.png +0 -0
  184. package/src/clipen/skills/builtin/assets/style-tpl-product-demo.png +0 -0
  185. package/src/clipen/skills/builtin/assets/style-tpl-product-review.png +0 -0
  186. package/src/clipen/skills/builtin/assets/style-tpl-product-unboxing.png +0 -0
  187. package/src/clipen/skills/builtin/assets/style-tpl-shorts-highlight.png +0 -0
  188. package/src/clipen/skills/builtin/assets/style-tpl-travel-highlight.png +0 -0
  189. package/src/clipen/skills/builtin/assets/style-tpl-travel-vlog.png +0 -0
  190. package/src/clipen/skills/builtin/assets/style-variety.png +0 -0
  191. package/src/clipen/skills/builtin/components.json +133 -0
  192. package/src/clipen/skills/builtin/font_sources.json +20 -0
  193. package/src/clipen/skills/builtin/font_styles.json +329 -0
  194. package/src/clipen/skills/builtin/manifest.json +32 -0
  195. package/src/clipen/skills/builtin/presets.json +8 -0
  196. package/src/clipen/skills/builtin/references/captions.md +14 -0
  197. package/src/clipen/skills/builtin/references/channel-design.md +37 -0
  198. package/src/clipen/skills/builtin/references/editing.md +30 -0
  199. package/src/clipen/skills/builtin/references/font-chenyu-OFL.txt +93 -0
  200. package/src/clipen/skills/builtin/references/font-iansui-OFL.txt +93 -0
  201. package/src/clipen/skills/builtin/references/graphics.md +59 -0
  202. package/src/clipen/skills/builtin/references/review.md +16 -0
  203. package/src/clipen/skills/builtin/references/sound.md +8 -0
  204. package/src/clipen/skills/builtin/references/story.md +7 -0
  205. package/src/clipen/skills/builtin/skills/travel-program/SKILL.md +27 -0
  206. package/src/clipen/skills/builtin/skills/travel-program/manifest.json +6 -0
  207. package/src/clipen/skills/builtin/template-skills/clipen-daily-vlog/SKILL.md +33 -0
  208. package/src/clipen/skills/builtin/template-skills/clipen-daily-vlog/manifest.json +8 -0
  209. package/src/clipen/skills/builtin/template-skills/clipen-event-recap/SKILL.md +34 -0
  210. package/src/clipen/skills/builtin/template-skills/clipen-event-recap/manifest.json +8 -0
  211. package/src/clipen/skills/builtin/template-skills/clipen-food-review/SKILL.md +33 -0
  212. package/src/clipen/skills/builtin/template-skills/clipen-food-review/manifest.json +8 -0
  213. package/src/clipen/skills/builtin/template-skills/clipen-product-demo/SKILL.md +35 -0
  214. package/src/clipen/skills/builtin/template-skills/clipen-product-demo/manifest.json +8 -0
  215. package/src/clipen/skills/builtin/template-skills/clipen-product-review/SKILL.md +36 -0
  216. package/src/clipen/skills/builtin/template-skills/clipen-product-review/manifest.json +8 -0
  217. package/src/clipen/skills/builtin/template-skills/clipen-product-unboxing/SKILL.md +39 -0
  218. package/src/clipen/skills/builtin/template-skills/clipen-product-unboxing/manifest.json +8 -0
  219. package/src/clipen/skills/builtin/template-skills/clipen-shorts-highlight/SKILL.md +38 -0
  220. package/src/clipen/skills/builtin/template-skills/clipen-shorts-highlight/manifest.json +8 -0
  221. package/src/clipen/skills/builtin/template-skills/clipen-travel-highlight/SKILL.md +34 -0
  222. package/src/clipen/skills/builtin/template-skills/clipen-travel-highlight/manifest.json +8 -0
  223. package/src/clipen/skills/builtin/template-skills/clipen-travel-vlog/SKILL.md +37 -0
  224. package/src/clipen/skills/builtin/template-skills/clipen-travel-vlog/manifest.json +8 -0
  225. package/src/clipen/skills/builtin/templates.json +284 -0
  226. package/src/clipen/skills/builtin/visual_styles.json +1074 -0
  227. package/src/clipen/skills/catalog.py +218 -0
  228. package/src/clipen/skills/library.py +131 -0
  229. package/src/clipen/skills/package.py +231 -0
  230. package/src/clipen/skills/visual_styles.py +44 -0
  231. package/src/clipen/workspace.py +210 -0
  232. package/uninstall +25 -0
@@ -0,0 +1,240 @@
1
+ """Graphics an Agent designs freely as a web page (HTML, CSS, SVG, Canvas, JS).
2
+
3
+ The page fills the whole picture and is transparent wherever it draws nothing.
4
+ Frames are drawn by ``custom_render`` in a sealed headless Chrome, cached on
5
+ disk by content, and composited like any other programme graphic, so the
6
+ preview, the film and the Resolve export show the same picture.
7
+ """
8
+ import hashlib
9
+ import json
10
+ import os
11
+ from pathlib import Path
12
+ import subprocess
13
+ import sys
14
+ import tempfile
15
+ import threading
16
+
17
+ from .titles import TitleRenderError
18
+
19
+ MAX_HTML_BYTES = 200_000
20
+ FRAME_TIMEOUT_SECONDS = 10
21
+ CUSTOM = 'custom'
22
+ _locks = {}
23
+ _guard = threading.Lock()
24
+
25
+
26
+ def is_custom(profile):
27
+ return profile.get('component_id') == CUSTOM
28
+
29
+
30
+ def cache_root():
31
+ configured = os.environ.get('CLIPEN_CUSTOM_COMPONENT_CACHE')
32
+ if configured:
33
+ return Path(configured)
34
+ from clipen.bootstrap import clipen_data_root
35
+ return clipen_data_root() / 'cache' / 'custom-components'
36
+
37
+
38
+ def _fps(timeline):
39
+ return timeline.frame_rate.numerator / timeline.frame_rate.denominator
40
+
41
+
42
+ def _edits(profile):
43
+ edits = profile.get('edits') or {}
44
+ return {kind: dict(sorted((edits.get(kind) or {}).items())) for kind in ('texts', 'colors') if edits.get(kind)}
45
+
46
+
47
+ def _bundled():
48
+ """Fonts Clipen carries itself (pinned in fonts/manifest.json), by family name: nothing to install."""
49
+ from importlib.resources import files
50
+ manifest = json.loads(files('clipen.rendering').joinpath('fonts', 'manifest.json').read_text(encoding='utf-8'))
51
+ return {entry['family']: entry for entry in manifest.values()}
52
+
53
+
54
+ BUNDLED = _bundled()
55
+ # Typefaces a look may use: what every Mac has, plus the fonts Clipen carries.
56
+ _SYSTEM = {
57
+ 'PingFang TC': '蘋方', 'Heiti TC': '黑體', 'Songti TC': '宋體', 'Hiragino Sans': '冬青黑體', 'Hiragino Mincho ProN': '冬青明朝',
58
+ 'Helvetica Neue': 'Helvetica Neue', 'Avenir Next': 'Avenir Next', 'Futura': 'Futura', 'Gill Sans': 'Gill Sans', 'Optima': 'Optima',
59
+ 'Didot': 'Didot', 'Baskerville': 'Baskerville', 'Georgia': 'Georgia', 'Rockwell': 'Rockwell', 'Copperplate': 'Copperplate',
60
+ 'Impact': 'Impact', 'Arial Black': 'Arial Black', 'Chalkduster': 'Chalkduster', 'Marker Felt': 'Marker Felt', 'Noteworthy': 'Noteworthy', 'Menlo': 'Menlo',
61
+ }
62
+ FONT_CHOICES = {**{family: entry['label'] for family, entry in BUNDLED.items()}, **_SYSTEM}
63
+ # Where a typeface lacks a character (Japanese kana in a Chinese hand, Chinese in a Japanese one,
64
+ # anything in a Latin face) the next face of the same feel draws it, so a line keeps its style.
65
+ _HAND = ['Clipen Chenyu', 'Yomogi', 'Clipen Iansui']
66
+ FALLBACKS = {
67
+ 'Clipen Chenyu': ['Yomogi', 'Clipen Iansui'], 'Clipen Iansui': [],
68
+ 'Yusei Magic': ['Clipen Chenyu', 'Clipen Iansui'], 'Yomogi': ['Clipen Chenyu', 'Clipen Iansui'],
69
+ 'Zen Kurenaido': ['Clipen Iansui'], 'Hachi Maru Pop': ['Yomogi', 'Clipen Chenyu', 'Clipen Iansui'],
70
+ 'Dela Gothic One': ['Heiti TC'], 'RocknRoll One': ['Zen Maru Gothic', 'PingFang TC'], 'Zen Maru Gothic': ['PingFang TC'],
71
+ 'Bebas Neue': ['Heiti TC'], 'Anton': ['Heiti TC'], 'Caveat': _HAND, 'Playfair Display': ['Songti TC'],
72
+ 'Chalkduster': _HAND, 'Marker Felt': _HAND, 'Noteworthy': _HAND,
73
+ 'Songti TC': ['Hiragino Mincho ProN'], 'Hiragino Mincho ProN': ['Songti TC'], 'Didot': ['Songti TC'], 'Baskerville': ['Songti TC'], 'Georgia': ['Songti TC'],
74
+ }
75
+
76
+
77
+ def font_stack(family):
78
+ """The CSS font list for a typeface: itself, faces of the same feel for missing characters, then PingFang."""
79
+ chain = [family, *FALLBACKS.get(family, []), 'PingFang TC']
80
+ return ', '.join(f'"{name}"' for name in dict.fromkeys(chain)) + ', sans-serif'
81
+
82
+
83
+ def look_css(look):
84
+ """The CSS a look gives a page: --look-font-<key> and --look-<key> variables on :root, with the faces
85
+ Clipen carries declared for every typeface the look may draw with, fallbacks included."""
86
+ if not look:
87
+ return ''
88
+ used = dict.fromkeys(name for f in look['fonts'] for name in [f['family'], *FALLBACKS.get(f['family'], [])])
89
+ faces = ''.join(f'@font-face {{ font-family: "{family}"; src: url(https://clipen.local/fonts/{BUNDLED[family]["file"]}); }}\n'
90
+ for family in used if family in BUNDLED)
91
+ names = [f'--look-font-{f["key"]}: {font_stack(f["family"])};' for f in look['fonts']]
92
+ names += [f'--look-{c["key"]}: {c["value"]};' for c in look['colors']]
93
+ return faces + ':root { ' + ' '.join(names) + ' }'
94
+
95
+
96
+ def _key(profile, timeline, duration):
97
+ material = json.dumps([profile['html'], timeline.width, timeline.height,
98
+ timeline.frame_rate.numerator, timeline.frame_rate.denominator, duration, _edits(profile), look_css(profile.get('look'))],
99
+ ensure_ascii=False, sort_keys=True)
100
+ return hashlib.sha256(material.encode()).hexdigest()[:32]
101
+
102
+
103
+ def _lock(key):
104
+ with _guard:
105
+ return _locks.setdefault(key, threading.Lock())
106
+
107
+
108
+ class CustomRenderError(TitleRenderError):
109
+ def __init__(self, code, detail=''):
110
+ super().__init__(code)
111
+ self.detail = detail
112
+
113
+
114
+ def frames(timeline, item, profile, wanted):
115
+ """Paths of the requested relative frames, drawing the missing ones in one Chrome run."""
116
+ duration = item.duration_frames
117
+ wanted = sorted({min(max(0, int(n)), duration-1) for n in wanted})
118
+ key = _key(profile, timeline, duration)
119
+ folder = cache_root() / key
120
+ paths = {n: folder / f'f{n:05d}.png' for n in wanted}
121
+ with _lock(key):
122
+ missing = [n for n, path in paths.items() if not path.is_file()]
123
+ if missing:
124
+ folder.mkdir(parents=True, exist_ok=True)
125
+ job = {'html': profile['html'], 'width': timeline.width, 'height': timeline.height, 'fps': _fps(timeline),
126
+ 'duration': duration, 'frames': missing, 'out': str(folder), 'frame_timeout': FRAME_TIMEOUT_SECONDS,
127
+ 'edits': _edits(profile), 'look': look_css(profile.get('look'))}
128
+ _run(job, timeout=30 + FRAME_TIMEOUT_SECONDS + len(missing) * 1.5)
129
+ return paths
130
+
131
+
132
+ def fields(timeline, item, profile):
133
+ """The words and colours the page marked as editable, with the values the design gives them."""
134
+ plain = {key: value for key, value in profile.items() if key != 'edits'}
135
+ key = _key(plain, timeline, item.duration_frames)
136
+ folder = cache_root() / key
137
+ path = folder / 'fields.json'
138
+ with _lock(key):
139
+ if not path.is_file():
140
+ folder.mkdir(parents=True, exist_ok=True)
141
+ _run({'html': profile['html'], 'width': timeline.width, 'height': timeline.height, 'fps': _fps(timeline),
142
+ 'duration': item.duration_frames, 'frames': [], 'out': str(folder), 'frame_timeout': FRAME_TIMEOUT_SECONDS,
143
+ 'describe': True, 'look': look_css(profile.get('look'))}, timeout=30 + FRAME_TIMEOUT_SECONDS)
144
+ found = json.loads(path.read_text(encoding='utf-8'))
145
+ # Bounded so a page cannot flood the review panel.
146
+ return {'texts': [f for f in found.get('texts', []) if isinstance(f.get('key'), str)][:12],
147
+ 'colors': [f for f in found.get('colors', []) if isinstance(f.get('key'), str)][:8],
148
+ 'fonts': [f for f in found.get('fonts', []) if isinstance(f, str)][:20]}
149
+
150
+
151
+ def check_fonts(timeline, item, profile):
152
+ """A graphic that uses a look draws its text only in that look's typefaces."""
153
+ look = profile.get('look')
154
+ if not look:
155
+ return
156
+ allowed = {f['family'] for f in look['fonts']}
157
+ stray = [family for family in fields(timeline, item, profile)['fonts'] if family not in allowed]
158
+ if stray:
159
+ raise CustomRenderError('custom_component_font_outside_look', '、'.join(stray))
160
+
161
+
162
+ def _run(job, timeout):
163
+ environment = {**os.environ, 'PYTHONPATH': os.pathsep.join(filter(None, [str(Path(__file__).resolve().parents[2]), os.environ.get('PYTHONPATH')]))}
164
+ try:
165
+ finished = subprocess.run([sys.executable, '-m', 'clipen.rendering.custom_render'], input=json.dumps(job),
166
+ capture_output=True, text=True, timeout=timeout, env=environment, cwd=tempfile.gettempdir())
167
+ except subprocess.TimeoutExpired:
168
+ raise CustomRenderError('custom_component_frame_timeout') from None
169
+ if finished.returncode != 0:
170
+ try:
171
+ problem = json.loads(finished.stderr.strip().splitlines()[-1])
172
+ except (ValueError, IndexError):
173
+ problem = {'code': 'custom_component_render_failed', 'detail': finished.stderr[-400:]}
174
+ raise CustomRenderError(problem.get('code', 'custom_component_render_failed'), problem.get('detail', ''))
175
+
176
+
177
+ def _image(path):
178
+ from PIL import Image
179
+ with Image.open(path) as image:
180
+ return image.convert('RGBA')
181
+
182
+
183
+ def _offset(timeline, profile):
184
+ return round(profile.get('x', 0) * timeline.width), round(profile.get('y', 0) * timeline.height)
185
+
186
+
187
+ def _resting_frame(item):
188
+ return item.duration_frames // 2
189
+
190
+
191
+ def bounds(timeline, item, profile, relative_frame=None):
192
+ """Where the graphic draws something, in pixels, after the user's move."""
193
+ frame = _resting_frame(item) if relative_frame is None else relative_frame
194
+ box = _image(frames(timeline, item, profile, [frame])[min(max(0, frame), item.duration_frames-1)]).getchannel('A').getbbox()
195
+ if box is None:
196
+ return None
197
+ dx, dy = _offset(timeline, profile)
198
+ return (box[0]+dx, box[1]+dy, box[2]+dx, box[3]+dy)
199
+
200
+
201
+ def draw(draw_, timeline, item, profile, relative_frame=None):
202
+ frame = _resting_frame(item) if relative_frame is None else min(max(0, relative_frame), item.duration_frames-1)
203
+ picture = _image(frames(timeline, item, profile, [frame])[frame])
204
+ dx, dy = _offset(timeline, profile)
205
+ target = draw_._image
206
+ # Crop whatever a move pushed off the picture; alpha_composite takes no negative offsets.
207
+ left, top = max(0, -dx), max(0, -dy)
208
+ right, bottom = min(picture.width, timeline.width-dx), min(picture.height, timeline.height-dy)
209
+ if right > left and bottom > top:
210
+ piece = picture.crop((left, top, right, bottom))
211
+ if target.mode == 'RGBA':
212
+ target.alpha_composite(piece, dest=(dx+left, dy+top))
213
+ else:
214
+ target.paste(piece, (dx+left, dy+top), piece)
215
+ box = picture.getchannel('A').getbbox()
216
+ return None if box is None else (box[0]+dx, box[1]+dy, box[2]+dx, box[3]+dy)
217
+
218
+
219
+ def changes(timeline, item, profile):
220
+ """Absolute frames where the picture differs from the frame before, so still stretches cost one image."""
221
+ paths = frames(timeline, item, profile, range(item.duration_frames))
222
+ marks, previous = {item.start_frame, item.start_frame+item.duration_frames}, None
223
+ for n in range(item.duration_frames):
224
+ digest = hashlib.sha256(_image(paths[n]).tobytes()).digest()
225
+ if digest != previous:
226
+ marks.add(item.start_frame+n)
227
+ previous = digest
228
+ return marks
229
+
230
+
231
+ def check(timeline, item, profile):
232
+ """Technical checks only: the page loads, runs and draws something at the start, middle and end."""
233
+ if not isinstance(profile.get('html'), str) or not profile['html'].strip():
234
+ raise CustomRenderError('custom_component_html_missing')
235
+ if len(profile['html'].encode()) > MAX_HTML_BYTES:
236
+ raise CustomRenderError('custom_component_html_too_large')
237
+ sample = sorted({0, _resting_frame(item), item.duration_frames-1})
238
+ paths = frames(timeline, item, profile, sample)
239
+ if all(_image(paths[n]).getchannel('A').getbbox() is None for n in sample):
240
+ raise CustomRenderError('custom_component_empty')
@@ -0,0 +1,197 @@
1
+ """Draw frames of an Agent-designed web page in a sealed headless Chrome.
2
+
3
+ Runs as its own process (``python -m clipen.rendering.custom_render``) so a page
4
+ that hangs or crashes can be killed without touching Clipen. It reads one JSON
5
+ job on stdin and writes one transparent PNG per requested frame. The page gets
6
+ no network: every request is refused except Clipen's own bundled fonts, served
7
+ from ``https://clipen.local/fonts/``. Time is Clipen's to set, so the same frame
8
+ always draws the same picture.
9
+ """
10
+ import json
11
+ from importlib.resources import files
12
+ import os
13
+ from pathlib import Path
14
+ import sys
15
+
16
+ FONT_ORIGIN = 'https://clipen.local/fonts/'
17
+ FONTS = {entry['file'] for entry in json.loads(files('clipen.rendering').joinpath('fonts', 'manifest.json').read_text(encoding='utf-8')).values()}
18
+
19
+ # Runs before the page's own scripts: a fixed clock and random sequence.
20
+ _PRELUDE = """
21
+ (() => {
22
+ let seed = 1, now = 0;
23
+ Math.random = () => { seed = (seed * 16807) % 2147483647; return (seed - 1) / 2147483646; };
24
+ performance.now = () => now;
25
+ const epoch = 1767225600000;
26
+ Date.now = () => epoch + now;
27
+ window.__clipenTime = (ms) => { now = ms; };
28
+ window.clipen = Object.freeze(__INFO__);
29
+ // A person's changes to the words and colours the page marked as editable. Words are set as the
30
+ // parser adds each marked element, before the page's own scripts read them; colours win over :root.
31
+ const edits = __EDITS__;
32
+ const texts = edits.texts || {}, colors = edits.colors || {};
33
+ const word = (node) => {
34
+ if (node.nodeType !== 1) return;
35
+ const apply = (el) => { const key = el.getAttribute('data-clipen-text'); if (key in texts && !el.__clipenSet) { el.textContent = texts[key]; el.__clipenSet = true; } };
36
+ if (node.hasAttribute && node.hasAttribute('data-clipen-text')) apply(node);
37
+ node.querySelectorAll && node.querySelectorAll('[data-clipen-text]').forEach(apply);
38
+ };
39
+ if (Object.keys(texts).length) {
40
+ new MutationObserver((records) => records.forEach((r) => r.addedNodes.forEach(word))).observe(document, { childList: true, subtree: true });
41
+ }
42
+ const paint = () => document.documentElement && Object.entries(colors).forEach(([key, value]) => document.documentElement.style.setProperty('--clipen-' + key, value));
43
+ // The page is the picture: no default margins, though the page may set its own. The look it uses
44
+ // (shared fonts and colours as --look-* variables) comes first, so the page's own rules build on it.
45
+ document.addEventListener('DOMContentLoaded', () => {
46
+ document.querySelectorAll('[data-clipen-text]').forEach(word);
47
+ paint();
48
+ const base = document.createElement('style');
49
+ base.textContent = ':where(html, body) { margin: 0; padding: 0; background: transparent; }\\n' + __LOOK__;
50
+ document.head.prepend(base);
51
+ });
52
+ })();
53
+ """
54
+
55
+ # What the page marked as editable: words in [data-clipen-text] elements, colours in --clipen-* variables.
56
+ _FIELDS = """
57
+ () => {
58
+ const probe = document.createElement('i');
59
+ document.body.appendChild(probe);
60
+ const hex = (value) => {
61
+ probe.style.color = '';
62
+ probe.style.color = value.trim();
63
+ if (!probe.style.color) return null;
64
+ const m = getComputedStyle(probe).color.match(/rgba?\\(([^)]+)\\)/);
65
+ if (!m) return null;
66
+ const [r, g, b] = m[1].split(',').map((v) => Math.round(parseFloat(v)));
67
+ return '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('');
68
+ };
69
+ const texts = [], seen = new Set();
70
+ document.querySelectorAll('[data-clipen-text]').forEach((el) => {
71
+ const key = el.getAttribute('data-clipen-text');
72
+ if (!key || seen.has(key)) return;
73
+ seen.add(key);
74
+ texts.push({ key, label: el.getAttribute('data-clipen-label') || key, value: el.textContent.trim() });
75
+ });
76
+ const colors = [], names = new Set();
77
+ for (const sheet of document.styleSheets) {
78
+ let rules;
79
+ try { rules = sheet.cssRules; } catch { continue; }
80
+ for (const rule of rules) {
81
+ if (!rule.style) continue;
82
+ for (const name of rule.style) if (name.startsWith('--clipen-')) names.add(name);
83
+ }
84
+ }
85
+ const root = getComputedStyle(document.documentElement);
86
+ names.forEach((name) => { const value = hex(root.getPropertyValue(name)); if (value) colors.push({ key: name.slice(9), label: name.slice(9), value }); });
87
+ probe.remove();
88
+ // The typeface each piece of visible text asks for first (fallbacks for missing glyphs are not counted).
89
+ const fonts = new Set();
90
+ document.querySelectorAll('body *').forEach((el) => {
91
+ if (!Array.from(el.childNodes).some((n) => n.nodeType === 3 && n.textContent.trim())) return;
92
+ const style = getComputedStyle(el);
93
+ if (style.display === 'none' || style.visibility === 'hidden') return;
94
+ fonts.add(style.fontFamily.split(',')[0].trim().replace(/^["']|["']$/g, ''));
95
+ });
96
+ return { texts, colors, fonts: Array.from(fonts) };
97
+ }
98
+ """
99
+
100
+ _SEEK = """
101
+ async ([frame, fps]) => {
102
+ const ms = frame / fps * 1000;
103
+ window.__clipenTime(ms);
104
+ const hold = () => document.getAnimations().forEach((a) => { a.pause(); a.currentTime = ms; });
105
+ hold();
106
+ if (typeof window.clipenFrame === 'function') await window.clipenFrame(frame, ms / 1000);
107
+ hold();
108
+ await document.fonts.ready;
109
+ await new Promise((done) => requestAnimationFrame(() => done()));
110
+ }
111
+ """
112
+
113
+
114
+ def fail(code, detail=''):
115
+ sys.stderr.write(json.dumps({'code': code, 'detail': detail[:400]}, ensure_ascii=False))
116
+ sys.exit(2)
117
+
118
+
119
+ def _browser(playwright):
120
+ errors = []
121
+ for options in ({'channel': 'chrome'}, {}):
122
+ try:
123
+ return playwright.chromium.launch(headless=True, args=['--disable-gpu', '--no-first-run'], **options)
124
+ except Exception as error: # Chrome may be missing; try the bundled build next.
125
+ errors.append(str(error).splitlines()[0])
126
+ fail('custom_component_renderer_missing', ' / '.join(errors))
127
+
128
+
129
+ PAGE = 'https://clipen.local/component.html'
130
+
131
+
132
+ def _route(route, html):
133
+ url = route.request.url
134
+ if url == PAGE:
135
+ return route.fulfill(status=200, body=html, headers={'content-type': 'text/html; charset=utf-8'})
136
+ if url.startswith(FONT_ORIGIN) and url[len(FONT_ORIGIN):] in FONTS:
137
+ path = Path(str(files('clipen.rendering').joinpath('fonts', url[len(FONT_ORIGIN):])))
138
+ return route.fulfill(status=200, body=path.read_bytes(), headers={'content-type': 'font/ttf', 'access-control-allow-origin': '*'})
139
+ return route.abort()
140
+
141
+
142
+ def render(job):
143
+ from playwright.sync_api import Error, TimeoutError, sync_playwright
144
+ out = Path(job['out'])
145
+ width, height, fps = int(job['width']), int(job['height']), float(job['fps'])
146
+ info = {'width': width, 'height': height, 'fps': fps, 'durationFrames': int(job['duration'])}
147
+ with sync_playwright() as playwright:
148
+ browser = _browser(playwright)
149
+ try:
150
+ # A fresh context is a fresh, throw-away profile: nothing of the user's Chrome is visible.
151
+ context = browser.new_context(viewport={'width': width, 'height': height}, device_scale_factor=1,
152
+ java_script_enabled=True, offline=False, service_workers='block')
153
+ context.route('**/*', lambda route: _route(route, job['html']))
154
+ page = context.new_page()
155
+ page.set_default_timeout(float(job.get('frame_timeout', 10)) * 1000)
156
+ problems = []
157
+ page.on('pageerror', lambda error: problems.append(str(error)))
158
+ page.add_init_script(_PRELUDE.replace('__INFO__', json.dumps(info)).replace('__EDITS__', json.dumps(job.get('edits') or {}, ensure_ascii=False))
159
+ .replace('__LOOK__', json.dumps(job.get('look') or '', ensure_ascii=False)))
160
+ try:
161
+ page.goto(PAGE, wait_until='load')
162
+ page.evaluate('document.fonts.ready.then(() => true)')
163
+ # A picture the sealed page could not fetch is hidden instead of drawn as a broken icon.
164
+ page.evaluate("document.querySelectorAll('img').forEach((i) => { if (!i.complete || !i.naturalWidth) i.style.visibility = 'hidden' })")
165
+ except TimeoutError:
166
+ fail('custom_component_load_timeout')
167
+ except Error as error:
168
+ fail('custom_component_load_failed', str(error))
169
+ if job.get('describe'):
170
+ (out / 'fields.json').write_text(json.dumps(page.evaluate(_FIELDS), ensure_ascii=False), encoding='utf-8')
171
+ for frame in job['frames']:
172
+ try:
173
+ page.evaluate(_SEEK, [int(frame), fps])
174
+ if problems:
175
+ fail('custom_component_script_error', problems[0])
176
+ data = page.screenshot(omit_background=True, type='png', animations='allow')
177
+ except TimeoutError:
178
+ fail('custom_component_frame_timeout', f'frame {frame}')
179
+ except Error as error:
180
+ fail('custom_component_script_error', problems[0] if problems else str(error))
181
+ target = out / f'f{int(frame):05d}.png'
182
+ temporary = target.with_suffix('.part')
183
+ temporary.write_bytes(data)
184
+ os.replace(temporary, target)
185
+ finally:
186
+ browser.close()
187
+
188
+
189
+ if __name__ == '__main__':
190
+ try:
191
+ render(json.load(sys.stdin))
192
+ except SystemExit:
193
+ raise
194
+ except ImportError as error:
195
+ fail('custom_component_renderer_missing', str(error))
196
+ except Exception as error:
197
+ fail('custom_component_render_failed', f'{type(error).__name__}: {error}')
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Anton Project Authors (https://github.com/googlefonts/AntonFont.git)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright © 2010 by Dharma Type.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.