mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2024-12-22 23:08:13 +01:00
more
This commit is contained in:
parent
c6df45109e
commit
2c1bb8852a
1
Changes
1
Changes
@ -1,5 +1,6 @@
|
||||
2.5 (Upcoming 2022)
|
||||
|
||||
o The -list-fonts operation now obeys the range
|
||||
o New operation -print-font-table gives (charcode, unicode, glyph name) triples
|
||||
o Can now search for a font by real name with -font
|
||||
o Text added in existing fonts is now encoding-aware (plus new raw mode)
|
||||
|
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
# Build the cpdf command line tools and top level
|
||||
MODS = cpdfyojson cpdfxmlm \
|
||||
cpdferror cpdfjson cpdfstrftime cpdfcoord cpdfattach \
|
||||
cpdfunicodedata cpdferror cpdfjson cpdfstrftime cpdfcoord cpdfattach \
|
||||
cpdfpagespec cpdfposition cpdf cpdffont cpdfcommand
|
||||
|
||||
SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml
|
||||
|
19
compressor/Makefile
Normal file
19
compressor/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
SOURCES = compressor.ml
|
||||
|
||||
RESULT = compressor
|
||||
|
||||
PACKS = camlpdf
|
||||
|
||||
TARGETS := native-code
|
||||
|
||||
OCAMLFLAGS = -bin-annot
|
||||
OCAMLNCFLAGS = -g -safe-string -w -3
|
||||
OCAMLBCFLAGS = -g -safe-string -w -3
|
||||
OCAMLLDFLAGS = -g
|
||||
|
||||
all : $(TARGETS)
|
||||
|
||||
clean ::
|
||||
rm -rf doc foo foo2 out.pdf out2.pdf *.cmt *.cmti *.zlib
|
||||
|
||||
-include OCamlMakefile
|
1299
compressor/OCamlMakefile
Executable file
1299
compressor/OCamlMakefile
Executable file
File diff suppressed because it is too large
Load Diff
34626
compressor/UnicodeData.txt
Normal file
34626
compressor/UnicodeData.txt
Normal file
File diff suppressed because it is too large
Load Diff
37
compressor/compressor.ml
Normal file
37
compressor/compressor.ml
Normal file
@ -0,0 +1,37 @@
|
||||
(* compressor <infile> <outfile> [<compress>] substitutes data files specified
|
||||
by __DATA:<filename>\n into the <infile> template, writing to <outfile>. The
|
||||
data is printed in way which meets OCaml's syntax. It is optionally
|
||||
compressed by zlib. *)
|
||||
open Pdfutil
|
||||
|
||||
let contents_of_file filename =
|
||||
let ch = open_in_bin filename in
|
||||
let s = really_input_string ch (in_channel_length ch) in
|
||||
close_in ch;
|
||||
s
|
||||
|
||||
let contents_to_file filename contents =
|
||||
let ch = open_out_bin filename in
|
||||
output_string ch contents;
|
||||
close_out ch
|
||||
|
||||
let rec process a = function
|
||||
| '_'::'_'::'D'::'A'::'T'::'A'::':'::more ->
|
||||
let filename, rest = cleavewhile (neq '\n') more in
|
||||
let data = all_but_last (explode (contents_of_file (implode filename))) in
|
||||
let compressed = Pdfio.string_of_bytes (Pdfcodec.encode_flate (Pdfio.bytes_of_string (implode data))) in
|
||||
let ocaml = explode (Printf.sprintf "%S" compressed) in
|
||||
process (rev ocaml @ a) rest
|
||||
| h::t -> process (h::a) t
|
||||
| [] -> rev a
|
||||
|
||||
let go infile outfile compress =
|
||||
let indata = explode (contents_of_file infile) in
|
||||
let processed = process [] indata in
|
||||
contents_to_file outfile (implode processed)
|
||||
|
||||
let () =
|
||||
match Sys.argv with
|
||||
| [|_; infile; outfile|] -> go infile outfile false
|
||||
| [|_; infile; outfile; "compress"|] -> go infile outfile true
|
||||
| _ -> Printf.eprintf "compressor: unknown command line\n"
|
2
compressor/run
Executable file
2
compressor/run
Executable file
@ -0,0 +1,2 @@
|
||||
./compressor ../pdfglyphlist.source.ml ../pdfglyphlist.ml
|
||||
./compressor ../pdfafmdata.source.ml ../pdfafmdata.ml
|
1
cpdfunicodedata.ml
Normal file
1
cpdfunicodedata.ml
Normal file
File diff suppressed because one or more lines are too long
1
cpdfunicodedata.mli
Normal file
1
cpdfunicodedata.mli
Normal file
@ -0,0 +1 @@
|
||||
val unicodedata_source : string
|
1
cpdfunicodedata.source.ml
Normal file
1
cpdfunicodedata.source.ml
Normal file
@ -0,0 +1 @@
|
||||
let unicodedata_source = __DATA:UnicodeData.txt
|
Loading…
Reference in New Issue
Block a user