3

I'm trying to use KFGQPC Symbols font which can be downloaded from here. I'm using LuaLaTeX but I can't figure out how to make it display. I had some trouble using it in XeLaTeX but was finally able to manage as can be seen from the reference document I created.

Here is my MWE,

\documentclass{article}
\usepackage{fontspec}
\usepackage{luacode,luaotfload,luatextra}

\setlength{\parindent}{0cm}

\setmainfont{Arial}

\newfontfamily\QPCSymbols{KFGQPC Arabic Symbols 01}

\newfontfamily\TNR
{Times New Roman}

\begin{document}
\section{Font Test}
Main font: This is a test.

Times New Roman: {\TNR Bite me "}

The Symbol: {\QPCSymbols !}
\end{document}

And this is my output:

MWE Output

Questions

  1. How to make it work in LuaLaTeX?
  2. How can I edit the font to make it easier to use? For example, in Microsoft Word, I just type the reference letter and change the font to the Symbols font and it just works; akin to Dingbat fonts.

2 Answers 2

7

There is no direct equivalent of the XeTeXglyph macro in LuaTeX that I am aware of. But you can use the \symbol macro provided you know how the glyphs are numbered in the font. I used the ConTeXt code from this answer to generate the code points for the glyphs.

For normal use it would probably make sense to make individual macros for the symbols you want. The \glyphnum macro used in this example uses the numbers shown in the documentation you linked to and then generates the appropriate codepoint in the font. Since the numbers are large integers I've used the bigintcalc package to do the addition. I've shown how you can make a macro to use the glyph numbers in the documentation in your document, or you could further wrap that macro into your own individual macros for the glyphs you need.

\documentclass{article}
\usepackage{fontspec}
\usepackage[margin=1in]{geometry}
\usepackage{bigintcalc}
\usepackage{multicol}
\usepackage{pgffor}
\newfontfamily\QPC{KFGQPC Arabic Symbols 01}
\newcommand\glyphnum[1]{\bigintcalcAdd{#1}{983040}}
\newcommand\KFGQPCglyph[1]{\QPC\symbol{\glyphnum{#1}}}
\begin{document}

\begin{multicols}{3}
\foreach\x in {2,...,97}{
\parbox{2em}{\hfill\x~=} \glyphnum{\x}~=  {\QPC \symbol{\glyphnum{\x}}}\par
}
\end{multicols}

Example of use:

\KFGQPCglyph{12}
\KFGQPCglyph{42}
\KFGQPCglyph{70}
\end{document}

An alternative way to find the code points

A simpler way to find the code points (as pointed out in the comments) is to look at the .lua code associated with the font. This can be found inside the local cache folder for LuaTeX. In the log file for a document that loads the font, you will find a line similar to the following (the exact path will be dependent on your OS):

luaotfload | cache : Lookup cache loaded from /Users/alan/Library/texlive
/2017/texmf-var/luatex-cache/generic/names/luaotfload-lookup-cache.luc.(load
luc: /Users/alan/Library/texlive/2017/texmf-var/luatex-cache/generic
/font/otl/symbols1-ver02.luc)

The last part of this tells you the name of the .luc file for the font, in this case symbols1-ver02.luc. Inside the same folder will be a corresponding .lua file symbols1-ver02.lua.

If you look inside this file you'll see a bunch of lines like the following:

 ["descriptions"]={
  [983040]={
   ["boundingbox"]=1,
   ["index"]=0,
   ["name"]="notdef",
   ["unicode"]=983040,
   ["width"]=1024,
  },
  [983041]={
   ["boundingbox"]=1,
   ["index"]=1,
   ["unicode"]=61472,
   ["width"]=600,
  }, 

  ...

  [983137]={
   ["boundingbox"]={ 98, -289, 2388, 1364 },
   ["index"]=97,
   ["unicode"]=61572,
   ["width"]=2498,
  },
 }

Notice that the first number in the [descriptions] code block corresponds to the starting number in my \glyphnum macro, and the final number is that number plus 97 (the number of glyphs in the documentation.)

output of code

2
  • Another approach to discover the code point is to see in the log file which .luc has been loaded and then look at the corresponding .lua (symbols1-ver02.lua in this case). Aug 7, 2017 at 18:46
  • @JavierBezos Thanks! I've updated the answer with an explanation of how to do this.
    – Alan Munn
    Aug 7, 2017 at 21:24
1

As noted by Alan Munn, you need to call the symbols by numerical codes.

I opened the font in FontForge. There are no characters assigned to anything in the ASCII or Latin character sets. So, typing an exclamation point will not produce a valid character.

If, for some reason, you wish to use this font by typing ordinary keyboard characters, you can open it in FontForge and move the symbols to ASCII locations, then save as a different font (with different internal font name). That assume the license permits it. I do not recommend this, because then only you could use the font, and it its characters would be seen as ASCII by text readers.

3
  • You and Alan Munn have both answered parts of my question. Is there some etiquette as to which should be accepted? Aug 7, 2017 at 18:29
  • @KhalidHussain Since the advice here has some downsides, (as RobtAll points out) I don't think this is really the best approach to use. For one thing it makes documents depending on your personally modified font, whereas my approach will work on all versions of the font (assuming the code points remain the same).
    – Alan Munn
    Aug 7, 2017 at 18:53
  • @KhalidHussain Accept Alan Munn's answer. My own answer should probably have been just a comment.
    – user139954
    Aug 7, 2017 at 21:08

You must log in to answer this question.

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