1

I recently noticed that when using the \usepackage{comicsans} package in Windows 10, by default, all characters turn into squares. After a bit research, it was due to the fact that COMIC.ttf is no longer supported(included) in windows system????

A bit of shocking news. But then I manually downloaded and installed the font. However, when I use \textbf{text}, the characters wrapped inside still cannot be displayed correctly, as shown below.

Is there a way to solve it once for all?

Thanks.

enter image description here

\documentclass[a4paper,12pt]{article}

\usepackage{amsmath,amsfonts}
\usepackage{comicsans}
%\usepackage[T1]{fontenc}
%\usepackage[math]{iwona} %nice font
\usepackage[top=1cm,bottom=2cm,left=1cm,right=1cm]{geometry}

\usepackage{enumerate}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clears the header and footer
%\fancyhead[C]{\textbf{FE5116}}
\fancyfoot[L]{Page \thepage\ of \pageref{LastPage}}

\renewcommand{\headrulewidth}{0pt}

\begin{document}

\begin{center}
\textbf{Equation of a straight line}
\end{center}

\begin{minipage}[t]{0.55\textwidth}

In mathematics we are almost obsessed with finding the equations of straight lines. There are different ways of doing this, but the best way is to use the equation:
\[
    y-y_1 = m(x-x_1),
\]
where $m$ is the gradient of the line and $(x_1,y_1)$ is the coordinates of a point on the line. \\

So, using this equation, find the equation of the following lines, giving your answer in the form
\[
    ax+by+c = 0,
\]
where $a,b,c$ are integers (whole numbers -- no fractions).
\end{minipage}
%
\begin{minipage}[t]{0.4\textwidth}
%
\end{minipage}



%% new command %%
\newcommand*{\myQues}[1]{%
\item #1 \\
    \vfill
    \hfill $\rule{6cm}{0.3mm}$ \quad (3)
}%

\begin{enumerate}[1)]
    \myQues{The line with gradient $4$ that passes through $(1,3)$.}
    \myQues{The line with gradient $2$ that passes through $(6,2)$.}
    \cleardoublepage
    \myQues{The line with gradient $1$ that passes through $(2,-3)$.}
    \myQues{The line with gradient $10$ that passes through $(-4,-6)$.}
    \cleardoublepage
    \myQues{The line with gradient $-2$ that passes through $(4,1)$.}
    \myQues{The line with gradient $-3$ that passes through $(-2,-5)$.}
\end{enumerate}

%\end{document}


\cleardoublepage
Now, what happens if the gradient is a fraction? We still want our final answer to consist of integers -- so no fractions \ldots

\begin{enumerate}[1)]
\setcounter{enumi}{6}
\myQues{The line with gradient $\frac{1}{2}$ that passes through $(5,2)$.}
\myQues{The line with gradient $\frac{2}{3}$ that passes through $(6,1)$.}
\cleardoublepage
\myQues{The line with gradient $\frac{3}{4}$ that passes through $(2,-2)$.}
\myQues{The line with gradient $-\frac{1}{5}$ that passes through $(-2,4)$.}
\cleardoublepage
\myQues{The line with gradient $3$ that passes through $(\frac{1}{3},4)$.}
\myQues{The line with gradient $-2$ that passes through $(-\frac{1}{4},-\frac{2}{9})$.}
\end{enumerate}

\end{document}
Davislor
  • 44,045
