3

I have below warning in LuaLaTeX/ltjsarticle project:

Package fontspec Warning: Font "fonts/HGS_Mincho/HGRMB.ttc" does not contain
requested Script "CJK".

I dot't know about Chinese and Korean, but Japanese language displaying correctly:

enter image description here

\documentclass[a4paper, twoside]{ltjsarticle}

\usepackage{luatexja-fontspec}

\edef\ProjectAbsolutePath{\directlua{tex.sprint((lfs.currentdir():gsub('\string\\', '/')))}/}

\setmainjfont[
  Path            = \ProjectAbsolutePath,
  UprightFont     = fonts/HGS_Mincho/HGRMB.ttc,
  BoldFont        = fonts/HGS_Mincho/HGRME.ttc,
  ItalicFont      = fonts/HGS_Mincho/HGRMB.ttc,
  BoldItalicFont  = fonts/HGS_Mincho/HGRME.ttc
]{HGS Mincho}

\setsansjfont[
  Path            = \ProjectAbsolutePath,
  UprightFont     = fonts/HGS_Gothic/HGRGM.ttc,
  BoldFont        = fonts/HGS_Gothic/HGRGE.ttc,
  ItalicFont      = fonts/HGS_Gothic/HGRGM.ttc,
  BoldItalicFont  = fonts/HGS_Gothic/HGRGE.ttc
]{HGS Gothic}


\begin{document}

\section{活字試験}

  \begin{itemize}
    \item 主要活字
    \begin{itemize}
      \item 漢あア
      \item \bfseries{漢あア}
    \end{itemize}
    \item ゴシック活字
    \begin{itemize}
      \item \textsf{漢あア}
      \item \textsf{\bfseries{漢あア}}
    \end{itemize}
  \end{itemize}
\end{document}

Why this warning appears and how I can correctly solve it?

4

You can manually specify the script with fontspec.

This should work (although I don't have the font to test).

\setmainjfont[
  Path            = \ProjectAbsolutePath,
  UprightFont     = fonts/HGS_Mincho/HGRMB.ttc,
  BoldFont        = fonts/HGS_Mincho/HGRME.ttc,
  ItalicFont      = fonts/HGS_Mincho/HGRMB.ttc,
  BoldItalicFont  = fonts/HGS_Mincho/HGRME.ttc,
  Script          = Default
]{HGS Mincho}

Update: Apparently, this font does not support a Default script either :(.

Therefore, the easiest option will be to suppress the warnings with fontspec. From §3.4 of the fontspec manual, passing quiet will put these warnings in the log file, and silent will suppress the warnings altogether.

\PassOptionsToPackage{quiet}{fontspec}% (or try silent)
\usepackage{luatexja-fontspec}
  • Thank you for the answer. Unfortunately, I got Package fontspec Warning: Font "fonts/HGS_Mincho/HGRMB.ttc" does not contain (fontspec) requested Script "Default". instead. – Gurebu Bokofu Apr 12 at 5:39
  • @GurebuBokofu, that's a pity. These are commercial fonts, right? Without opening them up in a font editor and seeing what is going on, I'm not sure what to try. – David Purton Apr 12 at 14:44
  • oh, I see. Would you please to recommend some font editor? – Gurebu Bokofu Apr 13 at 1:26
  • @GurebuBokofu, fontforge is the tool of choice in the Open Source world. It is also possible to suppress just fontspec warnings by either passing quiet or silent to fontspec. I'll make a note of this in my answer. – David Purton Apr 13 at 4:58
  • O'K, I accepted your answer! Thanks again for explanations. – Gurebu Bokofu Apr 14 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.