[Trennmuster] zum Paket selnolig (was: [luatex] What are user-defined whatsit nodes?)
Stephan Hennig
sh-list at posteo.net
So Nov 30 11:08:07 CET 2014
Hallo Mico,
herzlich willkommen auf der Trennmuster-Liste!
Wie auf der luatex-Liste schon angedeutet, haben wir hier eine Idee und
inzwischen auch die Voraussetzungen entwickelt (maßgeblich durch Günters
Arbeit an der Wortliste), um Ligaturen in Wörtern sinnvoll zu setzen.
Bevor ich unsere Idee und die Vorteile gegenüber dem bisherigen Stand
des Pakets selnolig im Detail schildere (vielleicht können das auch
andere tun?), möchte ich jedoch zunächst eine Frage zum besseren
Verständnis von selnolig loswerden.
Ich verfüge nicht über tiefreichende Kenntnisse über die Möglichkeiten
von OTF-Schriften und die technische Unterstützung in LuaTeX.
Allerdings meine ich, dass man in sogenannten Feature-Files Regeln zum
Beispiel zur Glyphenersetzung angeben kann. Die Regeln in Feature-Files
lassen dabei einfache Zeichenkettenvergleiche zu. (Die allerdings nicht
die Mächtigkeit von Liang-Mustern mit vielerlei Prioritätinformation
erreichen. Darauf läuft unser Vorschlag hinaus, aber mehr dazu später).
Wenn ich das Paket selnolig richtig verstehe, wird auch dort mit Hilfe
von einfachen "ermöglichenden" und "verhindernden" Zeichenketten
entschieden, ob an einer bestimmten Stelle ein Whatsit bzw. ZWNJ
eingefügt wird oder auch nicht. Ließen sich (mit ZWNJ) die Fähigkeiten
des Pakets selnolig auch auf Basis von Feature-Files implementieren?
Leider habe ich bis Anfang nächsten Jahres recht wenig Zeit und kann
hier möglicherweise nur unregelmäßig schreiben. Den Rest daher auf die
Schnelle: Erste Informationen zu unserem Repositorium findest du unter
<URL:http://projekte.dante.de/Trennmuster/RepoHaupt>. Allen anderen
hier lesenden empfehle ich die Dokumentation des Pakets selnolig
wenigstens zu überfliegen (insbesondere Abschnitt 3).
Viele Grüße,
Stephan Hennig
Am 27.11.2014 um 13:29 schrieb Mico Loretan:
> Funny that the ZWNJ method should come up, as it so happens that I'm
> working on updating selnolig.
>
> The next version will offer a choice of tree methods for suppressing
> ligatures. In addition to the current method (i.e.,insertion of a
> whatsit) I'm thinking of implementing two further methods: the ZWNJ
> method you describe (very flexible, but requires an Opentype font),
> and what I'll call the babel method for obvious reasons: insertion
> of a discretionary that provides 0.03em of whitespace in case there's
> no line break. The babel method will work with any font (and, its
> name notwithstanding, doesn't require that babel be loaded).
>
> In terms of programming, whereas the whatsit method works with the
> "ligaturing" callback, the two newer methods need to work with the
> "pre_linebreak_filter" callback, which takes an input and provides a
> return. (The ligaturing callback, by contrast, takes two inputs but
> does not provide a return value.)
>
> I've subscribed to the Trennmuster list, by the way.
>
> Best, Mico
>
> Sent from my iPhone.
>
>> Message: 1
>> Date: Wed, 26 Nov 2014 20:18:27 +0100
>> From: Stephan Hennig <sh-list at posteo.net>
>> To: "LuaTeX discussion." <luatex at tug.org>
>> Subject: Re: [luatex] What are user-defined whatsit nodes?
>>
>>> Am 24.11.2014 um 20:23 schrieb Khaled Hosny:
>>>
>>> The ?official? Unicode was for suppressing a ligature is by inserting a
>>> ZWNJ character, so I guess inserting a whatsit is as close
>>
>> That seems to work just as well (see attached example). But ideally,
>> I'd like to not do the low-level node handling myself. I'll post a
>> proposal of what I have in mind in a few days.
>>
>>
>>> (of course if one can get a ZWNJ to the output stream so that
>>> ligature suppression is maintained even when text is copied around,
>>> that would be even better IMO).
>>
>> Doesn't look like that's happening, currently.
>>
>>> BT
>>> /F1 9.96264 Tf 1 0 0 1 91.925 759.927 Tm [(butterflies)-333(butterflies)]TJ
>>> 1 0 0 1 303.509 105.18 Tm [(1)]TJ
>>> ET
>>
>> Best regards,
>> Stephan Hennig
>>
>> % -*- coding: utf-8 -*-
>> \pdfcompresslevel=0
>> \directlua{
>> % Declare constants.
>> local GLYPH = node.id('glyph')
>> local CHAR_f = string.byte('f')
>> local CHAR_l = string.byte('l')
>> local Ncopy = node.copy
>> local Nnew = node.new
>> local Ninsert_before = node.insert_before
>> local Ntraverse = node.traverse
>> % Create ZWNJ template.
>> local zwnj = Nnew(GLYPH)
>> zwnj.char = 0x200c
>> % Register callback.
>> callback.register('ligaturing',
>> function (head, tail)
>> % Iterate over node list.
>> for n in Ntraverse(head) do
>> if n.id == GLYPH and n.char == CHAR_l then
>> local p = n.prev
>> if p.id == GLYPH and p.char == CHAR_f then
>> local zwnjx = Ncopy(zwnj)
>> zwnjx.font = n.font
>> zwnjx.lang = n.lang
>> Ninsert_before(head, n, zwnjx)
>> end
>> end
>> end
>> node.ligaturing(head, tail)
>> end
>> )
>> }
>> \righthyphenmin=3
>> \showhyphens{butterflies}butterflies
>> \righthyphenmin=5
>> \showhyphens{butterflies}butterflies
>> \bye
>>
>>
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> luatex mailing list
>> luatex at tug.org
>> http://tug.org/mailman/listinfo/luatex
>>
>>
>> ------------------------------
>>
>> End of luatex Digest, Vol 71, Issue 19
>> **************************************
>
>
>
Mehr Informationen über die Mailingliste Trennmuster