diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf | bin | 1520844 -> 1525551 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx | 98 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty | 44 |
3 files changed, 112 insertions, 30 deletions
diff --git a/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf b/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf Binary files differindex 713d57a2b63..23e5ed9f76f 100644 --- a/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf +++ b/Master/texmf-dist/doc/latex/hyperxmp/hyperxmp.pdf diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx index 08e6d2fab8c..eab2cc39405 100644 --- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx +++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx @@ -22,7 +22,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{hyperxmp} %<*package> - [2020/09/24 v5.5 Store hyperref metadata in XMP format] + [2020/10/05 v5.6 Store hyperref metadata in XMP format] %</package> % %<*driver> @@ -116,7 +116,7 @@ %</driver> % \fi % -% \CheckSum{2804} +% \CheckSum{2826} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -191,6 +191,10 @@ % \protect\cs{AtEndPreamble}, as is done by % \protect\pkgname{doclicense}~v2.2.0. Thanks to Tommaso Pecorella % for the bug report and help testing} +% \changes{v5.6}{2020/10/05}{Make conditional the loading of the +% \protect\pkgname{ifdraft} package. Thanks to Tobias Pape for +% reporting the incompatibility between \protect\pkgname{hyperxmp} and +% \protect\pkgname{ifdraft}} % % ^^A \GetFileInfo{hyperxmp.dtx} % @@ -1612,6 +1616,28 @@ % \pkgname{hyperxmp}. Read this section only if you want to learn how % \pkgname{hyperxmp} is implemented. % +% \bigskip +% +% One thing to bear in mind when reading the \pkgname{hyperxmp} source +% code is that different actions occur at different times throughout +% document processing: +% +% \begin{enumerate} +% \item |\usepackage{hyperxmp}|: \pkgname{hyperxmp} parses package +% options, defines a number of commands, loads various helper +% packages, and assigns default values to most \acro{XMP} fields. +% +% \item |\begin{document}|: \pkgname{hyperxmp} loads certain packages +% such as \pkgname{hyperref} and \pkgname{ifdraft} and queries +% natural-language information from \pkgname{babel} and +% \pkgname{polyglossia} that becomes available only at the end of +% the preamble. +% +% \item |\end{document}|: \pkgname{hyperxmp} finalizes certain data +% that are known only at the end of the document, such as the page +% count, and writes the \acro{XMP} packet to the \acro{PDF} file. +% \end{enumerate} +% % \iffalse %<*package> % \fi @@ -2101,16 +2127,32 @@ % \end{macro} % % \begin{macro}{\ifdraft} +% \begin{macro}{\next} % Use the \pkgname{ifdraft} package to determine if this is a draft or -% final document. +% final document. The challenge here is that we want to use +% \pkgname{ifdraft} if it's already loaded, load it if not, and not +% break any incompatible, author-defined \cs{ifdraft} macros that may +% occur either before or after the |\usepackage{hyperxmp}|. Our +% solution begins by defining a new group. Then, if \pkgname{ifdraft} +% is not yet loaded, we locally undefine \cs{ifdraft} and load the +% package. In this case, we later ``unload'' the package by setting +% \cs{ver@ifdraft.sty} to \cs{relax}. % \changes{v5.2}{2020/04/18}{Define \protect\cs{ifdraft} only locally, at % Niklas Beisert's request} % \begin{macrocode} \begingroup -\let\ifdraft=\relax -\RequirePackage{ifdraft} + \@ifpackageloaded{ifdraft}{% + \let\next=\relax + }{% + \let\ifdraft=\relax + \RequirePackage{ifdraft}% + \def\next{% + \expandafter\global\expandafter\let\csname ver@ifdraft.sty\endcsname=\relax + }% + }% % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@pdfrendition} % \changes{v5.0}{2020/02/27}{Added the \protect\optname{pdfrendition} @@ -2121,11 +2163,12 @@ % |\documentclass[draft]|, for which |\@pdfrendition| defaults to % |draft|. % \begin{macrocode} -\ifdraft{% - \gdef\@pdfrendition{draft}% -}{% - \gdef\@pdfrendition{default}% -} + \ifdraft{% + \gdef\@pdfrendition{draft}% + }{% + \gdef\@pdfrendition{default}% + } + \next \endgroup \define@key{Hyp}{pdfrendition}{\hyxmp@pdfstringdef\@pdfrendition{#1}} % \end{macrocode} @@ -5988,8 +6031,27 @@ ______</Iptc4xmpCore:CreatorContactInfo>^^J% % \end{macrocode} % \end{macro} % +% \begin{macro}{\hyxmp@prot@us} +% Define an underscore character that's protected from being converted +% into a space when passed to \cs{hyxmp@add@to@xml}. \cs{hyxmp@prot@us} +% is used within |write_xmp_font_list| (below) in particular to typeset +% filenames that may contain underscores. +% \begin{macrocode} +\bgroup + \catcode`\_=11 + \gdef\hyxmp@prot@us{_}% +\egroup +% \end{macrocode} +% \end{macro} +% % Here we define a Lua\index{Lua} function, |write_xmp_font_list|, that % writes font information to the \acro{XMP} packet. +% \changes{v5.6}{2020/10/02}{Make \protect\texttt{write\_xmp\_font\_list} +% robust to fonts loaded using +% \protect\href{https://en.wikipedia.org/wiki/HarfBuzz}{HarfBuzz}. +% Thanks to John Lienhard for the bug report} +% \changes{v5.6}{2020/10/02}{Don't inadvertently replace underscores in +% filenames when writing font-related metadata} % \begin{macrocode} \ifLuaTeX \begin{luacode*} @@ -6001,8 +6063,9 @@ function write_xmp_font_list (cct) local xml = string.gsub(val, "&", "&") xml = string.gsub(xml, "<", "<") xml = string.gsub(xml, ">", ">") + xml = string.gsub(xml, "_", "\\hyxmp@prot@us ") tex.print(cct, "____________<stFnt:" .. name .. ">" .. - val .. "</stFnt:" .. name .. ">^^J%") + xml .. "</stFnt:" .. name .. ">^^J%") return end end @@ -6013,11 +6076,14 @@ function write_xmp_font_list (cct) for i, f in font.each() do tex.print(cct, "__________<rdf:li rdf:parseType=\"Resource\">^^J%") if f.filename then - local info = fontloader.info(f.filename) - show_field("fontFace", info.fullname) - show_field("fontFamily", info.familyname) - show_field("fontName", info.fontname) - show_field("versionString", info.version) + local fname = string.gsub(f.filename, "^harfloaded:(.*)", "%1") + local info = fontloader.info(fname) + if info then + show_field("fontFace", info.fullname) + show_field("fontFamily", info.familyname) + show_field("fontName", info.fontname) + show_field("versionString", info.version) + end local baseName = string.gsub(f.filename, ".*[/\\](.*)", "%1") show_field("fontFileName", baseName) else diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty index 87a0f265a8b..0bec03894dd 100644 --- a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty +++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{hyperxmp} - [2020/09/24 v5.5 Store hyperref metadata in XMP format] + [2020/10/05 v5.6 Store hyperref metadata in XMP format] \edef\hyxmp@dq@code{\the\catcode`\"} \catcode`\"=12 \@ifundefined{AtEndDocument}{% @@ -156,13 +156,21 @@ \def\@pdfversionid{1} \define@key{Hyp}{pdfversionid}{\hyxmp@pdfstringdef\@pdfversionid{#1}} \begingroup -\let\ifdraft=\relax -\RequirePackage{ifdraft} -\ifdraft{% - \gdef\@pdfrendition{draft}% -}{% - \gdef\@pdfrendition{default}% -} + \@ifpackageloaded{ifdraft}{% + \let\next=\relax + }{% + \let\ifdraft=\relax + \RequirePackage{ifdraft}% + \def\next{% + \expandafter\global\expandafter\let\csname ver@ifdraft.sty\endcsname=\relax + }% + }% + \ifdraft{% + \gdef\@pdfrendition{draft}% + }{% + \gdef\@pdfrendition{default}% + } + \next \endgroup \define@key{Hyp}{pdfrendition}{\hyxmp@pdfstringdef\@pdfrendition{#1}} \def\@pdfpublication{} @@ -1593,6 +1601,10 @@ ______</Iptc4xmpCore:CreatorContactInfo>^^J% \newcatcodetable\hyxmp@cct \savecatcodetable\hyxmp@cct \fi +\bgroup + \catcode`\_=11 + \gdef\hyxmp@prot@us{_}% +\egroup \ifLuaTeX \begin{luacode*} function write_xmp_font_list (cct) @@ -1603,8 +1615,9 @@ function write_xmp_font_list (cct) local xml = string.gsub(val, "&", "&") xml = string.gsub(xml, "<", "<") xml = string.gsub(xml, ">", ">") + xml = string.gsub(xml, "_", "\\hyxmp@prot@us ") tex.print(cct, "____________<stFnt:" .. name .. ">" .. - val .. "</stFnt:" .. name .. ">^^J%") + xml .. "</stFnt:" .. name .. ">^^J%") return end end @@ -1615,11 +1628,14 @@ function write_xmp_font_list (cct) for i, f in font.each() do tex.print(cct, "__________<rdf:li rdf:parseType=\"Resource\">^^J%") if f.filename then - local info = fontloader.info(f.filename) - show_field("fontFace", info.fullname) - show_field("fontFamily", info.familyname) - show_field("fontName", info.fontname) - show_field("versionString", info.version) + local fname = string.gsub(f.filename, "^harfloaded:(.*)", "%1") + local info = fontloader.info(fname) + if info then + show_field("fontFace", info.fullname) + show_field("fontFamily", info.familyname) + show_field("fontName", info.fontname) + show_field("versionString", info.version) + end local baseName = string.gsub(f.filename, ".*[/\\](.*)", "%1") show_field("fontFileName", baseName) else |