[NTG-context] Is there a replacement for \tracechinesetrue in mkiv?

Zhichu Chen zhichu.chen at gmail.com
Fri Dec 30 16:52:31 CET 2011


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 at 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


More information about the ntg-context mailing list