ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Is there a replacement for \tracechinesetrue in mkiv?
@ 2011-12-21 11:16 Zhichu Chen
  2011-12-21 22:47 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Zhichu Chen @ 2011-12-21 11:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Is there a replacement for \tracechinesetrue in mkiv?
  2011-12-21 11:16 Is there a replacement for \tracechinesetrue in mkiv? Zhichu Chen
@ 2011-12-21 22:47 ` Hans Hagen
  2011-12-22  1:00   ` Zhichu Chen
  2011-12-29  3:22   ` Zhichu Chen
  0 siblings, 2 replies; 7+ messages in thread
From: Hans Hagen @ 2011-12-21 22:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Zhichu Chen

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Is there a replacement for \tracechinesetrue in mkiv?
  2011-12-21 22:47 ` Hans Hagen
@ 2011-12-22  1:00   ` Zhichu Chen
  2011-12-29  3:22   ` Zhichu Chen
  1 sibling, 0 replies; 7+ messages in thread
From: Zhichu Chen @ 2011-12-22  1:00 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

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 <pragma@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Is there a replacement for \tracechinesetrue in mkiv?
  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-29 14:38     ` Hans Hagen
  1 sibling, 2 replies; 7+ messages in thread
From: Zhichu Chen @ 2011-12-29  3:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 <pragma@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Is there a replacement for \tracechinesetrue in mkiv?
  2011-12-29  3:22   ` Zhichu Chen
@ 2011-12-29 14:18     ` Hans Hagen
  2011-12-30 15:52       ` Zhichu Chen
  2011-12-29 14:38     ` Hans Hagen
  1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2011-12-29 14:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Zhichu Chen

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

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

[-- Attachment #2: crapcrap.pdf --]
[-- Type: application/pdf, Size: 23664 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Is there a replacement for \tracechinesetrue in mkiv?
  2011-12-29  3:22   ` Zhichu Chen
  2011-12-29 14:18     ` Hans Hagen
@ 2011-12-29 14:38     ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2011-12-29 14:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Zhichu Chen

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Is there a replacement for \tracechinesetrue in mkiv?
  2011-12-29 14:18     ` Hans Hagen
@ 2011-12-30 15:52       ` Zhichu Chen
  0 siblings, 0 replies; 7+ messages in thread
From: Zhichu Chen @ 2011-12-30 15:52 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-30 15:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 11:16 Is there a replacement for \tracechinesetrue in mkiv? 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
2011-12-29 14:38     ` Hans Hagen

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).