ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jeong Dalyoung <haksan@me.com>
To: ntg-context@ntg.nl
Subject: Re: checking mainlanguage setup
Date: Sat, 28 May 2011 11:41:41 +0900	[thread overview]
Message-ID: <FF9877CB-0A1F-454A-AA2C-288F9976D85E@me.com> (raw)
In-Reply-To: <mailman.1220.1306501767.4231.ntg-context@ntg.nl>

Dear Pontus, Marco, and Peter,

Thank you for replies.

I tested the following codes:

1)
\startluacode
if languages.current() == "kr" then
context("Korean")
else
context("Not Korean")
end
\stopluacode

2)
\doifelse\currentlanguage{en}{\def\lang{English}}{\def\lang{Not English}}\par
currentlanguage: \lang

are working well. 

But, the code

\startluacode
if languages.current() == "kr" then
context([[\def\lang{Korean}]]) %("\def\lang{Korean}")
else
context([[\def\lang{English}]]) %("\def\lang{Korean}")
end
\stopluacode

currentlanguage: \lang

is not working. (undifined control sequence error)

I think that there is a simple way to use lua code for this which I don't know. I have to read CLD manual.

Thanks again.

Best regards,

Dalyoung


On 2011. 5. 27., at 오후 10:09, ntg-context-request@ntg.nl wrote:

> Send ntg-context mailing list submissions to
> 	ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
> 	ntg-context-request@ntg.nl
> 
> You can reach the person managing the list at
> 	ntg-context-owner@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: checking mainlanguage setup (Pontus Lurcock)
>   2. Re: checking mainlanguage setup (Marco)
>   3. Re: checking mainlanguage setup (Peter =?utf-8?Q?M=C3=BCnster?=)
>   4. [metafun] graphictext in mkiv (Marco)
>   5. Re: compresslevel and png graphics (mkiv) (Peter Rolf)
>   6. Re: \asciimode and cld (Hans Hagen)
>   7. Re: compresslevel and png graphics (mkiv) (Hartmut Henkel)
>   8. Re: compresslevel and png graphics (mkiv) (Hartmut Henkel)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 27 May 2011 22:11:24 +1200
> From: Pontus Lurcock <pont@talvi.net>
> To: ntg-context@ntg.nl
> Subject: Re: [NTG-context] checking mainlanguage setup
> Message-ID: <20110527101124.GO20248@rae.vm.bytemark.co.uk>
> Content-Type: text/plain; charset=us-ascii
> 
> On Fri 27 May 2011, Jeong Dalyoung wrote:
> 
>> Is it possible to check what is the mainlanguage set in document?
>> Now, I use \enablemode[kr] to do something A. But, I'd like to do it
>> automatically if possible.
> 
> According to http://wiki.contextgarden.net/Modes#System_modes , 
> the mode **kr should be automatically set if kr is the main language
> (I haven't tried it, though).
> 
> Pont
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 27 May 2011 12:22:38 +0200
> From: Marco <netuse@lavabit.com>
> To: ntg-context@ntg.nl
> Subject: Re: [NTG-context] checking mainlanguage setup
> Message-ID: <20110527122238.4c709eb2@glyph>
> Content-Type: text/plain; charset=US-ASCII
> 
>> I'd like to do the following type of setup.
>> 
>> 
>> if mainlanguage == kr then
>> 
>> 	do something A
>> 
>> elseif mainlanguage == en then
>> 
>> 	do something B
>> 
>> else
>> 	do something C
>> 
>> endif
> 
> \starttext
> \startluacode
>  if languages.current() == "kr" then
>    context("Something A")
>  elseif languages.current() == "en" then
>     context("Something B")
>  else
>     context("Something C")
>  end
> \stopluacode
> \stoptext
> 
> Marco
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Fri, 27 May 2011 12:41:46 +0200
> From: pmlists@free.fr (Peter =?utf-8?Q?M=C3=BCnster?=)
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] checking mainlanguage setup
> Message-ID: <87ei3kifx1.fsf@micropit.couberia.bzh>
> Content-Type: text/plain; charset=utf-8
> 
> On Fri, May 27 2011, Jeong Dalyoung wrote:
> 
>> Is it possible to check what is the mainlanguage set in document?
> 
> Yes. Example:
> 
> %\mainlanguage[fr]
> %\language[fr]
> \starttext
> currentlanguage:
> \doifelse\currentlanguage{fr}{French}{Not French}\par
> currentmainlanguage:
> \doifelse\currentmainlanguage{fr}{French}{Not French}\par
> translate: \translate[fr=Fran?ais, en=French]
> \stoptext
> 
> -- 
>           Peter
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Fri, 27 May 2011 12:45:58 +0200
> From: Marco <netuse@lavabit.com>
> To: ntg-context@ntg.nl
> Subject: [NTG-context] [metafun] graphictext in mkiv
> Message-ID: <20110527124558.19b42ca1@glyph>
> Content-Type: text/plain; charset=UTF-8
> 
> The ?graphictext? makro does not work in mkiv, is it a bug
> or intended? This example works in mkii:
> 
> \starttext
> \startMPcode
> draw image(graphictext "FooBar" scaled 8);
> \stopMPcode
> \stoptext
> 
> Marco
> 
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Fri, 27 May 2011 13:57:51 +0200
> From: Peter Rolf <indiego@gmx.net>
> To: ntg-context@ntg.nl
> Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
> Message-ID: <4DDF91BF.8030806@gmx.net>
> Content-Type: text/plain; charset=UTF-8
> 
> Am 26.05.2011 18:17, schrieb Peter Rolf:
>> Am 26.05.2011 12:52, schrieb Peter Rolf:
>>> Am 25.05.2011 21:54, schrieb Hartmut Henkel:
>> [..]
>>>> 
>>>> no. There is a "PNG Copy" function for literal embedding of the PNG
>>>> file, but that triggers only, if the file simultaneously satisfies quite
>>>> a few conditions, which are about: non-interlaced, no palette, no
>>>> transparency, no gamma coming with it, no gamma modification requested,
>>>> no white adjustment in the PNG, and a few more rare others. Else it's
>>>> de-compressed and then re-compressed to the \pdfcompresslevel, and
>>>> additional streams and dicts are added. You see in the log if it finally
>>>> was "PNG Copy" or not.
>>>> 
>> [..]
>>>> 
>>>> These are about the factors affecting the PNG to PDF size. For your big
>>>> PNG graphic you may find a preprocessing (e. g., pngtopnm | pnmtopng
>>>> will definitely remove all fat) that makes it compliant with the "PNG
>>>> copy".
>>>> 
>>> I will give that a try. But I doubt that there is much 'fat' on that
>>> graphic. Anyhow, you never know before you have tried it. :-)
>>> 
>> 
>> No luck. I used imagemagick to convert to pnm and back.
>> Transparency was removed before by adding a white background, also all
>> not critical chunks (ICC profile, backgroundcolor, resolution, creation
>> and modify date, comment) were removed. The graphic is a valid PNG
>> (TweakPNG) and aside from the size, there is nothing special with this
>> graphic. Still no '(PNG copy)'.
>> 
>> @luigi: an ICC profile definitely breaks the <png copy> rules
>> 
>> The only chunks left are
>> 
>> IHDR    PNG image header: 5900x4094, 8bits/sample, truecolor, noninterlaced
>> IDAT    PNG image data
>> ..
>> IDAT    PNG image data
>> IEND    end-of-image marker
>> 
>> Mh, where is the show stopper? The compression method?
>> 
> Looks like some of ConTeXt PDF/X-related settings is causing this. If I
> reduce the code to the pure picture, the '(PNG copy)' is triggered.
> Probably the active color management (default color space) is breaking
> the copy process here.
> 
> Sorry for any inconvenience. I should have tested this case before...
> 
> Best wishes, Peter
> 
> 
>> Regards, Peter
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Fri, 27 May 2011 15:07:33 +0200
> From: Hans Hagen <pragma@wxs.nl>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Cc: Peter M?nster <pmlists@free.fr>
> Subject: Re: [NTG-context] \asciimode and cld
> Message-ID: <4DDFA215.3060000@wxs.nl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 27-5-2011 11:00, Peter M?nster wrote:
>> Hello,
>> 
>> How can one use \asciimode in cld syntax?
>> 
>> This does not seem to work:
>> 
>> context.starttext()
>> context.asciimode()
>> context"bla % bla"
>> context.stoptext()
> 
> \starttext
> 
>     \startluacode
>         context.startTEXpage()
>             context.starttext()
>             context.pushcatcodes("txtcatcodes")
>             context("bla % bla")
>             context.popcatcodes()
>             context.stoptext()
>         context.stopTEXpage()
>     \stopluacode
> 
> \stoptext
> 
> 
> -----------------------------------------------------------------
>                                           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
> -----------------------------------------------------------------
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Fri, 27 May 2011 15:09:14 +0200
> From: "Hartmut Henkel" <hartmut_henkel@gmx.de>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
> 	ntg-context@ntg.nl
> Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
> Message-ID: <20110527130914.171040@gmx.net>
> Content-Type: text/plain; charset="utf-8"
> 
>>> @luigi: an ICC profile definitely breaks the <png copy> rules
>>> 
>>> The only chunks left are
>>> 
>>> IHDR    PNG image header: 5900x4094, 8bits/sample, truecolor,
>> noninterlaced
>>> IDAT    PNG image data
>>> ..
>>> IDAT    PNG image data
>>> IEND    end-of-image marker
>>> 
>>> Mh, where is the show stopper? The compression method?
>>> 
>> Looks like some of ConTeXt PDF/X-related settings is causing this. If I
>> reduce the code to the pure picture, the '(PNG copy)' is triggered.
>> Probably the active color management (default color space) is breaking
>> the copy process here.
> 
> must be some \pdfimageapplygamma > 0, only this and the \pdfimagehicolor
> primitive can influence this low level stuff.
> 
> Btw, just \pdfimageapplygamma > 0 (without setting \pdfgamma and \pdfimagegamma) already changes the PNG image, since the luatex (and pdftex) internal defaults are not gamma-neutral. No idea if (and then
> to which value) this should be fixed.
> 
> Regards, Hartmut
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Fri, 27 May 2011 15:09:14 +0200
> From: "Hartmut Henkel" <hartmut_henkel@gmx.de>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
> 	ntg-context@ntg.nl
> Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
> Message-ID: <20110527130914.171040@gmx.net>
> Content-Type: text/plain; charset="utf-8"
> 
>>> @luigi: an ICC profile definitely breaks the <png copy> rules
>>> 
>>> The only chunks left are
>>> 
>>> IHDR    PNG image header: 5900x4094, 8bits/sample, truecolor,
>> noninterlaced
>>> IDAT    PNG image data
>>> ..
>>> IDAT    PNG image data
>>> IEND    end-of-image marker
>>> 
>>> Mh, where is the show stopper? The compression method?
>>> 
>> Looks like some of ConTeXt PDF/X-related settings is causing this. If I
>> reduce the code to the pure picture, the '(PNG copy)' is triggered.
>> Probably the active color management (default color space) is breaking
>> the copy process here.
> 
> must be some \pdfimageapplygamma > 0, only this and the \pdfimagehicolor
> primitive can influence this low level stuff.
> 
> Btw, just \pdfimageapplygamma > 0 (without setting \pdfgamma and \pdfimagegamma) already changes the PNG image, since the luatex (and pdftex) internal defaults are not gamma-neutral. No idea if (and then
> to which value) this should be fixed.
> 
> Regards, Hartmut
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> 
> 
> ------------------------------
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 
> End of ntg-context Digest, Vol 83, Issue 123
> ********************************************

