ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Zhichu Chen <zhichu.chen@gmail.com>
To: Hans Hagen <pragma@wxs.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Is there a replacement for \tracechinesetrue in mkiv?
Date: Fri, 30 Dec 2011 23:52:31 +0800	[thread overview]
Message-ID: <CAAxCdXMSpnOuhX7WU2Q9n8LJC7AKxWyAs57TrXOdUN31N71V_g@mail.gmail.com> (raw)
In-Reply-To: <4EFC76CB.10703@wxs.nl>

Well, that's just perfect, only it's not what I'm looking for :( What
I need is a fully customable way to debug some of my inputs rather
than everything as a font feature.

I found a "cleaner" way now: to use the "whatsit" node, I hope it's
useful for someone so I paste the function here:

============================================
local function trace_boundingbox (head)
    for n in node.traverse (head) do
        if n.id == node.id ('glyph') then
          local ht,wd,dp = n.height,n.width,n.depth
          local htsp,wdsp,dpsp = ht/65536,wd/65536,dp/65536
          local w = node.new("whatsit","pdf_literal")
          w.data = "q 1 0 1 RG 1 0 1 rg 0.1 w 0 " .. -dpsp .. " m 0 "
.. htsp .. " l " .. -wdsp .. " " .. htsp .. " l " .. -wdsp .. " " ..
-dpsp .. " l s  0 1 0 RG 0 1 0 rg 0.1 w [2 1] 0 d 0 0 m " .. -wdsp ..
" 0 l S Q"
          node.insert_after (head, n, w)
        end
    end
end
============================================



On Thu, Dec 29, 2011 at 10:18 PM, Hans Hagen <pragma@wxs.nl> wrote:
> On 29-12-2011 04:22, Zhichu Chen wrote:
>>
>> All right, after some readings, I came out with a node solution. The
>> major idea is listed below and works just fine. "n" from node_traverse
>> (head) and n.id==node.id ('glyph')
>>
>> My question is: is there a better way? Because these codes are so
>> dirty. I prefer mplib but I have no clue how to do that.
>
>
> Using mp would be pretty complex too and all solutions are rather
> inefficient (bloat the pdf) .. attached another solution (I'll add it to the
> next beta).
>
>
> 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
> -----------------------------------------------------------------



-- 
Best Regards
Chen
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2011-12-30 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 11:16 Zhichu Chen
2011-12-21 22:47 ` Hans Hagen
2011-12-22  1:00   ` Zhichu Chen
2011-12-29  3:22   ` Zhichu Chen
2011-12-29 14:18     ` Hans Hagen
2011-12-30 15:52       ` Zhichu Chen [this message]
2011-12-29 14:38     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAxCdXMSpnOuhX7WU2Q9n8LJC7AKxWyAs57TrXOdUN31N71V_g@mail.gmail.com \
    --to=zhichu.chen@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).