Open lenoleno opened 1 year ago
Here's the LaTeX source file. Save as bug-pdfa.tex
.
Thank you, Microsoft, for banning .tex
files from GitHub!
\documentclass[a4paper]{article}
\usepackage[a-1b]{pdfx}
\usepackage{fontspec}
\setmainfont[
% All OTF fonts fail PDF/A validation.
%
% Paths from Ubuntu package fonts-fantasque-sans:
% Extension = .otf, Path=/usr/share/fonts/opentype/fantasque-sans/LargeLineHeight/OTF/,
% Extension = .otf, Path=/usr/share/fonts/opentype/fantasque-sans/LargeLineHeight-NoLoopK/OTF/,
Extension = .otf, Path=/usr/share/fonts/opentype/fantasque-sans/Normal/OTF/,
% Extension = .otf, Path=/usr/share/fonts/opentype/fantasque-sans/NoLoopK/OTF/,
% Local paths:
% Extension = .otf, Path=../Variants/LargeLineHeight/OTF/,
% Extension = .otf, Path=../Variants/LargeLineHeight-NoLoopK/OTF/,
% Extension = .otf, Path=../Variants/Normal/OTF/,
% Extension = .otf, Path=../Variants/NoLoopK/OTF/,
%
% All TTF fonts pass PDF/A validation.
%
% Paths from Ubuntu package fonts-fantasque-sans:
% Extension = .ttf, Path=/usr/share/fonts/truetype/fantasque-sans/LargeLineHeight/TTF/,
% Extension = .ttf, Path=/usr/share/fonts/truetype/fantasque-sans/LargeLineHeight-NoLoopK/TTF/,
% Extension = .ttf, Path=/usr/share/fonts/truetype/fantasque-sans/Normal/TTF/,
% Extension = .ttf, Path=/usr/share/fonts/truetype/fantasque-sans/NoLoopK/TTF/,
% Local paths:
% Extension = .ttf, Path=../Variants/LargeLineHeight/TTF/,
% Extension = .ttf, Path=../Variants/LargeLineHeight-NoLoopK/TTF/,
% Extension = .ttf, Path=../Variants/Normal/TTF/,
% Extension = .ttf, Path=../Variants/NoLoopK/TTF/,
%
UprightFont = *-Regular,
ItalicFont = *-Italic,
BoldFont = *-Bold,
BoldItalicFont = *-BoldItalic,
]{Fantasque Sans Mono}
\begin{document}
text
\end{document}
As shown in the .tex
file, with LuaLaTeX (or the LaTeX fontspec package), one can determine which font format to use and the exact path from which to take font files.
The situation becomes worse when using GUI text processors, like LibreOffice, where you have hard time directing the application what font file to pick if more than one files exist with the same font name.
One workaround is manually removing all OTF files after installation of Ubuntu package fonts-fantasque-sans
. Which requires administrator privileges and knowledge about system font installation paths and may not be a smooth task for Joe Average.
Compiling a LaTeX document using Fantasque Sans Mono font with the LuaLaTeX engine, the output fails PDF/A validation with the veraPDF software when using (any of the) OTF font variants in the LaTeX document. It works using (any of the) TTF font variants, though.
Symptom:
veraPDF seems to complain about inconsistent font metrics (see last line):
System:
Steps to reproduce:
Install TeXLive: The attached LaTeX document uses the LuaLaTeX engine and package pdfx to output PDF/A compliant files. Make sure, the following Ubuntu packages are installed (plus additional dependencies):
texlive-latex-base
texlive-luatex
texlive-latex-recommended
texlive-latex-extra
Be warned that total installation size may be more than 500 MB!
Install Java Runtime: E.g. via command
apt install openjdk-11-jre
.Install the free PDF validation software veraPDF (requires Java):
Download installation package from here.
Note, there are two flavours of the veraPDF validation engine, greenfield (gf) and pdfbox. Stick to the greenfield flavour, which is the more recent one.
Unzip the downloaded veraPDF ZIP archive.
Run the extracted
verapdf-install
script in a terminal.Follow the installation procedure. (Install veraPDF into any user-writable directory, e.g.,
$HOME/veraPDF-<version>-gf/
. Uninstallation is as easy as removing the installation directory. Default installation "packs" selection is OK.)Compile the attached LaTeX document:
E.g., via command
Note, at the end of terminal output, the actual paths font files where taken from are shown, e.g.:
Validate PDF/A conformance:
Note, the
--format text
option only shows aFAIL
orPASS
message. To see the actual error message, try with different--format
option arguments (seeverapdf --help
) or use theverapdf-gui
programme (from the veraPDF installation directory), which lets you easily open a HTML report in the browser.Repeat the last two steps with varying
Path
arguments in the.tex
source file. The.tex
file contains 16 alternativeExtension/Path
argument lines for the four OTF font variants, four TTF font variants (all picked-up from a system-wide installation), and then the same eight font variants picked-up from the local repository. Please runmake all
in the top-level repository directory first, if you want to try the latter. Adjust allPath
arguments in the.tex
source file as needed.Note, for repeated tests on the shell, I use the following invocation:
which just extracts font paths from LaTeX terminal output and does PDF/A validation in one go. For this to work, I actually have a link from the
verapdf
binary to$HOME/bin/verapdf
. But you can as well apply the full path to yourverapdf
binary in the command.Can anyone reproduce this?