more
This commit is contained in:
parent
69b76f4746
commit
5503952a9a
|
@ -50,6 +50,7 @@ let string_of_encoding = function
|
|||
| Pdftext.StandardEncoding -> "/StandardEncoding"
|
||||
| _ -> failwith "unknown encoding"
|
||||
|
||||
(* FIXME add "" = full subset *)
|
||||
let embed_truetype pdf ~fontfile ~fontname ~text ~encoding =
|
||||
let unicodepoints = Pdftext.codepoints_of_utf8 text in
|
||||
let glyphlist_table = Pdfglyphlist.reverse_glyph_hashes () in
|
||||
|
@ -101,3 +102,9 @@ let embed_truetype pdf ~fontfile ~fontname ~text ~encoding =
|
|||
widths
|
||||
in
|
||||
Pdf.addobj pdf font
|
||||
|
||||
(* For now, to get a Pdftext.font, we build it with the function above using an empty (i.e. full) subset, put it in an empty PDF and then read it back. This will be fixed later. *)
|
||||
let font_of_truetype ~fontfile ~fontname ~encoding =
|
||||
let pdf = Pdf.empty () in
|
||||
let fontobjnum = embed_truetype pdf ~fontfile ~fontname ~text:"" ~encoding in
|
||||
Pdftext.read_font pdf (Pdf.lookup_obj pdf fontobjnum)
|
||||
|
|
|
@ -4,3 +4,8 @@
|
|||
val embed_truetype :
|
||||
Pdf.t -> fontfile:Pdfio.bytes -> fontname:string -> text:string ->
|
||||
encoding:Pdftext.encoding -> int
|
||||
|
||||
(* Eventually, we will just have this, and a subsetting function. Then we will
|
||||
use Pdftext.write_font to write it. *)
|
||||
val font_of_truetype :
|
||||
fontfile:Pdfio.bytes -> fontname:string -> encoding:Pdftext.encoding -> Pdftext.font
|
||||
|
|
Loading…
Reference in New Issue