Re: [NTG-context] checking mainlanguage setup
![](https://secure.gravatar.com/avatar/ecffc5c1eb6692198d091ee98e921822.jpg?s=120&d=mm&r=g)
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
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
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
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
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
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
To: mailing list for ConTeXt users Cc: Peter M?nster 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"
To: mailing list for ConTeXt users , 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"
To: mailing list for ConTeXt users , 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 ********************************************
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Sat, 28 May 2011, Jeong Dalyoung wrote:
\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)
(Untested) try context.setvalue("lang", "English") or context([[\\def\\lang{English}]]) Aditya
participants (2)
-
Aditya Mahajan
-
Jeong Dalyoung