Font substitution in PDF SVGs?


Nicholas Mucks
 

Hi!
For HTML we run an ANT target against the output directory to replace certain strings in all svgs with another string. It’s just one older font name to another.

What’s the best way to accomplish this task in PDF? We notice that the topic.fo file references the source file locations, not temp or output locations. In testing we modified our ANT target to use the source folder instead of the output folder and although it works we don’t want to edit the source files.



Take care,
- Nick

Sent from mobile


Radu Coravu
 

Hi Nick,

Besides fixing up the problem in the original SVGs, probably you need an Ant task to copy the original SVGs to some temporary files folder, modify them there and with XSLT replace the references to the SVGs in the topic.fo so that they refer to the temporary modified files.

You can also embed SVG directly inside the topic.fo file:

https://xmlgraphics.apache.org/fop/dev/fo/embedding.fo.pdf

so with an XSLT stage, for each image reference you could replace it with the embedded SVG content, content which could also be modified.

Regards,
Radu

Radu Coravu
Oxygen XML Editor

On 7/9/21 02:01, Nicholas Mucks via groups.io wrote:
Hi!
For HTML we run an ANT target against the output directory to replace certain strings in all svgs with another string. It’s just one older font name to another.

What’s the best way to accomplish this task in PDF? We notice that the topic.fo file references the source file locations, not temp or output locations. In testing we modified our ANT target to use the source folder instead of the output folder and although it works we don’t want to edit the source files.



Take care,
- Nick

Sent from mobile




Nicholas Mucks
 

Hi Radu,
Thank you! We’ll experiment with these approaches for handling SVG edits in the PDF output.

Take care,
- Nick

Sent from mobile

On Jul 8, 2021, at 9:42 PM, Radu Coravu <radu_coravu@sync.ro> wrote:

Hi Nick,

Besides fixing up the problem in the original SVGs, probably you need an Ant task to copy the original SVGs to some temporary files folder, modify them there and with XSLT replace the references to the SVGs in the topic.fo so that they refer to the temporary modified files.

You can also embed SVG directly inside the topic.fo file:

https://xmlgraphics.apache.org/fop/dev/fo/embedding.fo.pdf

so with an XSLT stage, for each image reference you could replace it with the embedded SVG content, content which could also be modified.

Regards,
Radu

Radu Coravu
Oxygen XML Editor

On 7/9/21 02:01, Nicholas Mucks via groups.io wrote:
Hi!
For HTML we run an ANT target against the output directory to replace certain strings in all svgs with another string. It’s just one older font name to another.

What’s the best way to accomplish this task in PDF? We notice that the topic.fo file references the source file locations, not temp or output locations. In testing we modified our ANT target to use the source folder instead of the output folder and although it works we don’t want to edit the source files.



Take care,
- Nick

Sent from mobile







glenn emerson
 

Depending on what editor you use to create your SVGs you may be able to solve your font problems during SVG creation.

Windows comes with a few fonts that are licensed for embedding. When you create a PDF and preserve the exact appearance of your original document, this is done by embedding the font or a subset in the output PDF.

The same is happening with those SVGs in your PDF. Antenna House and RenderX respect font licenses. They look at the license bit on the font file to see if it is enabled for embedding.

With Windows, I believe that TrueType (now OpenType) fonts Arial, Calibri, Courier New, and Times New Roman can all be embedded without a license purchase.

So if you use one of those fonts in your SVGs at creation, you will not have substitution problems on the FO rendering to PDF.

A further note: Adobe Illustrator used to default to postscript fonts—Arial.ps1 instead of Arial.ttf
So it was imperative to change the default settings for new files in Illustrator to use a licensed TTF font.

If you want to purchase a font for embedding (they are software, after all), you can go to several online type foundries. If you start with the Microsoft Typography site, you can get a more detailed explanation of how font licensing works and there are many fonts there to choose from.

__________________________
Glenn Emerson
gemerso1@icloud.com
584-732-6984

On Jul 9, 2021, at 8:28 AM, Nicholas Mucks via groups.io <urbanrobots=yahoo.com@groups.io> wrote:

Hi Radu,
Thank you! We’ll experiment with these approaches for handling SVG edits in the PDF output.

Take care,
- Nick

Sent from mobile

On Jul 8, 2021, at 9:42 PM, Radu Coravu <radu_coravu@sync.ro> wrote:

Hi Nick,

Besides fixing up the problem in the original SVGs, probably you need an Ant task to copy the original SVGs to some temporary files folder, modify them there and with XSLT replace the references to the SVGs in the topic.fo so that they refer to the temporary modified files.

You can also embed SVG directly inside the topic.fo file:

https://xmlgraphics.apache.org/fop/dev/fo/embedding.fo.pdf

so with an XSLT stage, for each image reference you could replace it with the embedded SVG content, content which could also be modified.

Regards,
Radu

Radu Coravu
Oxygen XML Editor

On 7/9/21 02:01, Nicholas Mucks via groups.io wrote:
Hi!
For HTML we run an ANT target against the output directory to replace certain strings in all svgs with another string. It’s just one older font name to another.

What’s the best way to accomplish this task in PDF? We notice that the topic.fo file references the source file locations, not temp or output locations. In testing we modified our ANT target to use the source folder instead of the output folder and although it works we don’t want to edit the source files.



Take care,
- Nick

Sent from mobile











Nicholas Mucks
 

Hi Glenn,
Thanks! This is also good information.

Take care,
- Nick

Sent from mobile

On Jul 9, 2021, at 6:59 AM, glenn emerson via groups.io <gemerso1=icloud.com@groups.io> wrote:

Depending on what editor you use to create your SVGs you may be able to solve your font problems during SVG creation.

Windows comes with a few fonts that are licensed for embedding. When you create a PDF and preserve the exact appearance of your original document, this is done by embedding the font or a subset in the output PDF.

The same is happening with those SVGs in your PDF. Antenna House and RenderX respect font licenses. They look at the license bit on the font file to see if it is enabled for embedding.

With Windows, I believe that TrueType (now OpenType) fonts Arial, Calibri, Courier New, and Times New Roman can all be embedded without a license purchase.

So if you use one of those fonts in your SVGs at creation, you will not have substitution problems on the FO rendering to PDF.

A further note: Adobe Illustrator used to default to postscript fonts—Arial.ps1 instead of Arial.ttf
So it was imperative to change the default settings for new files in Illustrator to use a licensed TTF font.

If you want to purchase a font for embedding (they are software, after all), you can go to several online type foundries. If you start with the Microsoft Typography site, you can get a more detailed explanation of how font licensing works and there are many fonts there to choose from.

__________________________
Glenn Emerson
gemerso1@icloud.com
584-732-6984
On Jul 9, 2021, at 8:28 AM, Nicholas Mucks via groups.io <urbanrobots=yahoo.com@groups.io> wrote:

Hi Radu,
Thank you! We’ll experiment with these approaches for handling SVG edits in the PDF output.

Take care,
- Nick

Sent from mobile

On Jul 8, 2021, at 9:42 PM, Radu Coravu <radu_coravu@sync.ro> wrote:
Hi Nick,

Besides fixing up the problem in the original SVGs, probably you need an Ant task to copy the original SVGs to some temporary files folder, modify them there and with XSLT replace the references to the SVGs in the topic.fo so that they refer to the temporary modified files.

You can also embed SVG directly inside the topic.fo file:

https://xmlgraphics.apache.org/fop/dev/fo/embedding.fo.pdf

so with an XSLT stage, for each image reference you could replace it with the embedded SVG content, content which could also be modified.

Regards,
Radu

Radu Coravu
Oxygen XML Editor

On 7/9/21 02:01, Nicholas Mucks via groups.io wrote:
Hi!
For HTML we run an ANT target against the output directory to replace certain strings in all svgs with another string. It’s just one older font name to another.

What’s the best way to accomplish this task in PDF? We notice that the topic.fo file references the source file locations, not temp or output locations. In testing we modified our ANT target to use the source folder instead of the output folder and although it works we don’t want to edit the source files.



Take care,
- Nick

Sent from mobile