sum and fsum

This commit is contained in:
John Whitington 2023-03-12 16:29:32 +00:00
parent b7628eb336
commit 4394399bc7
2 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ let width_of_text font text =
match font with match font with
| Pdftext.SimpleFont {Pdftext.fontmetrics = Some fontmetrics} -> | Pdftext.SimpleFont {Pdftext.fontmetrics = Some fontmetrics} ->
begin try begin try
fold_left ( +. ) 0. (map (fun c -> fontmetrics.(int_of_char c)) (explode text)) fsum (map (fun c -> fontmetrics.(int_of_char c)) (explode text))
with with
_ -> 0. _ -> 0.
end end

View File

@ -35,7 +35,7 @@ let read_chunk i =
(string_of_tag chunktype, chunkdata) (string_of_tag chunktype, chunkdata)
let concat_bytes ss = let concat_bytes ss =
let total_length = fold_left ( + ) 0 (map bytes_size ss) in let total_length = sum (map bytes_size ss) in
let s' = mkbytes total_length in let s' = mkbytes total_length in
let p = ref 0 in let p = ref 0 in
iter iter