summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hyperxmp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-05-04 23:41:46 +0000
committerKarl Berry <karl@freefriends.org>2011-05-04 23:41:46 +0000
commit7ffadf39bd1a52617123fde2be7534b63fa288d8 (patch)
treed61b9368d6fbcdb98517b832be3c0b65326e2384 /Master/texmf-dist/tex/latex/hyperxmp
parent14d95336f017ddda9133f222255ce5b47271b781 (diff)
hyperxmp (3may11)
git-svn-id: svn://tug.org/texlive/trunk@22306 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hyperxmp')
-rw-r--r--Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty79
1 files changed, 53 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty
index 175df1bbfd0..19ea78638f9 100644
--- a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty
+++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty
@@ -22,10 +22,12 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{hyperxmp}
- [2011/04/17 v1.2 Store hyperref metadata in XMP format]
+ [2011/04/30 v1.3 Store hyperref metadata in XMP format]
\edef\hyxmp@dq@code{\the\catcode`\"}
\catcode`\"=12
\RequirePackage{keyval}
+\RequirePackage{pdfescape}
+\RequirePackage{stringenc}
\def\@pdfcopyright{}
\define@key{Hyp}{pdfcopyright}{\pdfstringdef\@pdfcopyright{#1}}
\def\@pdflicenseurl{}
@@ -34,33 +36,40 @@
\define@key{Hyp}{pdfauthortitle}{\pdfstringdef\@pdfauthortitle{#1}}
\def\@pdfcaptionwriter{}
\define@key{Hyp}{pdfcaptionwriter}{\pdfstringdef\@pdfcaptionwriter{#1}}
+\def\@pdfmetalang{}
+\define@key{Hyp}{pdfmetalang}{\pdfstringdef\@pdfmetalang{#1}}
\newcommand*{\hyxmp@find@metadata}{%
- \ifx\@pdfauthor\@empty
- \ifx\@pdfcopyright\@empty
- \ifx\@pdfkeywords\@empty
- \ifx\@pdflicenseurl\@empty
- \ifx\@pdfauthortitle\@empty
- \ifx\@pdfcaptionwriter\@empty
- \ifx\@pdfsubject\@empty
- \ifx\@pdftitle\@empty
- \PackageWarningNoLine{hyperxmp}{%
+ \edef\hyxmp@concated@metadata{%
+ \@pdfauthor
+ \@pdfauthortitle
+ \@pdfcaptionwriter
+ \@pdfcopyright
+ \@pdfkeywords
+ \@pdflicenseurl
+ \@pdfsubject
+ \@pdftitle
+ }%
+ \ifx\hyxmp@concated@metadata\@empty
+ \PackageWarningNoLine{hyperxmp}{%
\jobname.tex did not specify any metadata to\MessageBreak
include in the XMP packet.\space\space Please see the hyperxmp\MessageBreak
documentation for instructions on how to provide\MessageBreak
-metadata values to hyperxmp%
- }%
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
+metadata values to hyperxmp}%
\fi
}
\AtBeginDocument{%
\@ifpackageloaded{hyperref}%
{%
+ \ifx\@pdfmetalang\@empty
+ \ifx\@pdflang\@empty
+ \def\@pdfmetalang{x-default}%
+ \else
+ \edef\@pdfmetalang{\@pdflang}%
+ \fi
+ \fi
+ \ifHy@unicode
+ \hyxmp@reencode\@pdfmetalang
+ \fi
\AtEndDocument{%
\hyxmp@find@metadata
\hyxmp@embed@packet
@@ -116,9 +125,23 @@ disabled}%
\def\hyxmp@trimb#1 Q{\hyxmp@trimc#1Q}
\def\hyxmp@trimc#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1}
\catcode`\Q=11
+\newcommand*{\hyxmp@reencode}[1]{%
+ \EdefUnescapeString\hyxmp@reencoded{#1}%
+ \StringEncodingConvert\hyxmp@reencoded\hyxmp@reencoded{utf16be}{pdfdoc}%
+ \StringEncodingSuccessFailure{%
+ \global\let\hyxmp@reencoded=\hyxmp@reencoded
+ }{%
+ \gdef\hyxmp@reencoded{#1}%
+ }%
+ \edef#1{\hyxmp@reencoded}%
+}
\newcommand*{\hyxmp@xmlify}[1]{%
\gdef\hyxmp@xmlified{}%
- \expandafter\hyxmp@xmlify@i#1\@empty
+ \edef\hyxmp@text{#1}%
+ \ifHy@unicode
+ \hyxmp@reencode\hyxmp@text
+ \fi
+ \expandafter\hyxmp@xmlify@i\hyxmp@text\@empty
\@ifundefined{pdfmark}{}{%
\expandafter\hyxmp@obscure@spaces\expandafter{\hyxmp@xmlified}%
}%
@@ -362,7 +385,7 @@ ______</rdf:Description>^^J%
\hyxmp@add@to@xml{%
_________<dc:#1>^^J%
____________<rdf:Alt>^^J%
-_______________<rdf:li xml:lang="x-default">\hyxmp@xmlified</rdf:li>^^J%
+_______________<rdf:li xml:lang="\@pdfmetalang">\hyxmp@xmlified</rdf:li>^^J%
____________</rdf:Alt>^^J%
_________</dc:#1>^^J%
}%
@@ -376,7 +399,11 @@ _________<dc:#1>^^J%
____________<rdf:#2>^^J%
}%
\bgroup
- \hyxmp@commas@to@list\hyxmp@list{#3}%
+ \edef\hyxmp@text{#3}%
+ \ifHy@unicode
+ \hyxmp@reencode\hyxmp@text
+ \fi
+ \hyxmp@commas@to@list\hyxmp@list{\hyxmp@text}%
\def\@elt##1{%
\hyxmp@xmlify{##1}%
\hyxmp@add@to@xml{%
@@ -432,8 +459,8 @@ ______</rdf:Description>^^J%
}%
}
\gdef\hyxmp@photoshop@schema{%
- \def\hyxmp@photoshop@data{\@pdfauthortitle\@pdfcaptionwriter}%
- \ifx\@hyxmp@photoshop@data\@empty
+ \edef\hyxmp@photoshop@data{\@pdfauthortitle\@pdfcaptionwriter}%
+ \ifx\hyxmp@photoshop@data\@empty
\else
\hyxmp@add@to@xml{%
______<rdf:Description rdf:about=""^^J%
@@ -454,7 +481,7 @@ _________<photoshop:AuthorsPosition>\hyxmp@xmlified</photoshop:AuthorsPosition>^
_________<photoshop:CaptionWriter>\hyxmp@xmlified</photoshop:CaptionWriter>^^J%
}%
\fi
- \ifx\@hyxmp@photoshop@data\@empty
+ \ifx\hyxmp@photoshop@data\@empty
\else
\hyxmp@add@to@xml{%
______</rdf:Description>^^J%
@@ -544,7 +571,7 @@ ___</rdf:RDF>^^J%
Raw={\string{hyxmp@Metadata\string}}%
}%
\pdfmark{%
- pdfmark=/PUT,
+ pdfmark=/Metadata,
Raw={\string{Catalog\string}%
<<
/Metadata \string{hyxmp@Metadata\string}%