[racket] Generating Type 1 PDF fonts from plot

From: Neil Toronto (neil.toronto at gmail.com)
Date: Wed Jul 17 21:47:29 EDT 2013

On 07/17/2013 07:06 PM, David Van Horn wrote:
> On 7/17/13 8:45 PM, David Van Horn wrote:
>> I have generated PDF files from some plots with labels.  The font for
>> the label ends up embedded as a PostScript font (according to pdffonts).
>>   Is there a way to use Type 1 fonts?
>>
>> Here's an example:
>>
>>  > more sin.rkt
>> #lang racket
>> (require plot)
>> (plot (function sin (- pi) pi #:label "y = sin(x)")
>>        #:out-file "sin.pdf")
>>
>>  > racket sin.rkt
>> (object:2d-plot-snip% ...)
>>
>>  > pdffonts sin.pdf
>> name                                 type              emb sub uni
>> object ID
>> ------------------------------------ ----------------- --- --- ---
>> ---------
>> OZFXPV+CairoFont-0-0                 CID Type 0C       yes yes yes
>> 5  0
>> UEATNW+CairoFont-1-0                 CID Type 0C       yes yes yes
>> 6  0
>
> As a work-around it seems I can generate PS and convert:
>
>  > more sin.rkt
> #lang racket
> (require plot)
> (plot (function sin (- pi) pi #:label "y = sin(x)")
>        #:out-file "sin.ps")
>
>  > ps2pdf -dEPSCrop sin.ps
>  > pdffonts sin.pdf
> name                                 type              emb sub uni
> object ID
> ------------------------------------ ----------------- --- --- ---
> ---------
> TKRSLQ+f-0-0                         Type 1C           yes yes no
> 8  0
> WYAULZ+f-1-0                         Type 1C           yes yes no
> 10  0
>
> David

I don't think there's anything I can do about this in plot. (It just 
draws text on a device context after setting the font, and I don't see a 
way to change the PDF font in the `font%' constructor.) It's possible 
that a different font family will export differently, though. If that's 
the case, setting the `plot-font-family' parameter could work around this.

Neil ⊥


Posted on the users mailing list.