From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/63169 Path: news.gmane.org!not-for-mail From: Ulrike Fischer Newsgroups: gmane.comp.tex.context Subject: Re: manipulate ttf-fonts loaded with luatex Date: Tue, 2 Nov 2010 16:16:39 +0100 Message-ID: References: <4CC96D7F.8040309@wxs.nl> <1xbfw9v6ufmj3.dlg@nililand.de> <4CC975B9.9050100@elvenkind.com> <20101028133259.GA5857@khaled-laptop> <4CC98FD6.2010100@wxs.nl> <4CC99E43.9090505@wxs.nl> <1bnkh4sd7r41c$.dlg@nililand.de> <4CC9B01F.1060907@wxs.nl> <1ucuymqnhaesb$.dlg@nililand.de> <4CC9C769.5020005@wxs.nl> Reply-To: news3@nililand.de, mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1288711056 10825 80.91.229.12 (2 Nov 2010 15:17:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Nov 2010 15:17:36 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Nov 02 16:17:32 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PDIc7-0001cl-Ux for gctc-ntg-context-518@m.gmane.org; Tue, 02 Nov 2010 16:17:32 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A7D53CA80D; Tue, 2 Nov 2010 16:17:30 +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 HQvpgzetwM2i; Tue, 2 Nov 2010 16:17:27 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 49FE6CA809; Tue, 2 Nov 2010 16:17:27 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2189BCA809 for ; Tue, 2 Nov 2010 16:17:26 +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 viqg7L8WYjxO for ; Tue, 2 Nov 2010 16:17:14 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 86737CA805 for ; Tue, 2 Nov 2010 16:17:14 +0100 (CET) Original-Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oA2FHCiq023409 for ; Tue, 2 Nov 2010 16:17:13 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PDIbf-0001Df-Gc for ntg-context@ntg.nl; Tue, 02 Nov 2010 16:17:03 +0100 Original-Received: from p5b392206.dip.t-dialin.net ([91.57.34.6]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Nov 2010 16:16:53 +0100 Original-Received: from news3 by p5b392206.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Nov 2010 16:16:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 102 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p5b392206.dip.t-dialin.net User-Agent: 40tude_Dialog/2.0.15.41de X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=80.91.229.12; country=NO; region=12; city=Oslo; latitude=59.9167; longitude=10.7500; http://maps.google.com/maps?q=59.9167,10.7500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0rDqfhcyI - 155d498af44d - 20101102 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:63169 Archived-At: Am Thu, 28 Oct 2010 20:56:41 +0200 schrieb Hans Hagen: >> Hm. I do have a bit the impression as if we have here a context and >> latex philosophy clash. I'm not asking you to provide a funktion > Huh? I'm not sure what philosophy refers to, Well I refer to sentences like this: > Sure, but the first complaints would end up in ... my > mailbox unless your package is private .... > The fact that it's custom in latex to overload code and > thus create a maintaince depency does not mean that I want such a > dependency on my code. Unlike context latex is decentral. Reponsability is splitted. And so no one would feel that I'm a thread for "their" code or to their support burden if I would announce a package. Nobody would feel the urge to take away the task from me for fear that I break something. Anyway: I'm writing latex packages. Whatever I will do: no context user will be affected by my code. > > Couldn't you give some examples how to manipulate a font after it > > has been defined with \font\test (if it is possible) and then let me > > play around? ... > > Anyhow, you can access some font data afterwards. In context form: > > \startluacode > function Whatever(name) > for k, v in pairs(fonts.ids[font.current()].descriptions) do > if v.name == name then > tex.sprint("\\char"..k.."\\relax") > break > end > end > end > \stopluacode > \font\test=file:pirat.ttf > \def\MyChessChar#1{{\test\directlua{Whatever("#1")}}} > \MyChessChar{c160} > > This is dead slow and inefficient but as you don't want a proper > function for it I don't care too much. This is an interesting piece of code but not actually what I asked for. I don't need to loop through the font to find out the correct \char-command connected to a glyph. I can look it up in fontforge and store it in a table. I need a way to reencode/reorder the font, so that the input "K" points to the glyph "c140". Pirat is not the only chessfont I have, I don't want to change the input if I change the font, so every chessfont should have the same internal order. My main problem is that they are so few informations about the generic context font loader code. E.g. after the rereading of the luatex manual I came up with the following: \starttext \font\test={file:PIRAT.TTF} \test %K\char75\char140\char140 \directlua{ mytable=font.fonts[font.id('test')] mytable.characters[75],mytable.characters[140]=mytable.characters[140],mytable.characters[75] tex.definefont("testb",font.define(mytable)) } \testb K\char75\char140\char140 \stoptext Then input "K" gives me (as wanted) a king. But it leads to questions: 1. Why is the spacing in \testb wrong if the chars have been already used after \test? 2. Which values/tables in mytable should I reset/change too to get a "sane" font \testb? 3. I can also use "mytable=fonts.ids[font.id('test')]". Is this better? What are the differences? > Interesting is that it does not work out (as wis to be expected > as the normal glyph access function does something similar). ? I didn't understand this remark. If you mean that you didn't get an output: There is nothing at position 160. The king is c140. -- Ulrike Fischer ___________________________________________________________________________________ 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 ___________________________________________________________________________________