From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81450 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: error calling font.getfont() on certain fonts Date: Fri, 29 Mar 2013 15:21:04 +0100 Message-ID: <5155A350.4040401@wxs.nl> References: <20130328174101.GA4456@phlegethon> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; Format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1364566870 2906 80.91.229.3 (29 Mar 2013 14:21:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Mar 2013 14:21:10 +0000 (UTC) To: ConTeXt ML Original-X-From: ntg-context-bounces@ntg.nl Fri Mar 29 15:21:36 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 1ULaBS-0002NZ-Nk for gctc-ntg-context-518@m.gmane.org; Fri, 29 Mar 2013 15:21:34 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1881B101E9; Fri, 29 Mar 2013 15:21:10 +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 qJD+jOM-JP4w; Fri, 29 Mar 2013 15:21:07 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id AAF47101E4; Fri, 29 Mar 2013 15:21:07 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0BC46101E4 for ; Fri, 29 Mar 2013 15:21:06 +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 Lw6PSwkchAP9 for ; Fri, 29 Mar 2013 15:21:04 +0100 (CET) Original-Received: from filter3-utr.mf.surf.net (filter3-utr.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id F16C3101E3 for ; Fri, 29 Mar 2013 15:21:03 +0100 (CET) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter3-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r2TEL2N8009717 for ; Fri, 29 Mar 2013 15:21:02 +0100 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by pragma-net.nl (SurgeMail 6.1c) with ESMTP (TLS) id 13602-1713362 for ; Fri, 29 Mar 2013 15:21:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 In-Reply-To: <20130328174101.GA4456@phlegethon> X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=11; city=Den Haag; latitude=52.0833; longitude=4.3000; http://maps.google.com/maps?q=52.0833,4.3000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08Jhql2Me - 820d20d33ff3 - 20130329 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 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:81450 Archived-At: 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=92s beta > and Tex Live. The error message is > > error: .../context/tex/texmf-context/tex/context/base/node-inj.lua:9= 7: 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? 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 add this after the definition of definers.read(specification,size,id) = and it will probably work ok function font.getfont(id) return fontdata[id] -- otherwise issues end (I'll add a similar overload someplace else.) > Best regards > Philipp > > > %% working fonts: > %\setupbodyfont[iwona] > %\setupbodyfont[computer-modern-unicode] > %\setupbodyfont[antykwa-poltawskiego] > %% ... ? > > %% not working: > \setupbodyfont[modern] > %\setupbodyfont[antykwa] > %\setupbodyfont[termes] > %\setupbodyfont[pagella] > %\setupbodyfont[bonum] > %% ... ? > > \starttext > foo > \ctxlua{font.getfont( font.current() )} > bar > \stoptext in context you can try this: \startluacode function font.getfont(id) return fonts.hashes.identifiers[id] end \stopluacode \starttext foo \ctxlua{inspect(font.getfont( font.current()).parameters )} bar \stoptext if you comment the function overload you see the difference Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________