[metapost] Glyph of with mplib

Taco Hoekwater taco at elvenkind.com
Mon Jul 8 17:01:14 CEST 2019


Hi,

> On 8 Jul 2019, at 16:44, Maxime Chupin <notezik at gmail.com> wrote:
> 
> To be more precise : I'm trying to build something like : 
> mp:execute('picture lettre; path contourLettre; lettre := glyph "f" of "cmr9"; beginfig(1); for item within lettre: contourLettre := pathpart item; draw contourLettre; endfor; endfig;end;')
> 
> but I get the following error : 
> {psfonts.map}
> Warning: cannot open Type 1 font file cmr9.pfb for reading
> 
> Can I specify an OpenType font ? Maybe this can solve the problem ?

No, you really need a type1 font. 

The problem here is not on the metapost side, but in finding the actual file.
Mplib’s finder callback and kpse’s find_file() do not agree on the search type name
for fonts (most all of kpse types are simply file extensions, but more descriptive names). 

In this case, mplib asks for ‘pfb’ but kpse wants ’type1 fonts’.

local function finder(name, mode, ftype)
   if mode == "w" then
  return name
   else
       if ftype == 'pfb' then ftype='type1 fonts' end
       return  mpkpse:find_file(name,ftype)
   end
end


> 
> Thanks 
> 
> Le lun. 8 juil. 2019 à 12:48, Maxime Chupin <notezik at gmail.com> a écrit :
> Hi again,
> How can I use glyph of in mplib ? How can I specify a font ?
> 
> Thanks in advance
> 
> -- 
> Maxime Chupin
> Site personnel : http://fougeriens.org/~mc/
> Site professionnel : https://www.ceremade.dauphine.fr/~chupin/
> adresse libre : chupin at fougeriens.org
> 
> 
> -- 
> Maxime Chupin
> Site personnel : http://fougeriens.org/~mc/
> Site professionnel : https://www.ceremade.dauphine.fr/~chupin/
> adresse libre : chupin at fougeriens.org
> --
> http://tug.org/metapost/

Taco Hoekwater
Elvenkind BV







More information about the metapost mailing list