[NTG-context] Font Awesome (again)

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sun Oct 7 15:43:13 CEST 2018



Aditya Mahajan schrieb am 07.10.18 um 15:26:
> Hi,
>
> There is a FontAwesome.otf file that is distributed with ConTeXt 
> minimals. Does anyone know what version (4 or 5) of the font it is? I 
> am asking because the names of the symbols used in the font do not 
> match those on the font-awesome website. For example, using
>
> \showsymbolset[fontawesome]

The distribution includes version 4.7.

> I get that the symbol for "utensils" 
> (https://fontawesome.com/icons/utensils?style=solid) is actually 
> mapped to "food" in ConTeXt. Since the names of the symbols are now 
> taken from the font, my guess is that the distribution has an old 
> version of the font (also because it is a single font rather than three).
>
> Would it make sense to update the fonts in the distribution? If not, 
> then simply remove the old version of the fonts?
>
> Also, don't we need to update the symb-imp-fontawesome.mkiv file to 
> work with the new symbols. Font awesome has split the fonts into three
> (https://fontawesome.com/how-to-use/on-the-desktop/setup/getting-started): 
>
> Solid, Regular, and Brands. (There are also pro version of the fonts). 
> The simplest way to use them will be to have three symbolsets 
> (fontawesome, fontawesome-solid, and fontawesome-brands), where the 
> names are taken from the fonts.
>
> In the meanwhile, Hraban has painstakenly written out the mappings by 
> hand, but the automatic mapping might be simpler (and more future proof).
> https://github.com/fiee/ConTeXt/blob/master/symbols/symb-awesome5.mkiv

While I have no problem replacing the old symbols you can support both 
when you use new set names for the new version (even for the regular style).


\definefontsynonym [FontAwesomeBrands] 
[file:fontawesome5brandsregular400.otf]
\definefontsynonym [FontAwesomeRegular] 
[file:fontawesome5freeregular400.otf]
\definefontsynonym [FontAwesomeSolid] [file:fontawesome5freesolid900.otf]

\startsymbolset [fontawesome-brands] [font=FontAwesomeBrands]
   % Font Awesome Brands
\stopsymbolset

\startsymbolset [fontawesome-regular] [font=FontAwesomeRegular]
   % Font Awesome Regular
\stopsymbolset

\startsymbolset [fontawesome-solid] [font=FontAwesomeSolid]
   % Font Awesome Solid
\stopsymbolset

\starttext

\startnamedsection [title] [title={Font Awesome Brands}]
   \showsymbolset [fontawesome-brands]
\stopnamedsection

\startnamedsection [title] [title={Font Awesome Regular}]
   \showsymbolset [fontawesome-regular]
\stopnamedsection

\startnamedsection [title] [title={Font Awesome Solid}]
   \showsymbolset [fontawesome-solid]
\stopnamedsection

\stoptext


Wolfgang


More information about the ntg-context mailing list