Difference between revisions of "symbolset"

From Wiki
Jump to navigation Jump to search
(Created page with "One can create a symbol set with a specific font by using the commands {{code|1=\startsymbolset}} --- {{code|1=\stopsymbolset}}. Here is an example which creates the « dangerous...")
 
m
Line 3: Line 3:
  
 
Once a {{code|1=symbolset}} has been declared and set up, one can use the declared symbols (for instance here {{code|1=dbend}}) with the command {{code|1=\symbol{dbend}}}, or imbed it in other commands.
 
Once a {{code|1=symbolset}} has been declared and set up, one can use the declared symbols (for instance here {{code|1=dbend}}) with the command {{code|1=\symbol{dbend}}}, or imbed it in other commands.
 +
 +
In order to find which slot represents a desired glyph, one may look at the afm file and then by trial and error find the correct address… (in our example the file is {{code|1=manfnt.afm}}). For instance we have found that {{code|1=n:char_7e}} represents the dangerous bend, while {{code|1=n:char_79}} represents a broken arrow.
  
 
<texcode>
 
<texcode>
Line 12: Line 14:
 
\definesymbol [dbend]  [\resolvedglyphdirect{bends}{n:char_7e}]
 
\definesymbol [dbend]  [\resolvedglyphdirect{bends}{n:char_7e}]
 
\definesymbol [lhdbend] [\resolvedglyphdirect{bends}{n:char_7f}]
 
\definesymbol [lhdbend] [\resolvedglyphdirect{bends}{n:char_7f}]
 +
\definesymbol[brokenarrow][\resolvedglyphdirect{bends}{n:char_79}]
 +
\definesymbol[pentastar][\resolvedglyphdirect{bends}{n:char_1e}]
 
\stopsymbolset
 
\stopsymbolset
  
Line 25: Line 29:
 
\starttext
 
\starttext
 
Here we use the symbols directly: \symbol{dbend}\quad \symbol{lhdbend}.
 
Here we use the symbols directly: \symbol{dbend}\quad \symbol{lhdbend}.
 +
\blank[big]
 +
\symbol{brokenarrow}\quad \symbol{pentastar}.
 
\blank[big]
 
\blank[big]
 
\dbend This result is difficult to prove.
 
\dbend This result is difficult to prove.

Revision as of 07:30, 1 September 2017

One can create a symbol set with a specific font by using the commands \startsymbolset --- \stopsymbolset. Here is an example which creates the « dangerous bend » used by Donald Kunth with his font manfnt.

Once a symbolset has been declared and set up, one can use the declared symbols (for instance here dbend) with the command \symbol{dbend}, or imbed it in other commands.

In order to find which slot represents a desired glyph, one may look at the afm file and then by trial and error find the correct address… (in our example the file is manfnt.afm). For instance we have found that n:char_7e represents the dangerous bend, while n:char_79 represents a broken arrow.

% First we declare the font where the symbols have to be found
\definefontsynonym[bends][file:manfnt.afm]

% Then we declare a proper set of symbols:
\startsymbolset [Dangerous Bends]
	\definesymbol [dbend]   [\resolvedglyphdirect{bends}{n:char_7e}]
	\definesymbol [lhdbend] [\resolvedglyphdirect{bends}{n:char_7f}]
	\definesymbol[brokenarrow][\resolvedglyphdirect{bends}{n:char_79}]
	\definesymbol[pentastar][\resolvedglyphdirect{bends}{n:char_1e}]
\stopsymbolset

% Here we say which symbolset is to be used:
\setupsymbolset [Dangerous Bends]

% One can use the symbols directly with the command \symbol
% or imbed it in other commands.
\define\dbend{\inmargin{\symbol{dbend}}}
\define\ddbend{\inmargin{\symbol{dbend}\symbol{dbend}}}
\define\dddbend{\inmargin{\symbol{dbend}\symbol{dbend}\symbol{dbend}}}

\starttext
Here we use the symbols directly: \symbol{dbend}\quad \symbol{lhdbend}.
\blank[big]
\symbol{brokenarrow}\quad \symbol{pentastar}.
\blank[big]
\dbend This result is difficult to prove.
\blank[big]
\ddbend This result is more difficult to prove.
\blank[big]
\dddbend This result is even more difficult to prove.
\stoptext