4

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?

1 Answer 1

6

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}
5
  • 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. Apr 12, 2019 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. Apr 12, 2019 at 14:44
  • oh, I see. Would you please to recommend some font editor? Apr 13, 2019 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. Apr 13, 2019 at 4:58
  • O'K, I accepted your answer! Thanks again for explanations. Apr 14, 2019 at 10:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .