12

I would like to use CASIO fonts here. enter image description here

1 - I would like to create a way to use LaTeX to get these "icon"s. For example, use \On for the ON button, and ect. Assuming we have to do some more work here to find the mapping of those icons here...

2 - As you can see that target computers (final PDF verwiers) may not have the font installed. I know that we can embed font into PDF. Can this be done using latex too?

enter image description here

3 - I don't mind using a normal .tex to enable me to do so, or creating a package. But I have minimal experience in creating one, so quick-and-easy would be the best.

1
  • Have a look at fontspec. You can easily define a new font family with the fonts (assuming they are TTF/OTF). Then just use your font family as in {\myfontfamily\char"...} where ... is the unicode code point of the symbol you want to use. And then you can create macros for every shorthand you need.
    – TeXnician
    Commented May 31, 2018 at 15:52

2 Answers 2

9

You can call the glyphs by number rather than “by character”. With the following code we can gather the number of each glyph in the font:

\documentclass{article}
\usepackage[a4paper,margin=2cm,heightrounded]{geometry}
\usepackage{fontspec}
\usepackage{multicol}

\newfontface{\casio}{CASIO ClassWiz}[
  Extension=.ttf,
  Path=./ClassWizSeriesFontSet/,
]

\begin{document}

{\casio\xdef\casiofont{\the\font}}

\begin{multicols}{4}
\count255=32

\loop\ifnum\count255<"10FFFF
\advance\count255 1
  \iffontchar\casiofont\count255 \the\count255\ {\casio\char\count255}\endgraf\fi
\repeat

\end{multicols}

\end{document}

enter image description here

For your document you can look up the characters you need and define

\newfontface{\casio}{CASIO ClassWiz}[
  Extension=.ttf,
  Path=./ClassWizSeriesFontSet/,
]

(if you install the font system wide, you don't need those options, of course; otherwise, adjust the path).

Next, assign macros to the glyphs you need:

\newcommand{\casiosymbol}[1]{{\normalfont\casio\symbol{#1}}
\newcommand{\CLeft}{\casiosymbol{33}}
\newcommand{\CEquiv}{\casiosymbol{34}}
\newcommand{\CFactorial}{\casiosymbol{37}}

You can improve the list at any time.

4
  • Thanks. I think that's what I meant by "mapping the icons". I will explore more using this method. Commented May 31, 2018 at 17:00
  • 1
    Is there any advantage of doing it this way?
    – Alan Munn
    Commented May 31, 2018 at 18:58
  • 1
    @AlanMunn I see no advantage in using characters.
    – egreg
    Commented May 31, 2018 at 19:42
  • 1
    @egreg The advantage for me was that I could simply use the character map provided with the font to assign names.
    – Alan Munn
    Commented May 31, 2018 at 20:53
12

It's really not hard to do, but it would make sense to make it a package.

Update

I've now packaged this as a package with command names for all the keys. It is now on CTAN. Since I don't use the calculator, suggestions are welcome for more appropriate names for some of the keys. You can submit them at https://github.com/amunn/casiofont/.

Sample document

Here's a sample document. Fonts are embedded by default so any viewer should be able to view the resultant file.

\documentclass{article}
\usepackage{casiofont}
\begin{document}
{\casio \Shift\Alpha\UpArrow\DownArrow\LeftArrow\RightArrow}

\textcasio{\UpArrow}
\end{document}

output of code

7
  • I would wrap \casioinside the \newcommand* macros, within an extra set of braces. That way, you can write \shift instead of \textcasio{\shift} and not get q.
    – Davislor
    Commented May 31, 2018 at 19:12
  • Additionally, you should probably load CASIO ClassWiz with Scale=MatchUppercase.
    – Davislor
    Commented May 31, 2018 at 19:14
  • @Davislor Yes, that's a good idea. I'll update shortly.
    – Alan Munn
    Commented May 31, 2018 at 19:19
  • Oh, and having the internal macros you define in your packages include an @ makes it less likely that they’ll clash with user-defined commands.
    – Davislor
    Commented May 31, 2018 at 19:38
  • 2
    @Davislor Of course. But this package has none. :)
    – Alan Munn
    Commented May 31, 2018 at 20:51

You must log in to answer this question.

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