___________________________________________________________________________________
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-05-28  2:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1220.1306501767.4231.ntg-context@ntg.nl>
2011-05-28  2:41 ` Jeong Dalyoung [this message]
2011-05-28  3:04   ` Aditya Mahajan
     [not found] <mailman.1275.1306911210.4231.ntg-context@ntg.nl>
2011-06-01  7:45 ` Jeong Dalyoung
2011-06-01 12:54   ` Wolfgang Schuster
     [not found] <mailman.1266.1306859874.4231.ntg-context@ntg.nl>
2011-06-01  1:16 ` Jeong Dalyoung
2011-06-01  1:32   ` Aditya Mahajan
     [not found] <mailman.1.1306836001.18520.ntg-context@ntg.nl>
2011-05-31 10:45 ` Jeong Dalyoung
2011-05-31 14:33   ` Procházka Lukáš Ing. - Pontex s. r. o.
2011-06-01  8:14     ` Hans Hagen
2011-06-01  8:22       ` Hans Hagen
     [not found] <mailman.1.1306576802.24208.ntg-context@ntg.nl>
2011-05-28 12:26 ` Jeong Dalyoung
2011-05-28 13:45   ` Hans Hagen
2011-05-31  6:48   ` Procházka Lukáš Ing. - Pontex s. r. o.
2011-05-27  9:49 Jeong Dalyoung
2011-05-27 10:11 ` Pontus Lurcock
2011-05-27 10:22 ` Marco
2011-05-27 10:41 ` Peter Münster

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=FF9877CB-0A1F-454A-AA2C-288F9976D85E@me.com \
    --to=haksan@me.com \
    --cc=ntg-context@ntg.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).