8 typedef enum { EMB_FMT_T1, // type1, with AFM/PFM,PFA/PFB
9 EMB_FMT_TTF, // sfnt, for TTF(glyf)
10 EMB_FMT_OTF, // sfnt+cff, for OTF(cff)
11 EMB_FMT_CFF, // cff, for raw CFF
12 EMB_FMT_STDFONT // don't embed (already present)
14 typedef enum { EMB_DEST_NATIVE, // just subsetting/conversion
21 typedef enum { EMB_RIGHT_FULL=0, EMB_RIGHT_NONE=0x02,
22 EMB_RIGHT_READONLY=0x04,
23 EMB_RIGHT_NO_SUBSET=0x0100,
24 EMB_RIGHT_BITMAPONLY=0x0200 } EMB_RIGHT_TYPE;
26 typedef enum { EMB_A_MULTIBYTE=0x01, // embedd as multibyte font?
27 EMB_A_SUBSET=0x02, // do subsetting?
28 EMB_A_T1_TO_CFF=0x04, // convert Type1 to CFF?
29 EMB_A_CFF_TO_OTF=0x08, // wrap CFF(from input or T1+CONVERT_CFF) in sfnt? (OTF)
30 EMB_A_OTF_TO_CFF=0x10, // unwrap CFF
32 EMB_A_CLOSE_FONTFILE=0x8000
35 typedef enum { EMB_C_MUST_SUBSET=0x01, // (fail, when not possible)
36 EMB_C_EDITABLE_SUBSET=0x02, // (...)
37 EMB_C_NEVER_SUBSET=0x04, // (...)
39 EMB_C_FORCE_MULTIBYTE=0x08, // always use multibyte fonts
41 EMB_C_PDF_OT=0x10, // output TTF/OTF (esp. CFF to OTF)
42 EMB_C_KEEP_T1=0x20, // don't convert T1 to CFF
44 EMB_C_TAKE_FONTFILE=0x8000 // take ownership of fontfile
47 typedef struct _EMB_PARAMS {
56 EMB_RIGHT_TYPE rights;
62 EMB_PARAMS *emb_new(FONTFILE *font,EMB_DESTINATION dest,EMB_CONSTRAINTS mode);
63 // emb_embedd does only the "binary" part
64 int emb_embed(EMB_PARAMS *emb,OUTPUT_FN output,void *context); // returns number of bytes written
65 void emb_close(EMB_PARAMS *emb);
67 // TODO: encoding, TODO: ToUnicode
68 static inline void emb_set(EMB_PARAMS *emb,int unicode,unsigned short gid) // {{{
71 if (emb->plan&EMB_A_MULTIBYTE) {
72 bit_set(emb->subset,gid);
73 // ToUnicode.add(gid,unicode);
81 // TODO: encoding?, TODO: non-sfnt
82 static inline unsigned short emb_get(EMB_PARAMS *emb,int unicode) // {{{ gid
84 const unsigned short gid=otf_from_unicode(emb->font->sfnt,unicode);
85 emb_set(emb,unicode,gid);
90 #include "embed_pdf.h"