asciidoctor-epub3 1.5.0.alpha.6 → 1.5.0.alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +134 -0
- data/Gemfile +10 -0
- data/README.adoc +248 -172
- data/asciidoctor-epub3.gemspec +42 -0
- data/bin/adb-push-ebook +19 -10
- data/data/styles/epub3-css3-only.css +28 -11
- data/data/styles/epub3.css +40 -39
- data/lib/asciidoctor-epub3/converter.rb +188 -121
- data/lib/asciidoctor-epub3/core_ext/string.rb +1 -1
- data/lib/asciidoctor-epub3/font_icon_map.rb +1 -1
- data/lib/asciidoctor-epub3/packager.rb +240 -104
- data/lib/asciidoctor-epub3/spine_item_processor.rb +22 -11
- data/lib/asciidoctor-epub3/version.rb +1 -1
- metadata +24 -35
- data/data/samples/asciidoctor-epub3-readme.adoc +0 -849
- data/data/samples/asciidoctor-js-browser-extension.adoc +0 -46
- data/data/samples/asciidoctor-js-introduction.adoc +0 -91
- data/data/samples/i18n.adoc +0 -161
- data/data/samples/images/asciidoctor-js-chrome-extension.png +0 -0
- data/data/samples/images/avatars/graphitefriction.jpg +0 -0
- data/data/samples/images/avatars/mogztter.jpg +0 -0
- data/data/samples/images/avatars/mojavelinux.jpg +0 -0
- data/data/samples/images/correct-text-justification.png +0 -0
- data/data/samples/images/incorrect-text-justification.png +0 -0
- data/data/samples/images/screenshots/chapter-title-day.png +0 -0
- data/data/samples/images/screenshots/chapter-title.png +0 -0
- data/data/samples/images/screenshots/figure-admonition.png +0 -0
- data/data/samples/images/screenshots/section-title-paragraph.png +0 -0
- data/data/samples/images/screenshots/sidebar.png +0 -0
- data/data/samples/images/screenshots/table.png +0 -0
- data/data/samples/images/screenshots/text.png +0 -0
- data/data/samples/sample-book.adoc +0 -21
- data/data/samples/sample-content.adoc +0 -168
- data/scripts/generate-font-subsets.pe +0 -235
@@ -1,235 +0,0 @@
|
|
1
|
-
#!/usr/bin/env fontforge
|
2
|
-
|
3
|
-
# Run using:
|
4
|
-
#
|
5
|
-
# $ ./generate-font-subsets.pe <target directory>
|
6
|
-
#
|
7
|
-
# By default, the target directory is "generated".
|
8
|
-
#
|
9
|
-
# NOTE: Ignore "GID out of range" warnings; fontforge has to kick the tires a bit to flush out these dead references
|
10
|
-
#
|
11
|
-
# Use with Noto Serif fonts from https://code.google.com/p/noto/source/browse/#svn%2Ftrunk%2Ffonts%2Findividual%2Funhinted
|
12
|
-
# Use with M+ fonts from http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/download/index-en.html
|
13
|
-
#
|
14
|
-
# TODO: Add cjkv profile
|
15
|
-
#
|
16
|
-
# IMPORTANT: Must generate Apple format (0x10) or include old-fashioned 'kern' table for kerning to work in Prawn
|
17
|
-
#
|
18
|
-
# generate flags (additive):
|
19
|
-
# * 0x00 - OpenType
|
20
|
-
# * 0x10 - Apple
|
21
|
-
# * 0x80 - OpenType and Apple
|
22
|
-
# * 0x90 - Neither OpenType or Apple
|
23
|
-
# * 0x800 - Generate old-style 'kern' table
|
24
|
-
# * 0x08 - exclude TrueType instructions
|
25
|
-
#
|
26
|
-
# QUESTION: do we need to apply RoundToInt() after ClearInstrs()?
|
27
|
-
# FIXME: need to generate cjk font
|
28
|
-
|
29
|
-
genflags = 0x08
|
30
|
-
#genflags = 0x10 + 0x08
|
31
|
-
copy_fonts = ["NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-BoldItalic.ttf", "mplus-1p-regular.ttf", "mplus-1p-bold.ttf", "mplus-1p-light.ttf"]
|
32
|
-
#copy_fonts = ["NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-BoldItalic.ttf"]
|
33
|
-
#copy_fonts = ["LiberationMono-Regular.ttf", "LiberationMono-Bold.ttf", "LiberationMono-Italic.ttf", "LiberationMono-BoldItalic.ttf"]
|
34
|
-
#copy_fonts = ["NotoSerif-Regular.ttf"]
|
35
|
-
#copy_fonts = []
|
36
|
-
num_copy_fonts = SizeOf(copy_fonts)
|
37
|
-
copy_scripts = ["latin", "latin-ext", "latin-cyrillic", "multilingual"]
|
38
|
-
#copy_scripts = ["latin"]
|
39
|
-
num_copy_scripts = SizeOf(copy_scripts)
|
40
|
-
code_fonts = ["mplus-1mn-light.ttf", "mplus-1mn-regular.ttf", "mplus-1mn-medium.ttf", "mplus-1mn-bold.ttf"]
|
41
|
-
#code_fonts = []
|
42
|
-
num_code_fonts = SizeOf(code_fonts)
|
43
|
-
code_script = "ascii"
|
44
|
-
#code_script = "multilingual"
|
45
|
-
if ($argc == 2)
|
46
|
-
output_dir = $argv[1]
|
47
|
-
else
|
48
|
-
#output_dir = "../data/fonts"
|
49
|
-
output_dir = "generated"
|
50
|
-
endif
|
51
|
-
|
52
|
-
fi = 0
|
53
|
-
while (fi < num_copy_fonts)
|
54
|
-
new_basename = ToLower(copy_fonts[fi]:r)
|
55
|
-
is_mplus = Strstr(new_basename, "mplus") >= 0
|
56
|
-
# remove hyphen from mplus-1
|
57
|
-
if (is_mplus)
|
58
|
-
new_basename = "mplus1" + StrJoin(StrSplit(new_basename, "mplus-1"), "")
|
59
|
-
endif
|
60
|
-
si = 0
|
61
|
-
while (si < num_copy_scripts)
|
62
|
-
script = copy_scripts[si]
|
63
|
-
Open(copy_fonts[fi])
|
64
|
-
SelectAll()
|
65
|
-
# Remove TrueType instructions
|
66
|
-
ClearInstrs()
|
67
|
-
SelectNone()
|
68
|
-
# Basic Latin (e.g., English)
|
69
|
-
SelectMore(0u0020,0u007e)
|
70
|
-
# Latin-1 Supplement (covers core Western European languages)
|
71
|
-
SelectMore(0u00a0,0u00ff)
|
72
|
-
# Mathematical Operators (e.g., infinity, sum, partial differential)
|
73
|
-
SelectMore(0u2200,0u22ff)
|
74
|
-
# General Punctuation (most of it) (e.g., dashes, smart quotes, bullet)
|
75
|
-
SelectMore(0u2000,0u203a)
|
76
|
-
# Trademark sign (selected from Letterlike Symbols set)
|
77
|
-
SelectMore(0u2122)
|
78
|
-
# Geometric Shapes (e.g., list bullets)
|
79
|
-
SelectMore(0u25a0,0u25ff)
|
80
|
-
# Greek (frequently used for math and bullets)
|
81
|
-
SelectMore(0u0370,0u03ff)
|
82
|
-
# Additional Currency Symbols (QUESTION: do we need all of them in basic latin? Euro Sign is 0u20ac)
|
83
|
-
#SelectMore(0u20a0,0u20d0)
|
84
|
-
SelectMore(0u20ac)
|
85
|
-
if (script == "latin-ext" || script == "latin-cyrillic" || script == "multilingual")
|
86
|
-
# Latin Extended-A, Latin Extended-B
|
87
|
-
SelectMore(0u0100,0u024f)
|
88
|
-
# IPA Extensions (i.e., core phonetics)
|
89
|
-
#SelectMore(0u0250,0u02af)
|
90
|
-
# Upside-down e (from IPA Extensions)
|
91
|
-
SelectMore(0u0259)
|
92
|
-
# Spacing Modifier Letters (e.g., diacritics)
|
93
|
-
SelectMore(0u02b0,0u02ff)
|
94
|
-
# Latin Ligatures (e.g., fi) (Noto Serif doesn't auto-detect them, so leave them off)
|
95
|
-
#SelectMore(0ufb00,0ufb06)
|
96
|
-
endif
|
97
|
-
if (script == "latin-cyrillic" || script == "multilingual")
|
98
|
-
# Cyrillic
|
99
|
-
SelectMore(0u0400,0u04ff)
|
100
|
-
# Cyrillic Supplement (QUESTION should this go in multilingual only?)
|
101
|
-
SelectMore(0u0500,0u052f)
|
102
|
-
endif
|
103
|
-
if (script == "multilingual")
|
104
|
-
# Greek Extended
|
105
|
-
SelectMore(0u1f00,0u1fff)
|
106
|
-
# Latin Extended Additional (Vietnamese, Hindi, ...)
|
107
|
-
SelectMore(0u1e00,0u1eff)
|
108
|
-
endif
|
109
|
-
# BOM
|
110
|
-
SelectMore(0ufeff)
|
111
|
-
# No-break space
|
112
|
-
SelectMore(0u00a0)
|
113
|
-
# Non-marking return (QUESTION do we really need this?)
|
114
|
-
#SelectMore(0u000d)
|
115
|
-
SelectInvert()
|
116
|
-
Clear()
|
117
|
-
SelectNone()
|
118
|
-
# Generate BOM from no-break space (for M+ fonts)
|
119
|
-
if (is_mplus)
|
120
|
-
Select(0u00a0)
|
121
|
-
Copy()
|
122
|
-
SelectNone()
|
123
|
-
Select(0ufeff)
|
124
|
-
Paste()
|
125
|
-
SetWidth(0)
|
126
|
-
SelectNone()
|
127
|
-
endif
|
128
|
-
|
129
|
-
# Generate line feed from no-break space (works around error "cmap format 14 is not supported" in ttfunk)
|
130
|
-
# FIXME another option here is to select all the characters referenced by the cmap format 14 table
|
131
|
-
Select(0u00a0)
|
132
|
-
Copy()
|
133
|
-
SelectNone()
|
134
|
-
Select(0u000a)
|
135
|
-
Paste()
|
136
|
-
SetWidth(0)
|
137
|
-
SelectNone()
|
138
|
-
|
139
|
-
new_filename = new_basename + "-" + script + ".ttf"
|
140
|
-
new_filepath = output_dir + "/" + new_filename
|
141
|
-
Print("Generating " + new_filename + "...")
|
142
|
-
Generate(new_filepath, "", genflags)
|
143
|
-
Close()
|
144
|
-
if (is_mplus)
|
145
|
-
# Regenerate to drop invalid cmap format 14 table (ignore warnings)
|
146
|
-
Open(new_filepath)
|
147
|
-
Generate(new_filepath, "", genflags)
|
148
|
-
Close()
|
149
|
-
endif
|
150
|
-
si = si + 1
|
151
|
-
endloop
|
152
|
-
fi = fi + 1
|
153
|
-
endloop
|
154
|
-
|
155
|
-
fi = 0
|
156
|
-
while (fi < num_code_fonts)
|
157
|
-
new_basename = code_fonts[fi]:r
|
158
|
-
# remove hyphen from mplus-1
|
159
|
-
new_basename = "mplus1" + StrJoin(StrSplit(new_basename, "mplus-1"), "")
|
160
|
-
new_suffix = "-" + code_script + ".ttf"
|
161
|
-
Open(code_fonts[fi])
|
162
|
-
SelectAll()
|
163
|
-
# NOTE: M+ fonts don't have hinting, so technically this is redundant
|
164
|
-
ClearInstrs()
|
165
|
-
SelectNone()
|
166
|
-
if (code_script == "ascii")
|
167
|
-
# Basic Latin (e.g., Code)
|
168
|
-
SelectMore(0u0020,0u007e)
|
169
|
-
# No-break space
|
170
|
-
SelectMore(0u00a0)
|
171
|
-
# Box drawing symbols for unix `tree` output
|
172
|
-
SelectMore(0u2500,0u257f)
|
173
|
-
if (new_basename == "mplus1mn-regular")
|
174
|
-
# Enclosed numbers (1-20)
|
175
|
-
SelectMore(0u2460,0u2473)
|
176
|
-
new_suffix = "-ascii-conums.ttf"
|
177
|
-
endif
|
178
|
-
SelectInvert()
|
179
|
-
Clear()
|
180
|
-
SelectNone()
|
181
|
-
endif
|
182
|
-
SetFontNames(new_basename, "M+ 1mn")
|
183
|
-
# repurpose light as italic
|
184
|
-
if (new_basename == "mplus1mn-light")
|
185
|
-
SetFontNames("mplus1mn-italic", "M+ 1mn", "M+ 1mn Italic")
|
186
|
-
SetOS2Value("Weight", 400)
|
187
|
-
SetPanose(2, 5)
|
188
|
-
SetTTFName(0x409, 2, "Italic")
|
189
|
-
SetTTFName(0x409, 16, "")
|
190
|
-
SetTTFName(0x409, 17, "")
|
191
|
-
SetTTFName(0x411, 16, "")
|
192
|
-
SetTTFName(0x411, 17, "")
|
193
|
-
new_basename = "mplus1mn-italic"
|
194
|
-
# repurpose medium as bold
|
195
|
-
elseif (new_basename == "mplus1mn-medium")
|
196
|
-
SetFontNames("mplus1mn-bold", "M+ 1mn", "M+ 1mn Bold")
|
197
|
-
SetOS2Value("Weight", 700)
|
198
|
-
SetPanose(2, 8)
|
199
|
-
SetTTFName(0x409, 2, "Bold")
|
200
|
-
SetTTFName(0x409, 16, "")
|
201
|
-
SetTTFName(0x409, 17, "")
|
202
|
-
SetTTFName(0x411, 16, "")
|
203
|
-
SetTTFName(0x411, 17, "")
|
204
|
-
new_basename = "mplus1mn-bold"
|
205
|
-
# repurpose bold as bold italic
|
206
|
-
elseif (new_basename == "mplus1mn-bold")
|
207
|
-
SetFontNames("mplus1mn-bolditalic", "M+ 1mn", "M+ 1mn Bold Italic")
|
208
|
-
SetOS2Value("Weight", 700)
|
209
|
-
SetPanose(2, 8)
|
210
|
-
SetTTFName(0x409, 2, "Bold Italic")
|
211
|
-
SetTTFName(0x409, 16, "")
|
212
|
-
SetTTFName(0x409, 17, "")
|
213
|
-
SetTTFName(0x411, 16, "")
|
214
|
-
SetTTFName(0x411, 17, "")
|
215
|
-
new_basename = "mplus1mn-bolditalic"
|
216
|
-
endif
|
217
|
-
# Generate BOM from no-break space (for M+ fonts)
|
218
|
-
Select(0u00a0)
|
219
|
-
Copy()
|
220
|
-
SelectNone()
|
221
|
-
Select(0ufeff)
|
222
|
-
Paste()
|
223
|
-
SetWidth(0)
|
224
|
-
SelectNone()
|
225
|
-
new_filename = new_basename + new_suffix
|
226
|
-
new_filepath = output_dir + "/" + new_filename
|
227
|
-
Print("Generating " + new_filename + "...")
|
228
|
-
Generate(new_filepath, "", genflags)
|
229
|
-
Close()
|
230
|
-
# Regenerate to drop invalid cmap format 14 table (ignore warnings)
|
231
|
-
Open(new_filepath)
|
232
|
-
Generate(new_filepath, "", genflags)
|
233
|
-
Close()
|
234
|
-
fi = fi + 1
|
235
|
-
endloop
|