Initial support for adding fonts at run-time. Currently we only support
[sgt/halibut] / bk_ps.c
diff --git a/bk_ps.c b/bk_ps.c
index 0f8bc99..95d1383 100644 (file)
--- a/bk_ps.c
+++ b/bk_ps.c
@@ -56,7 +56,7 @@ void ps_backend(paragraph *sourceform, keywordlist *keywords,
     fprintf(fp, "%%%%DocumentNeededResources:\n");
     for (fe = doc->fonts->head; fe; fe = fe->next)
        /* XXX This may request the same font multiple times. */
-       fprintf(fp, "%%%%+ font %s\n", fe->font->name);
+       fprintf(fp, "%%%%+ font %s\n", fe->font->info->name);
     fprintf(fp, "%%%%DocumentSuppliedResources: procset Halibut 0 0\n");
     fprintf(fp, "%%%%EndComments\n");
 
@@ -96,10 +96,10 @@ void ps_backend(paragraph *sourceform, keywordlist *keywords,
 
     for (fe = doc->fonts->head; fe; fe = fe->next)
        /* XXX This may request the same font multiple times. */
-       fprintf(fp, "%%%%IncludeResource: font %s\n", fe->font->name);
+       fprintf(fp, "%%%%IncludeResource: font %s\n", fe->font->info->name);
 
     /*
-     * Re-encode and re-metric the fonts.
+     * Re-encode the fonts.
      */
     font_index = 0;
     for (fe = doc->fonts->head; fe; fe = fe->next) {
@@ -109,21 +109,15 @@ void ps_backend(paragraph *sourceform, keywordlist *keywords,
        sprintf(fname, "f%d", font_index++);
        fe->name = dupstr(fname);
 
-       fprintf(fp, "/%s findfont dup length dict begin\n", fe->font->name);
+       fprintf(fp, "/%s findfont dup length dict begin\n",
+           fe->font->info->name);
        fprintf(fp, "{1 index /FID ne {def} {pop pop} ifelse} forall\n");
        fprintf(fp, "/Encoding [\n");
        for (i = 0; i < 256; i++)
            fprintf(fp, "/%s%c", fe->vector[i] ? fe->vector[i] : ".notdef",
                    i % 4 == 3 ? '\n' : ' ');
-       fprintf(fp, "] def /Metrics 256 dict dup begin\n");
-       for (i = 0; i < 256; i++) {
-           if (fe->indices[i] >= 0) {
-               double width = fe->font->widths[fe->indices[i]];
-               fprintf(fp, "/%s %g def\n", fe->vector[i],
-                       1000.0 * width / FUNITS_PER_PT);
-           }
-       }
-       fprintf(fp, "end def currentdict end\n");
+       fprintf(fp, "] def\n");
+       fprintf(fp, "currentdict end\n");
        fprintf(fp, "/fontname-%s exch definefont /%s exch def\n\n",
               fe->name, fe->name);
     }