review 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +90 -66
- data/.travis.yml +1 -1
- data/Gemfile +0 -1
- data/NEWS.ja.md +82 -0
- data/NEWS.md +83 -0
- data/README.md +5 -3
- data/Rakefile +8 -8
- data/bin/review +1 -5
- data/bin/review-catalog-converter +22 -27
- data/bin/review-check +36 -43
- data/bin/review-checkdep +10 -15
- data/bin/review-compile +37 -55
- data/bin/review-epubmaker +4 -5
- data/bin/review-index +21 -29
- data/bin/review-init +26 -37
- data/bin/review-pdfmaker +0 -2
- data/bin/review-preproc +25 -45
- data/bin/review-validate +19 -18
- data/bin/review-vol +15 -27
- data/doc/config.yml.sample +5 -2
- data/doc/format.ja.md +20 -1
- data/doc/format.md +21 -5
- data/doc/images/review-generate.png +0 -0
- data/lib/epubmaker.rb +1 -3
- data/lib/epubmaker/content.rb +24 -27
- data/lib/epubmaker/epubcommon.rb +135 -148
- data/lib/epubmaker/epubv2.rb +39 -46
- data/lib/epubmaker/epubv3.rb +93 -103
- data/lib/epubmaker/producer.rb +138 -151
- data/lib/epubmaker/zip_exporter.rb +21 -26
- data/lib/review/book.rb +3 -6
- data/lib/review/book/base.rb +78 -103
- data/lib/review/book/chapter.rb +36 -40
- data/lib/review/book/compilable.rb +28 -31
- data/lib/review/book/image_finder.rb +6 -13
- data/lib/review/book/index.rb +100 -121
- data/lib/review/book/page_metric.rb +2 -7
- data/lib/review/book/part.rb +18 -20
- data/lib/review/book/volume.rb +9 -13
- data/lib/review/builder.rb +81 -116
- data/lib/review/catalog.rb +15 -19
- data/lib/review/compiler.rb +64 -83
- data/lib/review/configure.rb +87 -97
- data/lib/review/converter.rb +2 -7
- data/lib/review/epubbuilder.rb +1 -3
- data/lib/review/epubmaker.rb +213 -205
- data/lib/review/exception.rb +2 -4
- data/lib/review/extentions.rb +0 -1
- data/lib/review/extentions/hash.rb +2 -2
- data/lib/review/extentions/string.rb +5 -30
- data/lib/review/htmlbuilder.rb +320 -375
- data/lib/review/htmltoc.rb +4 -7
- data/lib/review/htmlutils.rb +29 -32
- data/lib/review/i18n.rb +33 -44
- data/lib/review/i18n.yml +3 -3
- data/lib/review/idgxmlbuilder.rb +309 -345
- data/lib/review/latexbuilder.rb +175 -212
- data/lib/review/latexindex.rb +2 -8
- data/lib/review/latexutils.rb +33 -43
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +21 -0
- data/lib/review/makerhelper.rb +1 -4
- data/lib/review/markdownbuilder.rb +44 -53
- data/lib/review/md2inaobuilder.rb +6 -12
- data/lib/review/pdfmaker.rb +143 -173
- data/lib/review/preprocessor.rb +64 -101
- data/lib/review/rstbuilder.rb +126 -158
- data/lib/review/sec_counter.rb +18 -34
- data/lib/review/template.rb +4 -5
- data/lib/review/textbuilder.rb +2 -3
- data/lib/review/textutils.rb +7 -13
- data/lib/review/tocparser.rb +31 -56
- data/lib/review/tocprinter.rb +26 -52
- data/lib/review/topbuilder.rb +219 -247
- data/lib/review/unfold.rb +15 -24
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +75 -99
- data/lib/review/webtocprinter.rb +15 -20
- data/lib/review/yamlloader.rb +13 -15
- data/review.gemspec +20 -22
- data/templates/latex/layout.tex.erb +2 -2
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/web/html/layout-html5.html.erb +2 -2
- data/test/assets/black.eps +280 -0
- data/test/assets/fit.png +0 -0
- data/test/assets/large.gif +0 -0
- data/test/assets/large.jpg +0 -0
- data/test/assets/large.png +0 -0
- data/test/assets/large.svg +65 -0
- data/test/assets/test_template.tex +1 -1
- data/test/book_test_helper.rb +2 -2
- data/test/run_test.rb +4 -4
- data/test/sample-book/src/Rakefile +21 -22
- data/test/syntax-book/Gemfile +4 -0
- data/test/syntax-book/Rakefile +72 -0
- data/test/syntax-book/appA.re +22 -0
- data/test/syntax-book/bib.re +6 -0
- data/test/syntax-book/catalog.yml +15 -0
- data/test/syntax-book/ch01.re +136 -0
- data/test/syntax-book/ch02.re +351 -0
- data/test/syntax-book/ch03.re +82 -0
- data/test/syntax-book/config.yml +35 -0
- data/test/syntax-book/images/ball.png +0 -0
- data/test/syntax-book/images/cover.jpg +0 -0
- data/test/syntax-book/images/fractal.png +0 -0
- data/test/syntax-book/images/img3-1.png +0 -0
- data/test/syntax-book/images/inlineicon.jpg +0 -0
- data/test/syntax-book/images/logic.png +0 -0
- data/test/syntax-book/images/logic2.png +0 -0
- data/test/syntax-book/images/puzzle.jpg +0 -0
- data/test/syntax-book/images/table.jpg +0 -0
- data/test/syntax-book/part2.re +6 -0
- data/test/syntax-book/pre01.re +26 -0
- data/test/syntax-book/review-ext.rb +14 -0
- data/test/syntax-book/sty/jumoline.sty +310 -0
- data/test/syntax-book/sty/reviewmacro.sty +39 -0
- data/test/syntax-book/style.css +494 -0
- data/test/syntax-book/syntax.dic +2 -0
- data/test/test_book.rb +106 -111
- data/test/test_book_chapter.rb +21 -22
- data/test/test_book_part.rb +3 -5
- data/test/test_builder.rb +11 -22
- data/test/test_catalog.rb +17 -18
- data/test/test_catalog_converter_cmd.rb +5 -5
- data/test/test_compiler.rb +18 -16
- data/test/test_configure.rb +35 -38
- data/test/test_converter.rb +3 -4
- data/test/test_epub3maker.rb +136 -117
- data/test/test_epubmaker.rb +107 -114
- data/test/test_epubmaker_cmd.rb +2 -4
- data/test/test_extentions_hash.rb +32 -33
- data/test/test_helper.rb +9 -11
- data/test/test_htmlbuilder.rb +454 -420
- data/test/test_htmltoc.rb +8 -12
- data/test/test_htmlutils.rb +0 -2
- data/test/test_i18n.rb +159 -150
- data/test/test_idgxmlbuilder.rb +190 -197
- data/test/test_image_finder.rb +21 -22
- data/test/test_index.rb +24 -29
- data/test/test_latexbuilder.rb +274 -264
- data/test/test_lineinput.rb +7 -10
- data/test/test_location.rb +7 -7
- data/test/test_makerhelper.rb +13 -25
- data/test/test_markdownbuilder.rb +23 -26
- data/test/test_md2inaobuilder.rb +8 -11
- data/test/test_pdfmaker.rb +114 -123
- data/test/test_pdfmaker_cmd.rb +1 -3
- data/test/test_review_ext.rb +3 -5
- data/test/test_rstbuilder.rb +92 -97
- data/test/test_template.rb +3 -7
- data/test/test_textutils.rb +27 -27
- data/test/test_tocparser.rb +2 -2
- data/test/test_topbuilder.rb +98 -103
- data/test/test_webtocprinter.rb +5 -6
- data/test/test_yamlloader.rb +42 -42
- data/test/test_zip_exporter.rb +12 -18
- metadata +86 -9
- data/lib/review/ewbbuilder.rb +0 -382
data/lib/review/yamlloader.rb
CHANGED
@@ -17,30 +17,28 @@ module ReVIEW
|
|
17
17
|
|
18
18
|
loop do
|
19
19
|
# Check exit condition
|
20
|
-
if file_queue.empty?
|
21
|
-
return yaml
|
22
|
-
end
|
20
|
+
return yaml if file_queue.empty?
|
23
21
|
|
24
22
|
current_file = file_queue.shift
|
25
23
|
current_yaml = YAML.load_file(current_file)
|
26
24
|
yaml = current_yaml.deep_merge(yaml)
|
27
25
|
|
28
|
-
|
29
|
-
buf = []
|
30
|
-
yaml['inherit'].reverse_each do |item|
|
31
|
-
inherit_file = File.expand_path(item, File.dirname(yamlfile))
|
26
|
+
next unless yaml.key?('inherit')
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
28
|
+
buf = []
|
29
|
+
yaml['inherit'].reverse_each do |item|
|
30
|
+
inherit_file = File.expand_path(item, File.dirname(yamlfile))
|
37
31
|
|
38
|
-
|
39
|
-
|
32
|
+
# Check loop
|
33
|
+
if loaded_files[inherit_file]
|
34
|
+
raise "Found circular YAML inheritance '#{inherit_file}' in #{yamlfile}."
|
40
35
|
end
|
41
|
-
|
42
|
-
|
36
|
+
|
37
|
+
loaded_files[inherit_file] = true
|
38
|
+
buf << inherit_file
|
43
39
|
end
|
40
|
+
yaml.delete('inherit')
|
41
|
+
file_queue = buf + file_queue
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
data/review.gemspec
CHANGED
@@ -1,33 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$:.push File.expand_path("../lib", __FILE__)
|
4
|
-
require "review/version"
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'review/version'
|
5
3
|
|
6
4
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
5
|
+
gem.name = 'review'
|
8
6
|
gem.version = ReVIEW::VERSION
|
9
7
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.license =
|
11
|
-
gem.authors = [
|
12
|
-
gem.email =
|
13
|
-
gem.homepage =
|
14
|
-
gem.summary =
|
15
|
-
gem.description =
|
16
|
-
gem.required_rubygems_version = Gem::Requirement.new(
|
17
|
-
gem.date =
|
8
|
+
gem.license = 'LGPL'
|
9
|
+
gem.authors = %w[kmuto takahashim]
|
10
|
+
gem.email = 'kmuto@debian.org'
|
11
|
+
gem.homepage = 'http://github.com/kmuto/review'
|
12
|
+
gem.summary = 'Re:VIEW: a easy-to-use digital publishing system'
|
13
|
+
gem.description = 'Re:VIEW is a digital publishing system for books and ebooks. It supports InDesign, EPUB and LaTeX.'
|
14
|
+
gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to? :required_rubygems_version=
|
15
|
+
gem.date = '2017-06-29'
|
18
16
|
|
19
17
|
gem.files = `git ls-files`.split("\n")
|
20
18
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
22
20
|
gem.extra_rdoc_files = [
|
23
21
|
]
|
24
|
-
gem.require_paths = [
|
22
|
+
gem.require_paths = ['lib']
|
25
23
|
|
26
|
-
gem.add_dependency(
|
27
|
-
gem.add_dependency(
|
28
|
-
gem.
|
29
|
-
gem.add_development_dependency(
|
30
|
-
gem.add_development_dependency(
|
31
|
-
gem.add_development_dependency(
|
24
|
+
gem.add_dependency('image_size')
|
25
|
+
gem.add_dependency('rouge')
|
26
|
+
gem.add_dependency('rubyzip')
|
27
|
+
gem.add_development_dependency('pygments.rb')
|
28
|
+
gem.add_development_dependency('rake')
|
29
|
+
gem.add_development_dependency('rubocop')
|
30
|
+
gem.add_development_dependency('test-unit')
|
32
31
|
end
|
33
|
-
|
@@ -11,7 +11,7 @@
|
|
11
11
|
\usepackage{caption}
|
12
12
|
\usepackage{suffix}
|
13
13
|
\usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1
|
14
|
-
|
14
|
+
\usepackage{lmodern}
|
15
15
|
\usepackage[dvipdfmx]{graphicx}
|
16
16
|
\usepackage[dvipdfmx,table]{xcolor}%requires colortbl, array
|
17
17
|
\usepackage{framed}
|
@@ -312,7 +312,7 @@
|
|
312
312
|
<%= @input_files["PREDEF"] %>
|
313
313
|
|
314
314
|
<%- if @config["toc"] -%>
|
315
|
-
\setcounter{tocdepth}{<%= @config["toclevel"] %>}
|
315
|
+
\setcounter{tocdepth}{<%= @config["toclevel"] - 1 %>}
|
316
316
|
\tableofcontents
|
317
317
|
<%- end -%>
|
318
318
|
|
@@ -7,15 +7,15 @@
|
|
7
7
|
<%= @opf_manifest %>
|
8
8
|
<%= @opf_toc %>
|
9
9
|
<guide>
|
10
|
-
<reference type="cover" title="<%= @producer.res.v(
|
11
|
-
<% if @producer.
|
12
|
-
<reference type="title-page" title="<%= @producer.res.v(
|
10
|
+
<reference type="cover" title="<%= @producer.res.v('covertitle') %>" href="<%= @producer.config['cover'] %>"/>
|
11
|
+
<% if @producer.config['titlepage'].present? %>
|
12
|
+
<reference type="title-page" title="<%= @producer.res.v('titlepagetitle') %>" href="titlepage.<%= @producer.config['htmlext'] %>"/>
|
13
13
|
<% end %>
|
14
|
-
<% if @producer.
|
15
|
-
<reference type="toc" title="<%= @producer.res.v(
|
14
|
+
<% if @producer.config['mytoc'].present? %>
|
15
|
+
<reference type="toc" title="<%= @producer.res.v('toctitle') %>" href="<%= @producer.config['bookname'] %>-toc.<%= @producer.config['htmlext'] %>"/>
|
16
16
|
<% end %>
|
17
|
-
<% if @producer.
|
18
|
-
<reference type="colophon" title="<%= @producer.res.v(
|
17
|
+
<% if @producer.config['colophon'].present? %>
|
18
|
+
<reference type="colophon" title="<%= @producer.res.v('colophontitle') %>" href="colophon.<%= @producer.config['htmlext'] %>"/>
|
19
19
|
<% end %>
|
20
20
|
</guide>
|
21
21
|
</package>
|
@@ -1,18 +1,18 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId" xml:lang="<%= @producer.
|
2
|
+
<package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId" xml:lang="<%= @producer.config['language'] %>"<%= @package_attrs %>>
|
3
3
|
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
|
4
4
|
<%= @opf_metainfo %>
|
5
5
|
</metadata>
|
6
6
|
<%= @opf_manifest %>
|
7
7
|
<%= @opf_toc %>
|
8
8
|
<guide>
|
9
|
-
<reference type="cover" title="<%= @producer.res.v(
|
10
|
-
<% if @producer.
|
11
|
-
<reference type="title-page" title="<%= @producer.res.v(
|
9
|
+
<reference type="cover" title="<%= @producer.res.v('covertitle') %>" href="<%= @producer.config['cover'] %>"/>
|
10
|
+
<% if @producer.config["titlepage"].present? %>
|
11
|
+
<reference type="title-page" title="<%= @producer.res.v('titlepagetitle') %>" href="titlepage.<%= @producer.config['htmlext'] %>"/>
|
12
12
|
<% end %>
|
13
|
-
<reference type="toc" title="<%= @producer.res.v(
|
14
|
-
<% if @producer.
|
15
|
-
<reference type="colophon" title="<%= @producer.res.v(
|
13
|
+
<reference type="toc" title="<%= @producer.res.v('toctitle') %>" href="<%= @producer.config['bookname'] %>-toc.<%= @producer.config['htmlext'] %>"/>
|
14
|
+
<% if @producer.config['colophon'].present? %>
|
15
|
+
<reference type="colophon" title="<%= @producer.res.v('colophontitle') %>" href="colophon.<%= @producer.config['htmlext'] %>"/>
|
16
16
|
<% end %>
|
17
17
|
</guide>
|
18
18
|
</package>
|
@@ -11,12 +11,12 @@
|
|
11
11
|
<% if @next.present? %><link rel="next" title="<%= h(@next_title)%>" href="<%= h(@next.id.to_s+"."+@book.config['htmlext']) %>"><% end %>
|
12
12
|
<% if @prev.present? %><link rel="prev" title="<%= h(@prev_title)%>" href="<%= h(@prev.id.to_s+"."+@book.config['htmlext']) %>"><% end %>
|
13
13
|
<meta name="generator" content="Re:VIEW" />
|
14
|
-
<title><%=h @title %> | <%=h @book.config
|
14
|
+
<title><%=h @title %> | <%=h @book.config.name_of("booktitle")%></title>
|
15
15
|
</head>
|
16
16
|
<body<%= @body_ext %>>
|
17
17
|
<div class="book">
|
18
18
|
<nav class="side-content">
|
19
|
-
<h1><%=h @book.config
|
19
|
+
<h1><%=h @book.config.name_of("booktitle") %></h1>
|
20
20
|
<%= @toc %>
|
21
21
|
<p class="review-signature">powered by <a href="http://reviewml.org/">Re:VIEW</a></p>
|
22
22
|
</nav>
|
@@ -0,0 +1,280 @@
|
|
1
|
+
%!PS-Adobe-3.0 EPSF-3.0
|
2
|
+
%%Creator: (ImageMagick)
|
3
|
+
%%Title: (test/assets/black.eps)
|
4
|
+
%%CreationDate: (2017-08-12T22:40:26+09:00)
|
5
|
+
%%BoundingBox: -0 -0 10 10
|
6
|
+
%%HiResBoundingBox: 0 0 10 10
|
7
|
+
%%DocumentData: Clean7Bit
|
8
|
+
%%LanguageLevel: 1
|
9
|
+
%%Pages: 1
|
10
|
+
%%EndComments
|
11
|
+
|
12
|
+
%%BeginDefaults
|
13
|
+
%%EndDefaults
|
14
|
+
|
15
|
+
%%BeginProlog
|
16
|
+
%
|
17
|
+
% Display a color image. The image is displayed in color on
|
18
|
+
% Postscript viewers or printers that support color, otherwise
|
19
|
+
% it is displayed as grayscale.
|
20
|
+
%
|
21
|
+
/DirectClassPacket
|
22
|
+
{
|
23
|
+
%
|
24
|
+
% Get a DirectClass packet.
|
25
|
+
%
|
26
|
+
% Parameters:
|
27
|
+
% red.
|
28
|
+
% green.
|
29
|
+
% blue.
|
30
|
+
% length: number of pixels minus one of this color (optional).
|
31
|
+
%
|
32
|
+
currentfile color_packet readhexstring pop pop
|
33
|
+
compression 0 eq
|
34
|
+
{
|
35
|
+
/number_pixels 3 def
|
36
|
+
}
|
37
|
+
{
|
38
|
+
currentfile byte readhexstring pop 0 get
|
39
|
+
/number_pixels exch 1 add 3 mul def
|
40
|
+
} ifelse
|
41
|
+
0 3 number_pixels 1 sub
|
42
|
+
{
|
43
|
+
pixels exch color_packet putinterval
|
44
|
+
} for
|
45
|
+
pixels 0 number_pixels getinterval
|
46
|
+
} bind def
|
47
|
+
|
48
|
+
/DirectClassImage
|
49
|
+
{
|
50
|
+
%
|
51
|
+
% Display a DirectClass image.
|
52
|
+
%
|
53
|
+
systemdict /colorimage known
|
54
|
+
{
|
55
|
+
columns rows 8
|
56
|
+
[
|
57
|
+
columns 0 0
|
58
|
+
rows neg 0 rows
|
59
|
+
]
|
60
|
+
{ DirectClassPacket } false 3 colorimage
|
61
|
+
}
|
62
|
+
{
|
63
|
+
%
|
64
|
+
% No colorimage operator; convert to grayscale.
|
65
|
+
%
|
66
|
+
columns rows 8
|
67
|
+
[
|
68
|
+
columns 0 0
|
69
|
+
rows neg 0 rows
|
70
|
+
]
|
71
|
+
{ GrayDirectClassPacket } image
|
72
|
+
} ifelse
|
73
|
+
} bind def
|
74
|
+
|
75
|
+
/GrayDirectClassPacket
|
76
|
+
{
|
77
|
+
%
|
78
|
+
% Get a DirectClass packet; convert to grayscale.
|
79
|
+
%
|
80
|
+
% Parameters:
|
81
|
+
% red
|
82
|
+
% green
|
83
|
+
% blue
|
84
|
+
% length: number of pixels minus one of this color (optional).
|
85
|
+
%
|
86
|
+
currentfile color_packet readhexstring pop pop
|
87
|
+
color_packet 0 get 0.299 mul
|
88
|
+
color_packet 1 get 0.587 mul add
|
89
|
+
color_packet 2 get 0.114 mul add
|
90
|
+
cvi
|
91
|
+
/gray_packet exch def
|
92
|
+
compression 0 eq
|
93
|
+
{
|
94
|
+
/number_pixels 1 def
|
95
|
+
}
|
96
|
+
{
|
97
|
+
currentfile byte readhexstring pop 0 get
|
98
|
+
/number_pixels exch 1 add def
|
99
|
+
} ifelse
|
100
|
+
0 1 number_pixels 1 sub
|
101
|
+
{
|
102
|
+
pixels exch gray_packet put
|
103
|
+
} for
|
104
|
+
pixels 0 number_pixels getinterval
|
105
|
+
} bind def
|
106
|
+
|
107
|
+
/GrayPseudoClassPacket
|
108
|
+
{
|
109
|
+
%
|
110
|
+
% Get a PseudoClass packet; convert to grayscale.
|
111
|
+
%
|
112
|
+
% Parameters:
|
113
|
+
% index: index into the colormap.
|
114
|
+
% length: number of pixels minus one of this color (optional).
|
115
|
+
%
|
116
|
+
currentfile byte readhexstring pop 0 get
|
117
|
+
/offset exch 3 mul def
|
118
|
+
/color_packet colormap offset 3 getinterval def
|
119
|
+
color_packet 0 get 0.299 mul
|
120
|
+
color_packet 1 get 0.587 mul add
|
121
|
+
color_packet 2 get 0.114 mul add
|
122
|
+
cvi
|
123
|
+
/gray_packet exch def
|
124
|
+
compression 0 eq
|
125
|
+
{
|
126
|
+
/number_pixels 1 def
|
127
|
+
}
|
128
|
+
{
|
129
|
+
currentfile byte readhexstring pop 0 get
|
130
|
+
/number_pixels exch 1 add def
|
131
|
+
} ifelse
|
132
|
+
0 1 number_pixels 1 sub
|
133
|
+
{
|
134
|
+
pixels exch gray_packet put
|
135
|
+
} for
|
136
|
+
pixels 0 number_pixels getinterval
|
137
|
+
} bind def
|
138
|
+
|
139
|
+
/PseudoClassPacket
|
140
|
+
{
|
141
|
+
%
|
142
|
+
% Get a PseudoClass packet.
|
143
|
+
%
|
144
|
+
% Parameters:
|
145
|
+
% index: index into the colormap.
|
146
|
+
% length: number of pixels minus one of this color (optional).
|
147
|
+
%
|
148
|
+
currentfile byte readhexstring pop 0 get
|
149
|
+
/offset exch 3 mul def
|
150
|
+
/color_packet colormap offset 3 getinterval def
|
151
|
+
compression 0 eq
|
152
|
+
{
|
153
|
+
/number_pixels 3 def
|
154
|
+
}
|
155
|
+
{
|
156
|
+
currentfile byte readhexstring pop 0 get
|
157
|
+
/number_pixels exch 1 add 3 mul def
|
158
|
+
} ifelse
|
159
|
+
0 3 number_pixels 1 sub
|
160
|
+
{
|
161
|
+
pixels exch color_packet putinterval
|
162
|
+
} for
|
163
|
+
pixels 0 number_pixels getinterval
|
164
|
+
} bind def
|
165
|
+
|
166
|
+
/PseudoClassImage
|
167
|
+
{
|
168
|
+
%
|
169
|
+
% Display a PseudoClass image.
|
170
|
+
%
|
171
|
+
% Parameters:
|
172
|
+
% class: 0-PseudoClass or 1-Grayscale.
|
173
|
+
%
|
174
|
+
currentfile buffer readline pop
|
175
|
+
token pop /class exch def pop
|
176
|
+
class 0 gt
|
177
|
+
{
|
178
|
+
currentfile buffer readline pop
|
179
|
+
token pop /depth exch def pop
|
180
|
+
/grays columns 8 add depth sub depth mul 8 idiv string def
|
181
|
+
columns rows depth
|
182
|
+
[
|
183
|
+
columns 0 0
|
184
|
+
rows neg 0 rows
|
185
|
+
]
|
186
|
+
{ currentfile grays readhexstring pop } image
|
187
|
+
}
|
188
|
+
{
|
189
|
+
%
|
190
|
+
% Parameters:
|
191
|
+
% colors: number of colors in the colormap.
|
192
|
+
% colormap: red, green, blue color packets.
|
193
|
+
%
|
194
|
+
currentfile buffer readline pop
|
195
|
+
token pop /colors exch def pop
|
196
|
+
/colors colors 3 mul def
|
197
|
+
/colormap colors string def
|
198
|
+
currentfile colormap readhexstring pop pop
|
199
|
+
systemdict /colorimage known
|
200
|
+
{
|
201
|
+
columns rows 8
|
202
|
+
[
|
203
|
+
columns 0 0
|
204
|
+
rows neg 0 rows
|
205
|
+
]
|
206
|
+
{ PseudoClassPacket } false 3 colorimage
|
207
|
+
}
|
208
|
+
{
|
209
|
+
%
|
210
|
+
% No colorimage operator; convert to grayscale.
|
211
|
+
%
|
212
|
+
columns rows 8
|
213
|
+
[
|
214
|
+
columns 0 0
|
215
|
+
rows neg 0 rows
|
216
|
+
]
|
217
|
+
{ GrayPseudoClassPacket } image
|
218
|
+
} ifelse
|
219
|
+
} ifelse
|
220
|
+
} bind def
|
221
|
+
|
222
|
+
/DisplayImage
|
223
|
+
{
|
224
|
+
%
|
225
|
+
% Display a DirectClass or PseudoClass image.
|
226
|
+
%
|
227
|
+
% Parameters:
|
228
|
+
% x & y translation.
|
229
|
+
% x & y scale.
|
230
|
+
% label pointsize.
|
231
|
+
% image label.
|
232
|
+
% image columns & rows.
|
233
|
+
% class: 0-DirectClass or 1-PseudoClass.
|
234
|
+
% compression: 0-none or 1-RunlengthEncoded.
|
235
|
+
% hex color packets.
|
236
|
+
%
|
237
|
+
gsave
|
238
|
+
/buffer 512 string def
|
239
|
+
/byte 1 string def
|
240
|
+
/color_packet 3 string def
|
241
|
+
/pixels 768 string def
|
242
|
+
|
243
|
+
currentfile buffer readline pop
|
244
|
+
token pop /x exch def
|
245
|
+
token pop /y exch def pop
|
246
|
+
x y translate
|
247
|
+
currentfile buffer readline pop
|
248
|
+
token pop /x exch def
|
249
|
+
token pop /y exch def pop
|
250
|
+
currentfile buffer readline pop
|
251
|
+
token pop /pointsize exch def pop
|
252
|
+
x y scale
|
253
|
+
currentfile buffer readline pop
|
254
|
+
token pop /columns exch def
|
255
|
+
token pop /rows exch def pop
|
256
|
+
currentfile buffer readline pop
|
257
|
+
token pop /class exch def pop
|
258
|
+
currentfile buffer readline pop
|
259
|
+
token pop /compression exch def pop
|
260
|
+
class 0 gt { PseudoClassImage } { DirectClassImage } ifelse
|
261
|
+
grestore
|
262
|
+
} bind def
|
263
|
+
%%EndProlog
|
264
|
+
%%Page: 1 1
|
265
|
+
%%PageBoundingBox: 0 0 10 10
|
266
|
+
userdict begin
|
267
|
+
DisplayImage
|
268
|
+
0 0
|
269
|
+
10 10
|
270
|
+
12
|
271
|
+
10 10
|
272
|
+
1
|
273
|
+
1
|
274
|
+
1
|
275
|
+
1
|
276
|
+
0000000000000000000000000000000000000000
|
277
|
+
end
|
278
|
+
%%PageTrailer
|
279
|
+
%%Trailer
|
280
|
+
%%EOF
|