CasperYC
  • 683
  • Did you also install Comic Sans Bold? – Davislor Feb 02 '19 at 04:36
  • @Davislor No, I did not. Honestly I did not expect such a problem (from MS). I don't see any point of removing a font and WHY? It's also not easy to find/download from the internet. I spend 10 minutes looking for it. What's the file name for the Bold font? Or do you know a place I can download them from? Thanks. – CasperYC Feb 02 '19 at 04:53
  • The list of filenames is here. It should be included with Windows 10. Try loading it with fontspec. – Davislor Feb 02 '19 at 04:56
  • On an OS other than Windows or OS X, or if for some reason they’re missing (check with fc-list), you can download an older version using MS Core Fonts for the Web. – Davislor Feb 02 '19 at 04:59
  • @Davislor Weirdly, I don't think they are! It's not the first time I realised it. I had problems in both Win10 1083 and 1809 versions. – CasperYC Feb 02 '19 at 05:00
  • @Davislor Now I can confirm that I have the comicbd.ttf, but the characters are still squares ... – CasperYC Feb 02 '19 at 05:06
  • First, try running updmap-sys, mktexlsr and fc-cache (if using TeX Live). Also delete your .aux files. Then try again. – Davislor Feb 02 '19 at 05:09
  • @Davislor Tried all. Not sure if this is a font issue any more. See updated screenshot from Adobe on font information for the PDF file, if that gives any clue? – CasperYC Feb 02 '19 at 05:21
  • Since you’re using Type 1 versions of the font on PDFLaTeX, you need to regenerate the .pfb files according to the instructions in the package manual now that the fonts are installed. – Davislor Feb 02 '19 at 05:23
  • @Davislor hmmmm, never had any problem when using Windows 7. Thanks. Will explore more now. – CasperYC Feb 02 '19 at 05:24
  • However, all of this will be simpler and work better (like support for Greek and italics and foreign languages and OpenType features) if you just switch to the modern toolchain with fontspec. – Davislor Feb 02 '19 at 05:24
  • The comicsans CTAN package does not include Type 1 versions of the font, for legal reasons, You need to install the TTF files, then generate the Type 1 font yourself. Since you didn’t have the bold font installed when you did it the first time, you need to do it a second time. – Davislor Feb 02 '19 at 05:26
  • @Davislor Comic sans MS was a "commercial" Microsoft font included with purchased products e.g. Office thus not included in native windows 10 –  Feb 02 '19 at 05:33
  • @KJO I had MS Office 2019 installed on the system, but didn't seem to have COMIC.ttf. Is that normal? – CasperYC Feb 02 '19 at 05:36
  • @CasperYC I’m seeing contradictory information: the font is on the Windows 10 font list, but Windows 10 is not on the list of products that ship with the font on this page – Davislor Feb 02 '19 at 05:59
  • @CasperYC I have the font on my Windows 10 machine, but I upgraded from Windows 7, which is on the list, so it might have come from there, or from my copy of Office. – Davislor Feb 02 '19 at 06:00
  • Ah, I think I found the explanation. – Davislor Feb 02 '19 at 06:07
  • Are you sure the fonts weren’t just deleted? In your browser history, did anyone visit Ban Comic Sans? ;) – Davislor Feb 02 '19 at 06:23
  • The package needs an update. It no longer works with current version of comic.ttf - the names in the encoding file are wrong (similar things happened e.g. with the winfonts package), see e.g. https://tex.stackexchange.com/a/339269/2388 – Ulrike Fischer Feb 02 '19 at 10:09
  • @Davislor For your information, I installed Win 10 1083 and 1089 version from a clean slate, together with MSO 2019. None of the combinations had/supported comic.ttf and displayed the characters as squares. – CasperYC Feb 02 '19 at 17:10
  • @CasperYC You say "I did not expect such a problem (from MS)". Why not, it comes provided with many problems? – Peter Wilson Feb 03 '19 at 18:44

1 Answers1

0

Thanks to UlrikeFischer, I’ve removed an inaccurate paragraph here. The package is out-of-date and incompatible with recent versions of Comic Sans MS.

You can try replacing the comicsans package with fontspec:

\usepackage{fontspec}
\defaultfontfeatures{Scale = MatchUppercase}
\setmainfont{Comic Sans MS}[Scale = 1.0]

If you also want to replace the math letters, you might load mathastext afterwards, or

\usepackage{unicode-math}
\setmathfont{XITS Math}
\setmathfont[range = up]{Comic Sans MS}
\setmathfont[range = it]{Comic Sans MS Italic}
\setmathfont[range = bfup]{Comic Sans MS Bold}
\setmathfont[range = bfit]{Comic Sans MS Bold Italic}

According to Microsoft, Comic Sans MS is in fact included with Windows 10.

You can legally obtain the older version of that’s compatible with comicsans gratis as part of the redistributable Microsoft Core Fonts for the Web.

Davislor
  • 44,045
  • Is there a way to do this with pdflatex? I don't think pdflatex work with fontspec. – CasperYC Feb 02 '19 at 05:12
  • Btw, before I downloaded comic.ttf, the PDF was displayed as squares only. And when I was installing the file for the very first time, windows did not show any warning of replacing an existing font. So it must be a BUG for Windows 10. – CasperYC Feb 02 '19 at 05:14
  • If you’re using PDFLaTeX, you will need to regenerate Type 1 versions of the fonts according to the instructions in the package manual. Repeat them now that your bold font is installed. – Davislor Feb 02 '19 at 05:19
  • The comicsans package uses the ttf-font directly. A conversion to type1 is only needed for the optional italic and cyrilic variants. But the encoding files of comicsans seems not be compatible with the ttf anymore - probably the font changed. One should inform the author of the package, he needs to adapt it. – Ulrike Fischer Feb 02 '19 at 10:05
  • @UlrikeFischer Ah. The font has indeed changed over the years. – Davislor Feb 02 '19 at 10:08
  • @UlrikeFischer I've removed the inaccurate information. Thank you! – Davislor Feb 02 '19 at 10:11