[Tex/LaTex] How to input characters into XeLaTeX

charactersfontstexshopunicodexetex

How do I input the non-keyboard characters into TeXShop?

My minimum working example:

\documentclass{book}
% Font Settings
\usepackage{fontspec}
\newfontfamily\myfont{C64 Pro Mono}
\begin{document}
\myfont\huge
Commodore 64 Font\par
\normalfont
Normal Font\par % Book title
\end{document}

The text "Commodore 64 Font" appears in the C64 Pro Mono font like I want, but I can't figure out how to get the other characters (see picture) beyond what I can type on the keyboard.

I'm using a Mac, so I can find the codes for the other characters through the Characters app, but I don't know how to get them into TeXShop. If I cut-and-paste, then I get strange characters.

Paste character into TeXShop

I'm assuming there is a way to put the Unicode in, but I can't figure out how.

I've seen examples where non-English language is input – CJK, etc. – but TeXShop doesn't seem to allow it for me.

Characters on Mac OS X

Edited to add:

I've found the glyph codes in Character viewer based on the answer below, so I'm adding a picture here in case anyone else is looking for a way to find the glyph numbers for use with \XeTexglyph :

C64Glyphs

Best Answer

Another way to enter the characters is to enter them directly with the \XeTeXglyph macro or use their Unicode character code using the \char macro.

For example, the heart symbol is Unicode 2665 so you can enter that using:

\char"2665

It's also possible to use the font specific glyph index number. For a font like the C64 font, which doesn't have a huge character inventory, this might be easiest. The following document creates a full font table for the C64 Pro Mono font (the upper bound was found by trial and error, but you could use FontForge to find the total number of glyphs as well).

% !TEX TS-program = xelatex

\documentclass[12pt]{article}
\usepackage{pgffor}
\usepackage{fontspec}

\newfontfamily\csixtyfour{C64 Pro Mono}

\DeclareTextFontCommand{\textcom}{\csixtyfour}
\begin{document}
\parindent=0pt
\foreach \x in {4,...,312}
   {\x\thinspace\textcom{\XeTeXglyph\x} }

\end{document}

font table

Related Question