more
This commit is contained in:
parent
4aa51e1554
commit
676c862451
|
@ -3724,7 +3724,7 @@ let go () =
|
|||
| StandardFont f -> Some (Pdftext.StandardFont (f, Pdftext.WinAnsiEncoding))
|
||||
| OtherFont f -> None (* it's in fontname *)
|
||||
| FontToEmbed (fontfile, encoding) ->
|
||||
Some (Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~text:"" ~encoding)
|
||||
Some (Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding)
|
||||
in
|
||||
warn_prerotate range pdf;
|
||||
let pdf =
|
||||
|
@ -3991,7 +3991,7 @@ let go () =
|
|||
match args.font with
|
||||
| StandardFont f -> Pdftext.StandardFont (f, Pdftext.WinAnsiEncoding)
|
||||
| FontToEmbed (fontfile, encoding) ->
|
||||
Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~text:"" ~encoding
|
||||
Cpdfembed.embed_truetype pdf ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding
|
||||
| _ -> error "TOC: not a standard or embedded font"
|
||||
in
|
||||
let pdf = Cpdftoc.typeset_table_of_contents ~font ~fontsize:args.fontsize ~title:args.toc_title ~bookmark:args.toc_bookmark pdf in
|
||||
|
@ -4002,7 +4002,7 @@ let go () =
|
|||
match args.font with
|
||||
| StandardFont f -> Pdftext.StandardFont (f, Pdftext.WinAnsiEncoding)
|
||||
| FontToEmbed (fontfile, encoding) ->
|
||||
Cpdfembed.embed_truetype (Pdf.empty ()) ~fontfile ~fontname:args.fontname ~text:"" ~encoding
|
||||
Cpdfembed.embed_truetype (Pdf.empty ()) ~fontfile ~fontname:args.fontname ~codepoints:[] ~encoding
|
||||
| _ -> error "text to PDF: not a standard or embedded font"
|
||||
in
|
||||
let pdf =
|
||||
|
|
|
@ -44,8 +44,7 @@ let basename () =
|
|||
incr fontnum;
|
||||
"AAAAA" ^ string_of_char (char_of_int (!fontnum + 65))
|
||||
|
||||
let embed_truetype pdf ~fontfile ~fontname ~text ~encoding =
|
||||
let unicodepoints = Pdftext.codepoints_of_utf8 text in
|
||||
let embed_truetype pdf ~fontfile ~fontname ~codepoints ~encoding =
|
||||
let glyphlist_table = Pdfglyphlist.reverse_glyph_hashes () in
|
||||
let encoding_table = Pdftext.reverse_table_of_encoding encoding in
|
||||
let accepted_unicodepoints =
|
||||
|
@ -53,7 +52,7 @@ let embed_truetype pdf ~fontfile ~fontname ~text ~encoding =
|
|||
(fun u ->
|
||||
(u, pdfcode_of_unicode_codepoint encoding_table glyphlist_table u))
|
||||
(calc_accepted_unicodepoints
|
||||
encoding_table glyphlist_table unicodepoints)
|
||||
encoding_table glyphlist_table codepoints)
|
||||
in
|
||||
let f = Cpdftruetype.parse ~subset:accepted_unicodepoints fontfile ~encoding in
|
||||
let name_1 = basename () in
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
(* Embed a TrueType font for the given set of UTF8 characters in the given
|
||||
encoding, adding it as an object to the PDF, and returning the number of
|
||||
that object. *)
|
||||
(* Embed a TrueType font for the given set of unicode codepoints in the given
|
||||
encoding, adding the fontfile to the PDF and returning the font object. *)
|
||||
val embed_truetype :
|
||||
Pdf.t -> fontfile:Pdfio.bytes -> fontname:string -> text:string ->
|
||||
Pdf.t -> fontfile:Pdfio.bytes -> fontname:string -> codepoints:int list ->
|
||||
encoding:Pdftext.encoding -> Pdftext.font
|
||||
|
|
Loading…
Reference in New Issue