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
|
||||
|
|
|
@ -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
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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"
|
|
@ -0,0 +1,2 @@
|
|||
./compressor ../pdfglyphlist.source.ml ../pdfglyphlist.ml
|
||||
./compressor ../pdfafmdata.source.ml ../pdfafmdata.ml
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
val unicodedata_source : string
|
|
@ -0,0 +1 @@
|
|||
let unicodedata_source = __DATA:UnicodeData.txt
|
Loading…
Reference in New Issue