more
This commit is contained in:
parent
4ac9e7c61e
commit
aa181a9d7c
|
@ -221,10 +221,10 @@ let remove_unneeded_tables major minor tables data =
|
||||||
let tables = Array.of_list (sort (fun (_, _, o, _) (_, _, o', _) -> compare o o') tables) in
|
let tables = Array.of_list (sort (fun (_, _, o, _) (_, _, o', _) -> compare o o') tables) in
|
||||||
let tablesout = ref [] in
|
let tablesout = ref [] in
|
||||||
let cut = ref 0l in
|
let cut = ref 0l in
|
||||||
Printf.printf "***Input:\n";
|
if !dbg then Printf.printf "***Input:\n";
|
||||||
Array.iteri
|
Array.iteri
|
||||||
(fun i (tag, checkSum, offset, ttlength) ->
|
(fun i (tag, checkSum, offset, ttlength) ->
|
||||||
Printf.printf "tag = %li = %s, offset = %li\n" tag (string_of_tag tag) offset;
|
if !dbg then Printf.printf "tag = %li = %s, offset = %li\n" tag (string_of_tag tag) offset;
|
||||||
if mem (string_of_tag tag) required_tables then
|
if mem (string_of_tag tag) required_tables then
|
||||||
tablesout := (tag, checkSum, i32sub offset !cut, ttlength)::!tablesout
|
tablesout := (tag, checkSum, i32sub offset !cut, ttlength)::!tablesout
|
||||||
else
|
else
|
||||||
|
@ -238,10 +238,10 @@ let remove_unneeded_tables major minor tables data =
|
||||||
(fun (tag, checksum, offset, ttlength) -> (tag, checksum, i32sub offset header_size_reduction, ttlength))
|
(fun (tag, checksum, offset, ttlength) -> (tag, checksum, i32sub offset header_size_reduction, ttlength))
|
||||||
(rev !tablesout))
|
(rev !tablesout))
|
||||||
in
|
in
|
||||||
Printf.printf "***Reduced:\n";
|
if !dbg then Printf.printf "***Reduced:\n";
|
||||||
Array.iter
|
Array.iter
|
||||||
(fun (tag, checkSum, offset, ttlength) ->
|
(fun (tag, checkSum, offset, ttlength) ->
|
||||||
Printf.printf "tag = %li = %s, offset = %li\n" tag (string_of_tag tag) offset)
|
if !dbg then Printf.printf "tag = %li = %s, offset = %li\n" tag (string_of_tag tag) offset)
|
||||||
newtables;
|
newtables;
|
||||||
let bs = make_write_bitstream () in
|
let bs = make_write_bitstream () in
|
||||||
(* table directory *)
|
(* table directory *)
|
||||||
|
@ -283,7 +283,7 @@ let remove_unneeded_tables major minor tables data =
|
||||||
let mk_b byte_offset = bitbytes_of_input (let i = input_of_bytes data in i.seek_in byte_offset; i) in
|
let mk_b byte_offset = bitbytes_of_input (let i = input_of_bytes data in i.seek_in byte_offset; i) in
|
||||||
Array.iter
|
Array.iter
|
||||||
(fun (tag, _, _, _) ->
|
(fun (tag, _, _, _) ->
|
||||||
Printf.printf "Writing %s table\n" (string_of_tag tag);
|
if !dbg then Printf.printf "Writing %s table\n" (string_of_tag tag);
|
||||||
match findtag tag with
|
match findtag tag with
|
||||||
| (og_off, Some len) ->
|
| (og_off, Some len) ->
|
||||||
let b = mk_b (i32toi og_off) in
|
let b = mk_b (i32toi og_off) in
|
||||||
|
@ -296,7 +296,7 @@ let remove_unneeded_tables major minor tables data =
|
||||||
_ -> ())
|
_ -> ())
|
||||||
newtables;
|
newtables;
|
||||||
let bytes = bytes_of_write_bitstream bs in
|
let bytes = bytes_of_write_bitstream bs in
|
||||||
Printf.printf "Made subset font of length %i bytes\n" (bytes_size bytes);
|
if !dbg then Printf.printf "Made subset font of length %i bytes\n" (bytes_size bytes);
|
||||||
(*let o = open_out_bin "fontout.ttf" in
|
(*let o = open_out_bin "fontout.ttf" in
|
||||||
output_string o (string_of_bytes bytes);
|
output_string o (string_of_bytes bytes);
|
||||||
close_out o;*)
|
close_out o;*)
|
||||||
|
|
Loading…
Reference in New Issue