From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81451 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: Re: error calling font.getfont() on certain fonts Date: Fri, 29 Mar 2013 16:29:15 +0100 Message-ID: <20130329152851.GA15331@phlegethon> References: <20130328174101.GA4456@phlegethon> <5155A350.4040401@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2079376934==" X-Trace: ger.gmane.org 1364570970 12609 80.91.229.3 (29 Mar 2013 15:29:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Mar 2013 15:29:30 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Mar 29 16:29:56 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ULbFZ-0004pK-Db for gctc-ntg-context-518@m.gmane.org; Fri, 29 Mar 2013 16:29:53 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BEB13101E3; Fri, 29 Mar 2013 16:29:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qZuDwLUP1RHr; Fri, 29 Mar 2013 16:29:27 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id DFA78101E4; Fri, 29 Mar 2013 16:29:26 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 97FE9101E4 for ; Fri, 29 Mar 2013 16:29:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6HWab5+mbJ6p for ; Fri, 29 Mar 2013 16:29:24 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id ACBB5101E3 for ; Fri, 29 Mar 2013 16:29:24 +0100 (CET) Original-Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r2TFTNon009663 for ; Fri, 29 Mar 2013 16:29:24 +0100 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r2TFTNSk002879 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Mar 2013 16:29:23 +0100 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r2TFTM1I026061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Mar 2013 16:29:22 +0100 Original-Received: from localhost (p5084729E.dip.t-dialin.net [80.132.114.158]) (authenticated bits=0) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id r2TFTLhk008709 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 29 Mar 2013 16:29:22 +0100 Mail-Followup-To: mailing list for ConTeXt users In-Reply-To: <5155A350.4040401@wxs.nl> X-Operating-System: Linux phlegethon 3.7.9-2-ARCH User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0016 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.210.211; country=DE; region=01; city=Heidelberg; postalcode=69115; latitude=49.4167; longitude=8.7000; http://maps.google.com/maps?q=49.4167,8.7000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03Jhrtov9 - c4b8e6149cab - 20130329 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:81451 Archived-At: --===============2079376934== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JYK4vJDZwFMowpUq" Content-Disposition: inline --JYK4vJDZwFMowpUq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 > On 3/28/2013 6:41 PM, Philipp Gesang wrote: > >Hi all, > > > >I get an error when I run this code: > > > > \ctxlua{font.getfont( font.current() )} > > > >(Complete example below.) Oddly, whether or not this fails > >depends on the font. The issue does occur with both today=E2=80=99s beta > >and Tex Live. The error message is > > > > error: .../context/tex/texmf-context/tex/context/base/node-inj.lua:= 97: attempt to perform arithmetic on local 'factor' (a nil value) > > > >At the same time, in Plain the equivalent code works fine for all > >fonts. Bug or feature? >=20 > it's a side effect ... it looks like font.getfont operates on the > table passed to tex and when you request it it probably fills in > some data (like parameters) thereby overloading / wiping out > existing stuff so after that call the data structure as context uses > (and needs) it is messed up I just read that in the manual: Note that at the moment, each access to the font.fonts or call to font.getfont creates a lua table for the whole font. This process can be quite slow. In a later version of LuaTEX, this interface will change (it will start using userdata objects instead of actual tables). > add this after the definition of > definers.read(specification,size,id) and it will probably work ok >=20 > function font.getfont(id) > return fontdata[id] -- otherwise issues > end >=20 > (I'll add a similar overload someplace else.) Great! Looking forward to the next update. > in context you can try this: >=20 > \startluacode > function font.getfont(id) > return fonts.hashes.identifiers[id] > end > \stopluacode >=20 > \starttext >=20 > foo > \ctxlua{inspect(font.getfont( font.current()).parameters )} > bar > \stoptext >=20 > if you comment the function overload you see the difference Compared to Plain, Context adds a lot to the =E2=80=9C.parameters=E2=80=9D = table.=20 Sadly, writing to it doesn=E2=80=99t appear to change anything =E2=80=A6 Philipp --=20 () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments --JYK4vJDZwFMowpUq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlFVs0sACgkQ02lYlJYWs9JACwCfXcsqPwYjTye0zFQCt/iBXlPD 0hEAoJ6SMVb9Hu++hMKJItWdhDJA/15O =qkA7 -----END PGP SIGNATURE----- --JYK4vJDZwFMowpUq-- --===============2079376934== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============2079376934==--