* [luatex-plain] loading patterns
@ 2012-11-14 18:12 Philipp Gesang
2012-11-14 19:15 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Philipp Gesang @ 2012-11-14 18:12 UTC (permalink / raw)
To: ConTeXt ML
[-- Attachment #1.1: Type: text/plain, Size: 1970 bytes --]
Hi all!
(I assume this is the appropriate list for
questions regarding luatex-plain.)
I am trying to enable the Russian hyphenation patterns. The demo
code below works with luatex.fmt but not luatex-plain.fmt (both
from tex live).
More precisely, after loading the hyphenation patterns for, say,
*Latin* I get proper hyphenation. Now when I attempt the same
with *Russian*, nothing is hyphenated. (As lang.patterns(id)
correctly returns the patterns in both cases, I guess something
is missing after updating tex.language.)
Any thoughts? Can someone reproduce this?
Philipp
=================================================================
\def\loadpatterns#1{%
\directlua{
local pattern_source = kpse.find_file"#1"
texio.write_nl("* loading patterns from file " .. pattern_source)
local fh = io.open(kpse.find_file"#1")
local new_patterns = fh:read"*a"
fh:close()
local new_language = lang.new()
lang.patterns(new_language, new_patterns)
tex.language = lang.id(new_language)
%print(lang.patterns(new_language))
}%
}
% ····························································· %
\showhyphens{Циолковский} %% no pattern yet, so both without
\showhyphens{Oenothea} %% hyphenation
% ····························································· %
\loadpatterns{hyph-ru.pat.txt} %% Russian
\showhyphens{Циолковский} %% wrong with luatex-plain
% ····························································· %
\loadpatterns{hyph-la.pat.txt} %% Latin
\showhyphens{Oenothea} %% correct with either
% ····························································· %
\bye
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: 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] 4+ messages in thread
* Re: [luatex-plain] loading patterns
2012-11-14 18:12 [luatex-plain] loading patterns Philipp Gesang
@ 2012-11-14 19:15 ` Hans Hagen
2012-11-15 13:57 ` Philipp Gesang
0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2012-11-14 19:15 UTC (permalink / raw)
To: ConTeXt ML
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]
On 11/14/2012 7:12 PM, Philipp Gesang wrote:
you need to set some lccodes
assuming that you also use the font loader (i.e. luatex-plain), try the
attached files ... the next then works ok
\font\test=dejavuserif at 10pt \test
\hsize 1mm
\noindent Циолковский
\loadpatterns{ru}
\noindent Циолковский
\end
It uses the pattern files that come with context.
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: luatex-languages.lua --]
[-- Type: text/plain, Size: 1701 bytes --]
if not modules then modules = { } end modules ['luatex-languages'] = {
version = 1.001,
comment = "companion to luatex-languages.tex",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
-- We borrow fron ConTeXt.
languages = languages or { }
local loaded = { }
function languages.loadpatterns(tag)
if not loaded[tag] then
loaded[tag] = 0
local filename = kpse.find_file("lang-" .. tag .. ".lua")
if filename and filename == "" then
print("<unknown language file for: " .. tag .. ">")
else
local whatever = loadfile(filename)
if type(whatever) == "function" then
whatever = whatever()
if type(whatever) == "table" then
local characters = whatever.patterns.characters or ""
local patterns = whatever.patterns.data or ""
local exceptions = whatever.exceptions.data or ""
local language = lang.new()
for b in string.utfvalues(characters) do
tex.setlccode(b,b)
end
lang.patterns(language, patterns)
lang.hyphenation(language, exceptions)
loaded[tag] = lang.id(language)
else
print("<invalid language table: " .. tag .. ">")
end
else
print("<invalid language file: " .. tag .. ">")
end
end
end
return loaded[tag]
end
[-- Attachment #3: luatex-languages.tex --]
[-- Type: text/plain, Size: 476 bytes --]
%D \module
%D [ file=luatex-fonts,
%D version=2009.12.01,
%D title=\LUATEX\ Support Macros,
%D subtitle=Generic \OPENTYPE\ Font Handler,
%D author=Hans Hagen,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%D Cf. discussion on \CONTEXT\ list:
\directlua {
dofile(kpse.find_file("luatex-languages.lua","tex"))
}
\def\loadpatterns#1{\directlua{tex.language = languages.loadpatterns("#1")}}
\endinput
[-- Attachment #4: luatex-plain.tex --]
[-- Type: text/plain, Size: 585 bytes --]
%D \module
%D [ file=luatex-plain,
%D version=2009.12.01,
%D title=\LUATEX\ Macros,
%D subtitle=Plain Format,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
\input plain
\directlua {tex.enableprimitives('', tex.extraprimitives())}
\pdfoutput=1
\everyjob \expandafter {%
\the\everyjob
\input {luatex-basics}%
\input {luatex-fonts}%
\input {luatex-languages}%
\input {luatex-mplib}%
}
\edef\fmtversion{\fmtversion+luatex}
\dump
[-- Attachment #5: 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] 4+ messages in thread
* Re: [luatex-plain] loading patterns
2012-11-14 19:15 ` Hans Hagen
@ 2012-11-15 13:57 ` Philipp Gesang
2012-11-15 14:51 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Philipp Gesang @ 2012-11-15 13:57 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 924 bytes --]
···<date: 2012-11-14, Wednesday>···<from: Hans Hagen>···
> On 11/14/2012 7:12 PM, Philipp Gesang wrote:
>
> you need to set some lccodes
>
> assuming that you also use the font loader (i.e. luatex-plain), try
> the attached files ... the next then works ok
Yes it does. Will this become part of of the format eventually?
> \font\test=dejavuserif at 10pt \test
>
> \hsize 1mm
>
> \noindent Циолковский
>
> \loadpatterns{ru}
>
> \noindent Циолковский
>
> \end
>
> It uses the pattern files that come with context.
Hans, thanks a lot for this. A while ago I spent half a day to
import the language system from Context but to no avail. The code
you posted seems to fit my need exactly, for the moment anyways!
Best regards
Philipp
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: 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] 4+ messages in thread
* Re: [luatex-plain] loading patterns
2012-11-15 13:57 ` Philipp Gesang
@ 2012-11-15 14:51 ` Hans Hagen
0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2012-11-15 14:51 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 11/15/2012 2:57 PM, Philipp Gesang wrote:
> ···<date: 2012-11-14, Wednesday>···<from: Hans Hagen>···
>
>> On 11/14/2012 7:12 PM, Philipp Gesang wrote:
>>
>> you need to set some lccodes
>>
>> assuming that you also use the font loader (i.e. luatex-plain), try
>> the attached files ... the next then works ok
>
> Yes it does. Will this become part of of the format eventually?
I've added the files. After all luatex-plain is our official plain
benchmark and patterns are part of the game.
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] 4+ messages in thread
end of thread, other threads:[~2012-11-15 14:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 18:12 [luatex-plain] loading patterns Philipp Gesang
2012-11-14 19:15 ` Hans Hagen
2012-11-15 13:57 ` Philipp Gesang
2012-11-15 14:51 ` 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).