Ticket #33552

A bug of luatexja-fontspec

Open Date: 2014-03-22 06:43 Last Update: 2014-03-27 21:44

Reporter:
Owner:
(None)
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
None

Details

After Running the following example, you will see that the font of test is not changed to \ttfamily.

  1. \documentclass{article}
  2. \usepackage{luatexja-fontspec}
  3. \begin{document}
  4. \ttfamily test
  5. \end{document}

It seems that this bug is caused by the redefinition of \fontfamily:

  1. %%%%%%%% Now we completely ignore kanjifont definition file.
  2. \DeclareRobustCommand\fontfamily[1]{%
  3. \@notkfamfalse\@notffamfalse
  4. \edef\tmp@item{'\luatexluaescapestring{#1}'}%
  5. \edef\tmp@enc{'\luatexluaescapestring{\f@encoding}'}%
  6. \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined
  7. \edef\k@family{#1}%
  8. \else\@notkfamtrue\fi
  9. \ifcsname \f@encoding+#1\endcsname
  10. \edef\f@family{#1}%
  11. \else % search font definition file...
  12. \directlua{luatexja.jfont.is_ffam(\tmp@enc, \tmp@item)}%
  13. \ifin@\edef\k@family{#1}\else%
  14. \directlua{luatexja.jfont.is_Nffam(\tmp@enc, \tmp@item)}%
  15. \ifin@\@notffamtrue\else%
  16. \def\@temp##1+{\lowercase{\def\@@temp{##1#1.fd}}}\expandafter\@temp\f@encoding+%
  17. \message{(I search kanjifont definition file: \@@temp)}%
  18. \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
  19. \if@tempswz
  20. \directlua{luatexja.jfont.add_ffam_list(\tmp@enc, \tmp@item)}%
  21. \edef\f@family{#1}%
  22. \else
  23. \directlua{luatexja.jfont.add_Nffam_list(\tmp@enc, \tmp@item)}%
  24. \@notffamtrue%
  25. \fi
  26. \fi
  27. \fi
  28. \fi
  29. \if@notkfam\if@notffam
  30. {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi
  31. \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}%
  32. {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi
  33. \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}%
  34. \fi\fi
  35. }

In line 19, {\@@temp#1.fd} should be \@@temp. I want to provide a little better patch which is fully consistent with the test in \try@load@fontshape.

\DeclareRobustCommand\fontfamily[1]{%
  \@notkfamfalse\@notffamfalse
  \edef\tmp@item{'\luatexluaescapestring{#1}'}%
  \edef\tmp@enc{'\luatexluaescapestring{\f@encoding}'}%
  \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined
    \edef\k@family{#1}%
  \else\@notkfamtrue\fi
  \ifcsname \f@encoding+#1\endcsname
    \edef\f@family{#1}%
  \else % search font definition file...
    \directlua{luatexja.jfont.is_ffam(\tmp@enc, \tmp@item)}%
    \ifin@\edef\k@family{#1}\else%
      \directlua{luatexja.jfont.is_Nffam(\tmp@enc, \tmp@item)}%
      \ifin@\@notffamtrue\else%
        \edef\@temp{\lowercase{\noexpand\IfFileExists{\f@encoding#1.fd}}}%
        \@temp{\@tempswztrue}%
          {\IfFileExists{\f@encoding#1.fd}{\@tempswztrue}{\@tempswzfalse}}%
        \if@tempswz
          \directlua{luatexja.jfont.add_ffam_list(\tmp@enc, \tmp@item)}%
   	  \edef\f@family{#1}%
        \else
          \directlua{luatexja.jfont.add_Nffam_list(\tmp@enc, \tmp@item)}%
	  \@notffamtrue%
        \fi
      \fi
    \fi
  \fi
  \if@notkfam\if@notffam
      {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi
        \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}%
      {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi
        \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}%
  \fi\fi
}

Ticket History (3/4 Histories)

2014-03-22 06:43 Updated by: qinglee
  • New Ticket "A bug of luatexja-fontspec" created
2014-03-22 09:47 Updated by: h7k
Comment

In line 19, {\@@temp#1.fd} should be \@@temp.

This is already fixed in the git repository (6025952 and 124db59), but we forgot to release the bugfix. Thanks.

2014-03-24 09:42 Updated by: h7k
  • Resolution Update from None to Fixed
2014-03-27 21:44 Updated by: qinglee
  • Status Update from Open to Closed
  • Ticket Close date is changed to 2014-03-27 21:44

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login