wani 0.1.16 → 0.1.18

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: 2211ec774d104372f053f45eff713ce11bb25559a6c5f5770cb8aee772f7fea8
4
- data.tar.gz: eebe25656e75d3d5679855ba5d3318105a27f511c64fd6d6829a583b8d3b4012
3
+ metadata.gz: 807e65f03f5fedd91956e2c1215d2b22ac5fd31c54315ad0a07c9ead33bf867d
4
+ data.tar.gz: f554099951da00bb88beec2f487064e4bec38d29432022e71b38787098f11416
5
5
  SHA512:
6
- metadata.gz: 6a778f887a3eac4882ba9648eeeb64d4aa50efd3dd8582de2070a9fac2c2829af85a10ff0a97c17e5da0601a6474017c978d77a3807be0b4a39830abb6b059bf
7
- data.tar.gz: 2c67e0eedf595709727b180406e7de518a9a0fd36d0c19b72339ad513e1fc7380ff3e4361a954b765bc0b4ff1f8383d8f88a911c1e540a8d84e6940422f7ed66
6
+ metadata.gz: b72fece3fc00b4f5c4d20eab3e893fa83dd17f68996fba4707250990135c62fda11589048aba17c4c3b37a5d96ab5199da5a45da012c0ae1e72ac0aa109c4f02
7
+ data.tar.gz: b0bf7044acf98f19cb604c2c9cda5c1bc8be81439fdd9234b839a5e32fe1e30b597ba89e09afc7de624fa66fb1da3874da0a8db0bd0d15d908529974154f9a1c
data/README.md CHANGED
@@ -78,7 +78,7 @@ notes:
78
78
 
79
79
  ## フォント文字サイズを自動調整
80
80
 
81
- - タイトルは1行に収める
81
+ - タイトルは1行に収める。表紙では `<br>` で改行できる
82
82
  - 本文は全角20文字当の幅を超える場合は自然に折り返し
83
83
  - 明示的な改行は維持
84
84
  - 文字サイズは本文全体で共通
@@ -192,11 +192,11 @@ Ctrl+P でも印刷できます。
192
192
 
193
193
  ## 同梱フォント
194
194
 
195
- 日本語・英数字の標準書体は **IBM Plex Sans JP** です。
195
+ 日本語・英数字の標準書体は **Zen Kaku Gothic New** です。
196
196
  コードは **UDEV Gothic** を使い、日本語も半角1:全角2の等幅で表示します。
197
197
 
198
- フォントは SIL Open Font License 1.1 です。原文のライセンス・著作権表示と配布元・チェックサムは
199
- [third_party/ibm-plex-sans-jp](third_party/ibm-plex-sans-jp/README.md) と
198
+ フォントは SIL Open Font License 1.1 です。原文のライセンス・著作権表示と UDEV Gothic の配布元・チェックサムは
199
+ [Zen Kaku Gothic New のライセンス](assets/fonts/ZenKakuGothicNew-OFL.txt) と
200
200
  [third_party/udev-gothic](third_party/udev-gothic/README.md) に保持しています。
201
201
 
202
202
  ## フォントを変更する
data/assets/build.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.1.16",
3
- "source_sha256": "32912ebee7503573d054f7cde1150bf882b5211532079d3d348cea72c6af2556",
2
+ "version": "0.1.18",
3
+ "source_sha256": "17bfdfb57284ffc77bc65d760e866c13faef310110789e5447f01d4d95e5d453",
4
4
  "loader_commit": "dc6b0ffd5800ed9bfc49268ed8021d456f10ddf8",
5
- "wasm_sha256": "10b7d39455116b9a76ab0e89754068eb54bc9078cda5fb57891e6cd5b190c0b3"
5
+ "wasm_sha256": "9f1f6f718d0b1054ca4d38867dfc31a64b68e5a90bea1243855079442eab9392"
6
6
  }
@@ -1,93 +1,93 @@
1
- Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
-
5
- This license is copied below, and is also available with a FAQ at: 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.
1
+ Copyright 2022 The Zen Kaku Gothic Project Authors (https://github.com/googlefonts/zen-kakugothic)
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.
data/assets/style.css CHANGED
@@ -1,32 +1,32 @@
1
1
  @font-face {
2
- font-family: "IBM Plex Sans JP";
3
- src: url("/assets/fonts/IBMPlexSansJP-Regular.woff2") format("woff2");
2
+ font-family: "UDEV Gothic";
3
+ src: url("/assets/fonts/UDEVGothic-Regular.ttf") format("truetype");
4
4
  font-weight: 400;
5
5
  font-style: normal;
6
6
  font-display: block;
7
7
  }
8
8
  @font-face {
9
- font-family: "IBM Plex Sans JP";
10
- src: url("/assets/fonts/IBMPlexSansJP-Bold.woff2") format("woff2");
9
+ font-family: "UDEV Gothic";
10
+ src: url("/assets/fonts/UDEVGothic-Bold.ttf") format("truetype");
11
11
  font-weight: 700;
12
12
  font-style: normal;
13
13
  font-display: block;
14
14
  }
15
15
  @font-face {
16
- font-family: "UDEV Gothic";
17
- src: url("/assets/fonts/UDEVGothic-Regular.ttf") format("truetype");
16
+ font-family: "Zen Kaku Gothic New";
17
+ src: url("/assets/fonts/ZenKakuGothicNew-Regular.ttf") format("truetype");
18
18
  font-weight: 400;
19
19
  font-style: normal;
20
20
  font-display: block;
21
21
  }
22
22
  @font-face {
23
- font-family: "UDEV Gothic";
24
- src: url("/assets/fonts/UDEVGothic-Bold.ttf") format("truetype");
23
+ font-family: "Zen Kaku Gothic New";
24
+ src: url("/assets/fonts/ZenKakuGothicNew-Bold.ttf") format("truetype");
25
25
  font-weight: 700;
26
26
  font-style: normal;
27
27
  font-display: block;
28
28
  }
29
- :root { font-family: "IBM Plex Sans JP", sans-serif; color: #20352e; background: #e9eee9; }
29
+ :root { font-family: "Zen Kaku Gothic New", sans-serif; color: #20352e; background: #e9eee9; }
30
30
  * { box-sizing: border-box; }
31
31
  body { margin: 0; }
32
32
  .presentation-view { height: 100dvh; display: flex; flex-direction: column; }
@@ -45,8 +45,8 @@ button:focus-visible, a:focus-visible { outline: 2px solid #557e64; outline-offs
45
45
  #viewport { width: 100%; flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 20px; }
46
46
  #stage { flex: 0 0 1920px; transform-origin: center; box-shadow: 0 8px 48px #20352e18; }
47
47
  .slide { position: relative; width: 1920px; height: 1080px; padding: 64px 80px 48px; display: flex; flex-direction: column; overflow: hidden; background: white; color: #172b24; }
48
- .title { margin: 0 0 36px; white-space: nowrap; flex: 0 0 160px; font-weight: 700; line-height: 1.12; overflow: hidden; letter-spacing: -.025em; }
49
- .body { flex: 1 1 0; min-height: 0; overflow: hidden; line-height: 1.3; }
48
+ .title { margin: 0 0 36px; white-space: nowrap; flex: 0 0 160px; font-family: "Zen Kaku Gothic New", sans-serif; color: #353535; font-weight: 700; line-height: 1.12; overflow: hidden; letter-spacing: -.025em; }
49
+ .body { flex: 1 1 0; min-height: 0; overflow: hidden; line-height: 1.3; font-family: "Zen Kaku Gothic New", sans-serif; color: #353535; }
50
50
  .body p { margin: 0 0 .35em; }
51
51
  .body p, .body li { word-break: auto-phrase; text-wrap: pretty; }
52
52
  .titleless .body { display: flex; flex-direction: column; justify-content: safe center; text-align: center; }
@@ -54,13 +54,15 @@ button:focus-visible, a:focus-visible { outline: 2px solid #557e64; outline-offs
54
54
  .titleless .body > :last-child { margin-bottom: 0; }
55
55
  .titleless .body img { margin-inline: auto; }
56
56
  .cover .title { margin-top: 396px; text-align: center; }
57
+ .cover.multiline-title .title { margin-top: 316px; flex-basis: 320px; display: flex; align-items: center; justify-content: center; white-space: pre; }
57
58
  .cover .body { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; text-align: right; }
59
+ .cover.multiline-title .body { margin-top: -160px; }
58
60
  .cover .body > * { flex-shrink: 0; max-width: 100%; }
59
61
  .cover .body > :last-child { margin-bottom: 0; }
60
62
  .body ul, .body ol { margin: .2em 0 .4em; padding-left: 1.35em; }
61
63
  .body pre { margin: .3em 0; padding: .4em .55em; background: #f3f6f2; white-space: pre-wrap; tab-size: 2; }
62
64
  .titleless .body pre { width: fit-content; max-width: 100%; margin-inline: auto; text-align: left; }
63
- .body code { font-family: "UDEV Gothic", "IBM Plex Sans JP", monospace; font-size: .8em; }
65
+ .body code { font-family: "UDEV Gothic", "Zen Kaku Gothic New", monospace; font-size: .8em; }
64
66
  .body blockquote { border-left: .08em solid #b6cbb9; margin: .4em 0; padding-left: .6em; }
65
67
  .body table { border-collapse: collapse; width: 100%; }
66
68
  .body th, .body td { border: 1px solid #bac8bd; padding: .15em .3em; }
data/assets/wani.wasm CHANGED
Binary file
@@ -49,7 +49,7 @@ module Wani
49
49
  end
50
50
  @document[:fonts][:ready].await
51
51
  style = @document.createElement("style")
52
- style[:textContent] = %(.slide .title, .slide .body { font-family: #{family}, "IBM Plex Sans JP", sans-serif; })
52
+ style[:textContent] = %(.slide .title, .slide .body { font-family: #{family}, "Zen Kaku Gothic New", sans-serif; })
53
53
  @document[:head].appendChild(style)
54
54
  rescue => error
55
55
  link.remove if link
@@ -9,6 +9,7 @@ module Wani
9
9
  TITLE_MIN = 24
10
10
  TITLE_MAX = 220
11
11
  NO_WRAP_EMS = 20
12
+ TITLE_GAP_MAX = 64
12
13
 
13
14
  def initialize(document, &warn)
14
15
  @document, @warn = document, warn
@@ -54,17 +55,20 @@ module Wani
54
55
  def fit_slide(section, number)
55
56
  section[:style][:display] = "flex"
56
57
  title = section.querySelector(".title")
58
+ title[:style][:transform] = ""
57
59
  unless title[:style][:display].to_s == "none"
58
60
  fit_font(title, TITLE_MIN, TITLE_MAX)
59
61
  @warn.call("スライド #{number}: タイトルが収まりません: #{title[:textContent]}") unless fits?(title)
60
62
  end
61
63
  body = section.querySelector(".body")
64
+ body[:style][:marginTop] = ""
62
65
  prepare_wrapping(body)
63
66
  fit_images(body)
64
67
  if section[:classList].contains("cover") == JS::True
65
68
  body[:style][:fontSize] = "#{COVER_BODY_SIZE}px"
66
69
  else
67
70
  fit_font(body, BODY_MIN, BODY_MAX)
71
+ add_title_gap(section, title, body)
68
72
  end
69
73
  body_fits = if section[:classList].contains("cover") == JS::True
70
74
  cover_body_fits?(body)
@@ -72,6 +76,15 @@ module Wani
72
76
  fits?(body)
73
77
  end
74
78
  @warn.call("スライド #{number}: 本文が収まりません: #{body[:textContent].to_s[0, 120]}") unless body_fits
79
+ if section[:classList].contains("multiline-title") == JS::True
80
+ title_rect = title.getBoundingClientRect
81
+ body_top = body[:children].to_a.map { |child| child.getBoundingClientRect[:top].to_f }.min
82
+ if body_top
83
+ scale = section.getBoundingClientRect[:width].to_f / WIDTH
84
+ shift = (title_rect[:bottom].to_f + 36 * scale - body_top) / scale
85
+ title[:style][:transform] = "translateY(-#{shift}px)" if shift.positive?
86
+ end
87
+ end
75
88
  if section[:classList].contains("cover") == JS::True && title[:style][:display].to_s != "none"
76
89
  title_rect = title.getBoundingClientRect
77
90
  overlap = body[:children].to_a.any? do |child|
@@ -99,6 +112,17 @@ module Wani
99
112
 
100
113
  private
101
114
 
115
+ def add_title_gap(section, title, body)
116
+ return if title[:style][:display].to_s == "none" || body[:children].to_a.empty? || !fits?(body)
117
+ scale = section.getBoundingClientRect[:width].to_f / WIDTH
118
+ return if scale <= 0
119
+ bottom = body[:children].to_a.map { |child| child.getBoundingClientRect[:bottom].to_f }.max
120
+ spare = (body.getBoundingClientRect[:bottom].to_f - bottom) / scale
121
+ gap = [[spare * 0.2, TITLE_GAP_MAX].min, 0].max
122
+ body[:style][:marginTop] = "#{gap}px"
123
+ body[:style][:marginTop] = "" unless fits?(body)
124
+ end
125
+
102
126
  def prepare_wrapping(body)
103
127
  # Rebuild the wrappers when a slide is fitted again (for example after
104
128
  # editing). Ranges preserve links, emphasis and explicit line breaks.
@@ -18,6 +18,7 @@ module Wani
18
18
  section[:className] = "slide titleless"
19
19
  end
20
20
  section[:classList].add("cover") if slide.number == 1 && !notes
21
+ section[:classList].add("multiline-title") if slide.number == 1 && !notes && slide.title.include?("\n")
21
22
  body = child(section, "div", "body")
22
23
  body[:innerHTML] = notes ? slide.notes_html : slide.html
23
24
  resolve_links(body)
@@ -34,7 +34,7 @@ module Wani
34
34
  remove(document.root, title) if title
35
35
  renderer = SafeHTML.new(&warn)
36
36
  note_roots = notes.map { |text| markdown(text).root }
37
- Slide.new(number: number, title: title ? plain(title) : "", html: renderer.render(document.root),
37
+ Slide.new(number: number, title: title ? plain(title, cover: number == 1) : "", html: renderer.render(document.root),
38
38
  page_footnote: page_footnotes.empty? ? "" : page_footnotes.last.strip,
39
39
  notes_html: note_roots.map { |root| renderer.render(root) }.join,
40
40
  images: ([document.root] + note_roots).flat_map { |root| walk(root).select { |node| node.type == :img && SafeHTML.safe_url?(node.attr['src'], image: true) }.map { |node| node.attr['src'] } }.uniq)
@@ -114,12 +114,13 @@ module Wani
114
114
  node.children.each { |child| remove(child, target) }
115
115
  end
116
116
 
117
- def plain(node)
117
+ def plain(node, cover: false)
118
118
  case node.type
119
119
  when :text, :codespan then node.value
120
120
  when :entity then node.value.char
121
121
  when :smart_quote then SafeHTML::QUOTES.fetch(node.value, "")
122
- else node.children.map { |child| plain(child) }.join
122
+ when :html_element then cover && node.value == "br" && node.attr.empty? ? "\n" : node.children.map { |child| plain(child, cover: cover) }.join
123
+ else node.children.map { |child| plain(child, cover: cover) }.join
123
124
  end
124
125
  end
125
126
  end
@@ -8,7 +8,7 @@ module Wani
8
8
  # Only the selected Markdown, images below its directory and fixed gem assets are public.
9
9
  class Application
10
10
  ASSETS = %w[index.html style.css highlight.css rouge.LICENSE bootstrap.rb speaker.html rabbit.svg shark.svg time-expired-1.webp time-expired-2.webp time-expired-3.webp time-expired-4.webp runtime.pr672.js wani.wasm runtime.LICENSE runtime.NOTICE build.json
11
- fonts/IBMPlexSansJP-Regular.woff2 fonts/IBMPlexSansJP-Bold.woff2
11
+ fonts/ZenKakuGothicNew-Regular.ttf fonts/ZenKakuGothicNew-Bold.ttf
12
12
  fonts/UDEVGothic-Regular.ttf fonts/UDEVGothic-Bold.ttf].freeze
13
13
  TYPES = { ".html" => "text/html; charset=utf-8", ".css" => "text/css; charset=utf-8", ".rb" => "text/plain; charset=utf-8", ".js" => "text/javascript", ".wasm" => "application/wasm", ".md" => "text/plain; charset=utf-8", ".svg" => "image/svg+xml", ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".webp" => "image/webp", ".json" => "application/json", ".woff2" => "font/woff2", ".ttf" => "font/ttf" }.freeze
14
14
  IMAGES = %w[.png .jpg .jpeg .webp .svg].freeze
data/lib/wani/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wani
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wani
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - ledsun
@@ -88,10 +88,11 @@ files:
88
88
  - README.md
89
89
  - assets/bootstrap.rb
90
90
  - assets/build.json
91
- - assets/fonts/IBMPlexSansJP-Bold.woff2
92
- - assets/fonts/IBMPlexSansJP-Regular.woff2
93
91
  - assets/fonts/UDEVGothic-Bold.ttf
94
92
  - assets/fonts/UDEVGothic-Regular.ttf
93
+ - assets/fonts/ZenKakuGothicNew-Bold.ttf
94
+ - assets/fonts/ZenKakuGothicNew-OFL.txt
95
+ - assets/fonts/ZenKakuGothicNew-Regular.ttf
95
96
  - assets/highlight.css
96
97
  - assets/index.html
97
98
  - assets/rabbit.svg
@@ -131,9 +132,6 @@ files:
131
132
  - third_party/gems/kramdown-LICENSE
132
133
  - third_party/gems/kramdown-parser-gfm-LICENSE
133
134
  - third_party/gems/rexml-LICENSE
134
- - third_party/ibm-plex-sans-jp/LICENSE.txt
135
- - third_party/ibm-plex-sans-jp/README.md
136
- - third_party/ibm-plex-sans-jp/provenance.json
137
135
  - third_party/ruby-wasm-loader/LICENSE
138
136
  - third_party/ruby-wasm-loader/NOTICE
139
137
  - third_party/ruby-wasm-loader/README.md
Binary file
@@ -1,39 +0,0 @@
1
- # IBM Plex Sans JP
2
-
3
- IBM の公式 npm パッケージ [`@ibm/plex-sans-jp@3.0.0`](https://www.npmjs.com/package/@ibm/plex-sans-jp/v/3.0.0)
4
- から、以下の完成版 WOFF2 を変更せずに同梱する。
5
-
6
- - `assets/fonts/IBMPlexSansJP-Regular.woff2`(400 / 2,282,284 bytes)
7
- - `assets/fonts/IBMPlexSansJP-Bold.woff2`(700 / 2,352,756 bytes)
8
-
9
- 元ファイルは `fonts/complete/woff2/hinted/` にある。サブセット化・改名・フォントデータの加工はしていない。
10
- 出所・バージョン・配布アーカイブと各ファイルの SHA-256 は `provenance.json` に記録する。
11
-
12
- Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"。
13
- SIL Open Font License 1.1 により配布され、著作権表示とライセンス全文を `LICENSE.txt` に保持する。
14
- アプリの MIT ライセンスとは区別する。
15
-
16
- ## 取得の再現
17
-
18
- ```sh
19
- npm pack @ibm/plex-sans-jp@3.0.0 --pack-destination /tmp
20
- ```
21
-
22
- `provenance.json` のアーカイブ SHA-256 と照合して展開し、上記2ファイルとパッケージの `LICENSE.txt` を取り出す。
23
- Wani の通常利用・ビルド時にフォントのダウンロードや OS インストールは不要。
24
- 参照元: [IBM 公式リポジトリ](https://github.com/IBM/plex/tree/master/packages/plex-sans-jp)。
25
-
26
- ## PDF の文字抽出
27
-
28
- 検証した Chromium の PDF では、同じグリフに対応する文字が互換部首として抽出される場合がある
29
- (例: `日` → `⽇`)。表示の字形とフォント埋め込みは確認し、内容比較のテストでは NFKC 正規化する。
30
- PDF のテキストコピーが常に元のコードポイントと一致することまでは保証しない。
31
-
32
- ## 動作検証 (2026-10-26)
33
-
34
- Linux / Ruby 4.0.7 / Node.js 24.22.1 / Chrome 156.0.8078.47。
35
- Ruby は12件・85アサーション、ブラウザーは13件成功(35.8秒)。
36
- Chrome の実フォント情報で日本語の Regular / Bold と Web フォント使用を確認し、
37
- 日本語 PDF の文字内容・Regular / Bold と FontFile2 の埋め込みを検査した。
38
- 太字の取得先を壊すと実描画テストは失敗し、復元後はフォント検証3件が成功(9.2秒)。
39
- 隔離環境の gem インストールでも2フォントのハッシュ一致、ライセンス同梱、HTTP配信を確認した。
@@ -1,20 +0,0 @@
1
- {
2
- "package": "@ibm/plex-sans-jp",
3
- "version": "3.0.0",
4
- "repository": "https://github.com/IBM/plex/tree/master/packages/plex-sans-jp",
5
- "tarball": "https://registry.npmjs.org/@ibm/plex-sans-jp/-/plex-sans-jp-3.0.0.tgz",
6
- "tarball_sha256": "051484321fcffecc69c3d608b739c5fe0f558b0fd1de7958d96ca360d161de7f",
7
- "license": "OFL-1.1",
8
- "files": {
9
- "IBMPlexSansJP-Bold.woff2": {
10
- "sha256": "38336fbb169ae1b7b6ca2539332e1d59c9be222227659d23f8eb70ecda60337d",
11
- "bytes": 2352756,
12
- "source_path": "fonts/complete/woff2/hinted/IBMPlexSansJP-Bold.woff2"
13
- },
14
- "IBMPlexSansJP-Regular.woff2": {
15
- "sha256": "ec27e9b75cd90a6f7abe96ede49d00b151eb5b1c2c886bfe9b4fc845f40be1ff",
16
- "bytes": 2282284,
17
- "source_path": "fonts/complete/woff2/hinted/IBMPlexSansJP-Regular.woff2"
18
- }
19
- }
20
- }