From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/42984 Path: news.gmane.org!not-for-mail From: Willi Egger Newsgroups: gmane.comp.tex.context Subject: Re: OTF features Date: Tue, 5 Aug 2008 18:08:13 +0200 Message-ID: <8B8D073C-4B5E-4EB0-AADF-F7ED510FAFA1@boede.nl> References: <48985934.9030501@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217952593 17529 80.91.229.12 (5 Aug 2008 16:09:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2008 16:09:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Aug 05 18:10:41 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1KQP7K-0006Dg-Uw for gctc-ntg-context-518@m.gmane.org; Tue, 05 Aug 2008 18:10:35 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1E9C41FBD4; Tue, 5 Aug 2008 18:09:37 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19830-01-3; Tue, 5 Aug 2008 18:08:53 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A7BCA1FBF1; Tue, 5 Aug 2008 18:08:53 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 94F901FBF1 for ; Tue, 5 Aug 2008 18:08:51 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19830-01-2 for ; Tue, 5 Aug 2008 18:08:15 +0200 (CEST) Original-Received: from mail.7values.nl (pluto.digitpaint.nl [83.98.197.3]) by ronja.ntg.nl (Postfix) with ESMTP id 2F06B1FB6D for ; Tue, 5 Aug 2008 18:08:15 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by mail.7values.nl (Postfix) with ESMTP id AD05918440 for ; Tue, 5 Aug 2008 18:08:14 +0200 (CEST) Original-Received: from mail.7values.nl ([127.0.0.1]) by localhost (pluto [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20615-01-46 for ; Tue, 5 Aug 2008 18:08:14 +0200 (CEST) Original-Received: from [192.168.0.17] (a80-126-172-1.adsl.xs4all.nl [80.126.172.1]) by mail.7values.nl (Postfix) with ESMTP id 64A8F18432 for ; Tue, 5 Aug 2008 18:08:14 +0200 (CEST) In-Reply-To: <48985934.9030501@wxs.nl> X-Mailer: Apple Mail (2.753.1) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:42984 Archived-At: Hans, thanks! That is great. Willi On Aug 5, 2008, at 3:44 PM, Hans Hagen wrote: > Willi Egger wrote: >> Dear OTF-users, >> Is there a simple way to get to know the features wich a given OTF >> has? > > ok, there is one now ... (attached file goes to scripts/context/lua > > >mtxrun --script font --list "zapfinoextra.*four" --info > MtxRun | > MtxRun | fontname: zapfinoextralt-four > MtxRun | fullname: ZapfinoExtraLT-Four > MtxRun | filename: zapfinoextralt-four.otf > MtxRun | > MtxRun | feature : -> latn rom > MtxRun | feature : aalt -> latn dflt > MtxRun | feature : case -> latn afk nld rom trk dflt > MtxRun | feature : crcy -> latn afk nld rom trk dflt > MtxRun | feature : dlig -> latn afk nld rom trk dflt > MtxRun | feature : dnom -> latn afk nld rom trk dflt > MtxRun | feature : dpng -> latn afk nld rom trk dflt > MtxRun | feature : frac -> latn afk nld rom trk dflt > MtxRun | feature : liga -> latn afk nld rom trk dflt > MtxRun | feature : locl -> latn afk nld rom trk dflt > MtxRun | feature : numr -> latn afk nld rom trk dflt > MtxRun | feature : ordn -> latn afk nld rom trk dflt > MtxRun | feature : ornm -> latn dflt > MtxRun | feature : sups -> latn afk nld rom trk dflt > MtxRun | > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > if not modules then modules = { } end modules ['mtx-fonts'] = { > version = 1.001, > comment = "companion to mtxrun.lua", > author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", > copyright = "PRAGMA ADE / ConTeXt Development Team", > license = "see context related readme files" > } > > dofile(input.find_file("font-syn.lua")) > > scripts = scripts or { } > scripts.fonts = scripts.fonts or { } > > function scripts.fonts.reload(verbose) > fonts.names.load(true,verbose) > end > > local function showfeatures(v,n,f,s) > local filename = input.find_file(f,type) or "" > if filename ~= "" then > local ff = fontforge.open(filename) > if ff then > local data = fontforge.to_table(ff) > fontforge.close(ff) > local features = { } > local function collect(what) > if data[what] then > for _, d in ipairs(data[what]) do > if d.features then > for _, df in ipairs(d.features) do > features[df.tag] = features[df.tag] > or { } > for _, ds in ipairs(df.scripts) do > features[df.tag][ds.script] = > features[df.tag][ds.script] or { } > for _, lang in ipairs(ds.langs) do > features[df.tag][ds.script] > [lang] = true > end > end > end > end > end > end > end > collect('gsub') > collect('gpos') > input.verbose = true > input.report("") > input.report("fontname: %s",v) > input.report("fullname: %s",n) > input.report("filename: %s",f) > input.report("") > for _, f in ipairs(table.sortedkeys(features)) do > local ff = features[f] > for _, s in ipairs(table.sortedkeys(ff)) do > local ss = ff[s] > input.report("feature : %s -> %s %s",f,s, > (table.concat(table.sortedkeys(ss), " ")):lower()) > end > end > input.report("") > end > end > end > > function scripts.fonts.list(pattern,reload,all,info) > if reload then > input.report("fontnames, reloading font database") > end > local t = fonts.names.list(pattern,reload) > if reload then > input.report("fontnames, done\n\n") > end > if t then > local s, w = table.sortedkeys(t), { 0, 0, 0 } > local function action(f) > for k,v in pairs(s) do > if all or v == t[v][2]:lower() then > local type, name, file, sub = unpack(t[v]) > f(v,name,file,sub) > end > end > end > action(function(v,n,f,s) > if #v > w[1] then w[1] = #v end > if #n > w[2] then w[2] = #n end > if #f > w[3] then w[3] = #f end > end) > action(function(v,n,f,s) > if s then s = "(sub)" else s = "" end > if info then > showfeatures(v,n,f,s) > else > local str = string.format("%s %s %s %s",v:padd(w > [1]," "),n:padd(w[2]," "),f:padd(w[3]," "), s) > print(str:strip()) > end > end) > end > end > > function scripts.fonts.save(name,sub) > local function save(savename,fontblob) > if fontblob then > savename = savename:lower() .. ".lua" > input.report("fontsave, saving data in %s",savename) > table.tofile(savename,fontforge.to_table > (fontblob),"return") > fontforge.close(fontblob) > end > end > if name and name ~= "" then > local filename = input.find_file(name) -- maybe also search > for opentype > if filename and filename ~= "" then > local suffix = file.extname(filename) > if suffix == 'ttf' or suffix == 'otf' or suffix == > 'ttc' then > local fontinfo = fontforge.info(filename) > if fontinfo then > if fontinfo[1] then > for _, v in ipairs(fontinfo) do > save(v.fontname,fontforge.open > (filename,v.fullname)) > end > else > save(fontinfo.fullname,fontforge.open > (filename)) > end > end > end > end > end > end > > banner = banner .. " | font tools " > > messages.help = [[ > --reload generate new font database > --list [--info] list installed fonts (show info) > --save save open type font in raw table > > --pattern=str filter files > --all provide alternatives > ]] > > if environment.argument("reload") then > local verbose = environment.argument("verbose") > scripts.fonts.reload(verbose) > elseif environment.argument("list") then > local pattern = environment.argument("pattern") or > environment.files[1] or "" > local all = environment.argument("all") > local info = environment.argument("info") > local reload = environment.argument("reload") > scripts.fonts.list(pattern,reload,all,info) > elseif environment.argument("save") then > local name = environment.files[1] or "" > local sub = environment.files[2] or "" > scripts.fonts.save(name,sub) > else > input.help(banner,messages.help) > end > ______________________________________________________________________ > _____________ > 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 : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ______________________________________________________________________ > _____________ ___________________________________________________________________________________ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________