1

How to get the below + symbols by using the font ZapfDingbatsStd:

enter image description here

I've tried the below code for this:

\documentclass{book}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\usepackage{unicode-math}%


\def\zapfdingfont#1#2{\fontsize{#1}{#2}
\fontspec[ Path = ../Fonts/ ]{ZapfDingbatsStd.otf}
}
\begin{document}

\begin{itemize}
\item[\zapfdingfont{8.75}{8.75}\char058] Test
\end{itemize}

\end{document}

I'm using xelatex, Please suggest...

MadyYuvi
  • 13,693
  • Which symbol do you mean exactly? According to https://www.myfonts.com/fonts/adobe/itc-zapf-dingbats/medium/glyphs.html?render=old there are 204 glyphs, but none of them looks like a circle with a plus in it. – Marijn May 02 '18 at 16:12
  • @Marijn Sorry, circle was made by me for your easy understanding ... :-( – MadyYuvi May 03 '18 at 04:41

1 Answers1

2

Although this question is a near-duplicate of Getting the numbers in TI Fonts to appear in Latex (XeLaTex), it might be useful to provide a short example here to (hopefully) clarify the issue.

To change the font locally (e.g., to add a single symbol from another font, as in the current example) the fontspec package provides \newfontfamily. This command creates a macro (\ZDfont in the example below) that can be called to change the font at any point in the document. To switch the font again you can either use another font macro or use \normalfont to return to the document default font. fontspec also provides \DeclareTextFontCommand, which is a shortcut/wrapper command to select the new font, print the argument, and switch back.

To add a symbol from a font you can either type/copy-paste the symbol in your editor directly as the argument to the font selection macro, or use \char followed by a character code as the argument. The codes can be decimal or hexadecimal (with " prefix). You can also use \symbol, which is defined as \char followed by \relax. In the example below an extra command \ZD is defined to avoid typing \char when using character codes.

MWE:

\documentclass{book}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\newfontfamily{\ZDfont}{ZapfDingbatsStd.otf}
\DeclareTextFontCommand{\zdfont}{\ZDfont}
\def\ZD#1{\zdfont{\char #1}}

\begin{document}

\begin{itemize}
\item[\zdfont{✜}] Type/copy-paste in editor
\item[\ZD{10010}] Enter decimal code
\item[\zdfont{\symbol{10018}}] Another decimal code
\item[\ZD{"2719}] Enter hex code
\item Regular item
\end{itemize}

\end{document}

Result:

enter image description here

You can find the character codes for example using FontForge (select the Dingbats subset in View-Goto) or in the LibreOffice Insert-Special Character... dialog. Microsoft Word has a similar symbol selection dialog where the codes are also visible.

FontForge: enter image description here

OpenOffice: enter image description here

Marijn
  • 37,699
  • Its working fine, is it possible to save the font in some separate folder, like \newfontfamily{\ZDfont}{../fonts/ZapfDingbatsStd.otf} ? – MadyYuvi May 03 '18 at 14:32
  • Sorry, please ignore it, the tag \newfontfamily{\ZDfont}[Path = ../Fonts/]{ZapfDingbatsStd.otf} is working fine... – MadyYuvi May 03 '18 at 14:35