New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write operation prevents font kerning #598

Open
eg9 opened this Issue Jul 6, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@eg9

eg9 commented Jul 6, 2017

Consider the following example

\begin{filecontents*}{\jobname.bib}
  @Book{John,
    author = {John},
    title = {A Title},
  }
\end{filecontents*}

\documentclass{memoir}

\usepackage[style=authoryear]{biblatex}
\usepackage{Baskervaldx}

\addbibresource{\jobname.bib}

\showoutput

\begin{document}
(J)
\autocite{John}
\end{document}

The relevant part from the log file reveals

....\T1/Baskervaldx-TLF/m/n/10 (
....\kern1.62
....\T1/Baskervaldx-TLF/m/n/10 J
....\T1/Baskervaldx-TLF/m/n/10 )

for the (J) part, but

....\T1/Baskervaldx-TLF/m/n/10 (
....\write1{\abx@aux@page{1}{\the \c@page }}
....\T1/Baskervaldx-TLF/m/n/10 J

for the \autocite.

The \write operation prevents the font defined kerning. It should be performed before the parenthesis, which wouldn't change the reference (unless a break point is explicitly set before the name, which seems unlikely). The Baskervaldx font makes this necessity apparent, but other fonts might need a kerning between ( and some letter.

Reference: https://tex.stackexchange.com/questions/378565/avoiding-glyph-collision-with-baskervaldx-and-biblatex

@moewew

This comment has been minimized.

Show comment
Hide comment
@moewew

moewew Jul 7, 2017

Collaborator

I temporarily disabled the write, but still we don't get the kern. So I assume the problem is even more involved.

The log is

....\T1/Baskervaldx-TLF/m/n/10 (
....\kern1.62
....\T1/Baskervaldx-TLF/m/n/10 J
....\T1/Baskervaldx-TLF/m/n/10 )
....\glue 3.0 plus 1.49847 minus 1.00099
....\T1/Baskervaldx-TLF/m/n/10 a
....\T1/Baskervaldx-TLF/m/n/10 g
....\kern-0.12001
....\T1/Baskervaldx-TLF/m/n/10 a
....\T1/Baskervaldx-TLF/m/n/10 i
....\T1/Baskervaldx-TLF/m/n/10 n
....\T1/Baskervaldx-TLF/m/n/10 s
....\T1/Baskervaldx-TLF/m/n/10 t
....\glue 3.0 plus 1.49998 minus 1.0
....\T1/Baskervaldx-TLF/m/n/10 (
....\T1/Baskervaldx-TLF/m/n/10 J
....\T1/Baskervaldx-TLF/m/n/10 o
....\T1/Baskervaldx-TLF/m/n/10 h
....\T1/Baskervaldx-TLF/m/n/10 n
....\glue 3.0 plus 1.49998 minus 1.0
....\T1/Baskervaldx-TLF/m/n/10 n
....\T1/Baskervaldx-TLF/m/n/10 .
....\T1/Baskervaldx-TLF/m/n/10 d
....\T1/Baskervaldx-TLF/m/n/10 .
....\T1/Baskervaldx-TLF/m/n/10 )

for

\documentclass{memoir}

\usepackage[style=authoryear]{biblatex}
\usepackage{Baskervaldx}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
  @Book{John,
    author = { John },
    title = {A Title},
  }
\end{filecontents*}

\addbibresource{\jobname.bib}

\makeatletter
\protected\def\blx@citeprint#1{%
  \blx@getrefcontext{#1}%
  \advance\c@citecount\@ne
  \addtocounter{instcount}\@ne
  \ifnum\c@citecount=\@ne
    \blx@getdata@cite{#1}%
    \blx@precode
    \ifnum\c@citetotal>\@ne
      \blx@resetdata
    \fi
  \else
    \blx@dlimcode
  \fi
  \begingroup
  \ifnum\c@citetotal>\@ne
    \blx@getdata@cite{#1}%
  \fi
  \blx@entrysetcount
  \blx@setoptions@type\abx@field@entrytype
  \blx@setoptions@entry
  \blx@backref{#1}%
  %\blx@pagetracker
  \csuse{blx@hook@citekey}%
  \csuse{blx@hook@citekey@next}%
  \blx@beglangcite
  \blx@execute
  \blx@loopcode
  \blx@citecounter
  \blx@citetracker
  \blx@ibidtracker
  \blx@idemtracker
  \blx@opcittracker
  \blx@loccittracker
  \ifnum\c@citecount=\c@citetotal
    \def\blx@thecheckpunct{\blx@err@nestcite\@gobble}%
    \blx@postcode
  \fi
  \blx@endlangcite
  \endgroup
  \let\blx@refcontext@context\blx@refcontext@context@saved}
\makeatother

\begin{document}
(j) (J) against \autocite{John}
\end{document}

which disables the \write

BTW: Which tracing settings produce this font trace and avoid most of the other noise?

Collaborator

moewew commented Jul 7, 2017

I temporarily disabled the write, but still we don't get the kern. So I assume the problem is even more involved.

The log is

....\T1/Baskervaldx-TLF/m/n/10 (
....\kern1.62
....\T1/Baskervaldx-TLF/m/n/10 J
....\T1/Baskervaldx-TLF/m/n/10 )
....\glue 3.0 plus 1.49847 minus 1.00099
....\T1/Baskervaldx-TLF/m/n/10 a
....\T1/Baskervaldx-TLF/m/n/10 g
....\kern-0.12001
....\T1/Baskervaldx-TLF/m/n/10 a
....\T1/Baskervaldx-TLF/m/n/10 i
....\T1/Baskervaldx-TLF/m/n/10 n
....\T1/Baskervaldx-TLF/m/n/10 s
....\T1/Baskervaldx-TLF/m/n/10 t
....\glue 3.0 plus 1.49998 minus 1.0
....\T1/Baskervaldx-TLF/m/n/10 (
....\T1/Baskervaldx-TLF/m/n/10 J
....\T1/Baskervaldx-TLF/m/n/10 o
....\T1/Baskervaldx-TLF/m/n/10 h
....\T1/Baskervaldx-TLF/m/n/10 n
....\glue 3.0 plus 1.49998 minus 1.0
....\T1/Baskervaldx-TLF/m/n/10 n
....\T1/Baskervaldx-TLF/m/n/10 .
....\T1/Baskervaldx-TLF/m/n/10 d
....\T1/Baskervaldx-TLF/m/n/10 .
....\T1/Baskervaldx-TLF/m/n/10 )

for

\documentclass{memoir}

\usepackage[style=authoryear]{biblatex}
\usepackage{Baskervaldx}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
  @Book{John,
    author = { John },
    title = {A Title},
  }
\end{filecontents*}

\addbibresource{\jobname.bib}

\makeatletter
\protected\def\blx@citeprint#1{%
  \blx@getrefcontext{#1}%
  \advance\c@citecount\@ne
  \addtocounter{instcount}\@ne
  \ifnum\c@citecount=\@ne
    \blx@getdata@cite{#1}%
    \blx@precode
    \ifnum\c@citetotal>\@ne
      \blx@resetdata
    \fi
  \else
    \blx@dlimcode
  \fi
  \begingroup
  \ifnum\c@citetotal>\@ne
    \blx@getdata@cite{#1}%
  \fi
  \blx@entrysetcount
  \blx@setoptions@type\abx@field@entrytype
  \blx@setoptions@entry
  \blx@backref{#1}%
  %\blx@pagetracker
  \csuse{blx@hook@citekey}%
  \csuse{blx@hook@citekey@next}%
  \blx@beglangcite
  \blx@execute
  \blx@loopcode
  \blx@citecounter
  \blx@citetracker
  \blx@ibidtracker
  \blx@idemtracker
  \blx@opcittracker
  \blx@loccittracker
  \ifnum\c@citecount=\c@citetotal
    \def\blx@thecheckpunct{\blx@err@nestcite\@gobble}%
    \blx@postcode
  \fi
  \blx@endlangcite
  \endgroup
  \let\blx@refcontext@context\blx@refcontext@context@saved}
\makeatother

\begin{document}
(j) (J) against \autocite{John}
\end{document}

which disables the \write

BTW: Which tracing settings produce this font trace and avoid most of the other noise?

@u-fischer

This comment has been minimized.

Show comment
Hide comment
@u-fischer

u-fischer Jul 7, 2017

If you add a J directly on the begin of the \blx@citeprint you can see that the kerning is already destroyed before. And by adding parentheses and J in various places of the definition it is obvious that there are more kerning destroying commands in it. This is no wonder as a simple assignment or definition (and a \relax) already hinders kerning:


\documentclass{memoir}

\usepackage{Baskervaldx}

\begin{document}
\makeatletter
(j) (J) (\c@section=2 J) (\def\test{blub}J)

\end{document}

kerning-biblatex

So the only chance to get this working is to move the printing of the parenthese inside the loopcode directly before the first cite.

u-fischer commented Jul 7, 2017

If you add a J directly on the begin of the \blx@citeprint you can see that the kerning is already destroyed before. And by adding parentheses and J in various places of the definition it is obvious that there are more kerning destroying commands in it. This is no wonder as a simple assignment or definition (and a \relax) already hinders kerning:


\documentclass{memoir}

\usepackage{Baskervaldx}

\begin{document}
\makeatletter
(j) (J) (\c@section=2 J) (\def\test{blub}J)

\end{document}

kerning-biblatex

So the only chance to get this working is to move the printing of the parenthese inside the loopcode directly before the first cite.

@moewew

This comment has been minimized.

Show comment
Hide comment
@moewew

moewew Jul 7, 2017

Collaborator

It's even worse than that. Not even

\DeclareCiteCommand{\parencite}
  {\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   (\usebibmacro{cite})}
  {\multicitedelim}
  {\usebibmacro{postnote}}

gives good kerning. (Of course that messes up the brackets around pre and postnotes.)

Collaborator

moewew commented Jul 7, 2017

It's even worse than that. Not even

\DeclareCiteCommand{\parencite}
  {\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   (\usebibmacro{cite})}
  {\multicitedelim}
  {\usebibmacro{postnote}}

gives good kerning. (Of course that messes up the brackets around pre and postnotes.)

@u-fischer

This comment has been minimized.

Show comment
Hide comment
@u-fischer

u-fischer Jul 7, 2017

The good news are: It works with lualatex.

u-fischer commented Jul 7, 2017

The good news are: It works with lualatex.

@plk

This comment has been minimized.

Show comment
Hide comment
@plk

plk Aug 8, 2017

Owner

If this now works with lualatex, I am tempted to close this because it seems far too much for a package to deal with - it seems like a more core problem.

Owner

plk commented Aug 8, 2017

If this now works with lualatex, I am tempted to close this because it seems far too much for a package to deal with - it seems like a more core problem.

@moewew moewew added the wontfix label Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment