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

2011-12-30 Thread Zhichu Chen
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 pra...@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
___

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

2011-12-29 Thread Hans Hagen

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
-


crapcrap.pdf
Description: Adobe PDF document
___
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
___

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

2011-12-29 Thread Hans Hagen

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.


the next beta will have:

\starttext

\definefontfeature[redboxed]  [default][boundingbox=palered]
\definefontfeature[greenboxed][default][boundingbox=palegreen]
\definefontfeature[blueboxed] [default][boundingbox=paleblue]

\definefont[TestFontA][Serif*redboxed]
\definefont[TestFontB][Serif*greenboxed]
\definefont[TestFontC][Serif*blueboxed]

\startTEXpage[offset=10pt]

\start \TestFontA \input zapf \stop \blank
\start \TestFontB \input zapf \stop \blank
\start \TestFontC \input zapf \stop

\stopTEXpage

\stoptext

(for the moment only a few hard coded colors)

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


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

2011-12-28 Thread Zhichu Chen
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.

=
  local ht,wd,dp = n.height,n.width,n.depth ;
  local rwd = .5*65536
  local k1 = node.new('kern')
  k1.kern = -wd-.5*rwd
  local r1 = node.new(rule)
  r1.width, r1.height, r1.depth = rwd, ht, dp
  local k2 = node.new('kern')
  k2.kern = -r1.width
  local r2 = node.new(rule)
  r2.width, r2.height, r2.depth = wd+rwd, ht+.5*rwd, -ht+.5*rwd
  local k3 = node.new('kern')
  k3.kern = -r2.width
  local r3 = node.new(rule)
  r3.width, r3.height, r3.depth = wd+rwd, -dp+.5*rwd, dp+.5*rwd
  local k4 = node.new('kern')
  k4.kern = -.5*rwd
  local r4 = node.new(rule)
  r4.width, r4.height, r4.depth = rwd, ht, dp
  local k5 = node.new('kern')
  k5.kern = -.5*rwd
  k1.next = r1
  r1.prev = k1
  r1.next = k2
  k2.prev = r1
  k2.next = r2
  r2.prev = k2
  r2.next = k3
  k3.prev = r2
  k3.next = r3
  r3.prev = k3
  r3.next = k4
  k4.prev = r3
  k4.next = r4
  r4.prev = k4
  r4.next = k5
  k5.prev = r4
  local box = node.hpack(k1)
  local tb = node.vpack(box)
  insert_after (head, n, tb)
=

On Thu, Dec 22, 2011 at 6:47 AM, Hans Hagen pra...@wxs.nl wrote:
 On 21-12-2011 12:16, Zhichu Chen wrote:

 Hi,

 I wrote some CJK vertical typesetting macros in mkii a long time ago
 and I want to adopt it to mkiv. Sadly the \iftracechinese is gone. Can
 I still draw boxes of each glyph to see if they are aligned in my way?
 Drawing a line in the background is so not cool.


 mkiv does things completely different

 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
___

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

2011-12-21 Thread Zhichu Chen
Hi,

I wrote some CJK vertical typesetting macros in mkii a long time ago
and I want to adopt it to mkiv. Sadly the \iftracechinese is gone. Can
I still draw boxes of each glyph to see if they are aligned in my way?
Drawing a line in the background is so not cool.

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


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

2011-12-21 Thread Hans Hagen

On 21-12-2011 12:16, Zhichu Chen wrote:

Hi,

I wrote some CJK vertical typesetting macros in mkii a long time ago
and I want to adopt it to mkiv. Sadly the \iftracechinese is gone. Can
I still draw boxes of each glyph to see if they are aligned in my way?
Drawing a line in the background is so not cool.


mkiv does things completely different

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


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

2011-12-21 Thread Zhichu Chen
Interesting, so I guess I should write some lua code? Since I have
little experience in that area, could you provide a minimal example
just to show me how to draw the baseline of each glyph?

Thanks

On Thu, Dec 22, 2011 at 6:47 AM, Hans Hagen pra...@wxs.nl wrote:

 mkiv does things completely different

 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
___