[luatex] pdf inclusion: extended font handling

Herbert Schulz herbs at wideopenwest.com
Wed Dec 19 00:03:23 CET 2018


No guarantees but try using the -dNOSAFER option for gs. 

Good Luck,
Herb Schulz

> On Dec 18, 2018, at 4:49 PM, Knut Petersen <Knut_Petersen at t-online.de> wrote:
> Hi everybody!
> I often write documents that mix text and music, a short example is given below:
> \NeedsTeXFormat{LaTeX2e}
> \documentclass[12pt]{letter}
> \usepackage{geometry}
> \geometry{papersize={14.85cm,21cm},noheadfoot,nomarginpar,
>           left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm}
> \usepackage{fontspec}
> \defaultfontfeatures{Ligatures=TeX}
> \setmainfont{cmunrm.otf}[BoldFont=cmunbx.otf,
>                          ItalicFont=cmunti.otf,
>                          BoldItalicFont=cmunbi.otf]
> \usepackage{lipsum} 
> \usepackage{lyinla}
> \begin{document}
> \pagestyle{empty}
> \small\lipsum[1]
> {\bfseries O du fröhliche}\hspace{\fill}EG 44, 1-3\par
> \begin{lilyfrag}[staffsize=16.666,width=0.92\textwidth,smalllatexfont]
>   \include "deutsch.ly"
>     \relative a' { 
>       \key d \major
>       a2 h a4. g8 fis4 (g) \breathe a2 h a4. g8 fis4 (g) \breathe \break
>       a2 2 h cis4 d cis2 h a1
>     }
>     \addlyrics {
>       O du fröh -- li -- che, __ o du se -- li -- ge, __
>       gna -- den -- brin -- gen -- de Weih -- nachts -- zeit!
>     }
> \end{lilyfrag}
> \lipsum[2]
> \end{document}
> The example above is intended to be translated with lualatex --shell-escape.
> lyinla.sty provides the necessary code for the lilyfrag environement.
> The text inside of a lilyfrag environment is extended and passed to the lilypond
> music engraver. The result is a number of pdfs without any embedded
> fonts, these pdf are included using \includegraphics. At the end of the lualatex
> run (triggered by the stop_run callback) ghostscript is used to postprocess
> the pdf generated by lualatex. A bit if postscript code provides the fonts to
> ghostscript, the result is a final pdf that contains only one copy of every font
> used in all the included pdfs, not one copy per usage of \includegraphics.
> Often the mechanism pointed out above reduces file size by more than 80 percent.
> Unfortunately recent changes to ghostscript (commit 04a517f39cc) broke
> that mechanism, and it's not the first time that changes to gs broke my code.
> I'd prefer to have a lualatex (or pdflatex/xelatex) that would be able to detect
> usage of unembedded normal and CID fonts in included pdfs and to embed
> exactly one subsetted copy of all needed fonts in the output pdf.
> Is there already a solution somewhere in the bit bucket? 
> If not: Do you think it is possible to extend lua/xe/pdflatex with reasonable effort?
> Knut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20181218/b35aeb7c/attachment.html>

More information about the luatex mailing list