more
This commit is contained in:
parent
efbd794d35
commit
a2ed069fe2
|
@ -2054,6 +2054,7 @@ let addsopacity f =
|
||||||
addop (Cpdfdraw.SOpacity f)
|
addop (Cpdfdraw.SOpacity f)
|
||||||
|
|
||||||
let addtext s =
|
let addtext s =
|
||||||
|
addop (Cpdfdraw.Font ("/F0", 36.));
|
||||||
addop (Cpdfdraw.Text s)
|
addop (Cpdfdraw.Text s)
|
||||||
|
|
||||||
let addblock s =
|
let addblock s =
|
||||||
|
|
15
cpdfdraw.ml
15
cpdfdraw.ml
|
@ -39,6 +39,7 @@ type drawops =
|
||||||
| NewPage
|
| NewPage
|
||||||
| Opacity of float
|
| Opacity of float
|
||||||
| SOpacity of float
|
| SOpacity of float
|
||||||
|
| Font of string * float
|
||||||
| Text of string
|
| Text of string
|
||||||
| Block of unit (* to fix *)
|
| Block of unit (* to fix *)
|
||||||
| URL of string
|
| URL of string
|
||||||
|
@ -57,6 +58,10 @@ let fresh_gs_name () =
|
||||||
gsnum += 1;
|
gsnum += 1;
|
||||||
"/gs" ^ string_of_int !gsnum
|
"/gs" ^ string_of_int !gsnum
|
||||||
|
|
||||||
|
let current_url = ref None
|
||||||
|
|
||||||
|
let fresh_font_name () = "/F0"
|
||||||
|
|
||||||
let rec ops_of_drawop pdf = function
|
let rec ops_of_drawop pdf = function
|
||||||
| Push -> [Pdfops.Op_q]
|
| Push -> [Pdfops.Op_q]
|
||||||
| Pop -> [Pdfops.Op_Q]
|
| Pop -> [Pdfops.Op_Q]
|
||||||
|
@ -107,6 +112,16 @@ let rec ops_of_drawop pdf = function
|
||||||
let n = fresh_gs_name () in
|
let n = fresh_gs_name () in
|
||||||
Hashtbl.add gss n (Pdf.Dictionary [("/CA", Pdf.Real v)]);
|
Hashtbl.add gss n (Pdf.Dictionary [("/CA", Pdf.Real v)]);
|
||||||
[Pdfops.Op_gs n]
|
[Pdfops.Op_gs n]
|
||||||
|
| URL s ->
|
||||||
|
current_url := Some s;
|
||||||
|
[]
|
||||||
|
| EndURL ->
|
||||||
|
current_url := None;
|
||||||
|
[]
|
||||||
|
| Font (s, f) ->
|
||||||
|
[Pdfops.Op_Tf (s, f)]
|
||||||
|
| Text s ->
|
||||||
|
[Pdfops.Op_BT; Pdfops.Op_Tj s; Pdfops.Op_ET] (* FIXME: convert to actual char codes based on font in use, obvs *)
|
||||||
|
|
||||||
and ops_of_drawops pdf drawops =
|
and ops_of_drawops pdf drawops =
|
||||||
flatten (map (ops_of_drawop pdf) drawops)
|
flatten (map (ops_of_drawop pdf) drawops)
|
||||||
|
|
|
@ -37,6 +37,7 @@ type drawops =
|
||||||
| NewPage
|
| NewPage
|
||||||
| Opacity of float
|
| Opacity of float
|
||||||
| SOpacity of float
|
| SOpacity of float
|
||||||
|
| Font of string * float
|
||||||
| Text of string
|
| Text of string
|
||||||
| Block of unit (* to fix *)
|
| Block of unit (* to fix *)
|
||||||
| URL of string
|
| URL of string
|
||||||
|
|
Loading…
Reference in New Issue