Now that we've got definitive metrics for the standard fonts, there's no need
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sat, 13 May 2006 14:36:15 +0000 (14:36 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sat, 13 May 2006 14:36:15 +0000 (14:36 +0000)
to embed /FirstChar, /LastChar, /Widths or (soon) /FontDescriptor for them.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6683 cda61777-01e9-0310-a592-d414129be87e

bk_pdf.c

index 034cff1..99ad908 100644 (file)
--- a/bk_pdf.c
+++ b/bk_pdf.c
@@ -40,6 +40,8 @@ static void pdf_string_len(void (*add)(object *, char const *),
 static void objref(object *o, object *dest);
 static char *pdf_outline_convert(wchar_t *s, int *len);
 
+static int is_std_font(char const *name);
+
 static void make_pages_node(object *node, object *parent, page_data *first,
                            page_data *last, object *resources,
                            object *mediabox);
@@ -162,7 +164,7 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
 
        objtext(font, "\n]\n>>\n");
 
-       {
+       if (!is_std_font(fe->font->info->name)){
            object *widths = new_object(&olist);
            int firstchar = -1, lastchar = -1;
            char buf[80];
@@ -548,6 +550,21 @@ static void objref(object *o, object *dest)
     rdaddsc(&o->main, buf);
 }
 
+static char const * const stdfonts[] = {
+    "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic",
+    "Helvetica", "Helvetica-Bold", "Helvetica-Oblique","Helvetica-BoldOblique",
+    "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique",
+    "Symbol", "ZapfDingbats"
+};
+
+static int is_std_font(char const *name) {
+    unsigned i;
+    for (i = 0; i < lenof(stdfonts); i++)
+       if (strcmp(name, stdfonts[i]) == 0)
+           return TRUE;
+    return FALSE;
+}
+
 static void make_pages_node(object *node, object *parent, page_data *first,
                            page_data *last, object *resources,
                            object *mediabox)