<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<font face="Courier New, Courier, monospace">Dear subscribers, <br>
</font><font face="Courier New, Courier, monospace"><br>
I hope that my following question is not too far away from the
common discussion context in this list, I have a question
regarding the Pango library and hyphenation of textual input.<br>
</font><font face="Courier New, Courier, monospace"><br>
At the moment I am working on a project that deals with the
typesetting of so called 'critical editions' from language and
literature studies. Our goal is to build a tool that can process
given XML input with some user definable stylesheets into a -
primarily - PDF output.<br>
</font><font face="Courier New, Courier, monospace">The coding
platform is F# with the .net framework, and I have to keep in mind
only using the features that are available on mono too, as this
should be kind of platform independent ;-) <br>
</font><font face="Courier New, Courier, monospace"><br>
To avoid reinventing the wheel we tried out parts of the
Cairo/Pango library, and got good results with the output in PDF
format, basic line breaking and text formatting. As our
development continues, we have the problem that we need to support
a kind of hyphenation for our textual input, and that is the core
of my current problem: Is there any kind of useable hyphenation
support in the Pango library ?<br>
</font><font face="Courier New, Courier, monospace"><br>
I have found several discussions about this point, some of them 8
years old, but nothing so far that looks like a code example or a
'how to' e.g. plug in some hyphenation patterns known from teX or
something similar.<br>
</font><font face="Courier New, Courier, monospace"><br>
To explain the current approach and why we are looking for a kind
of automatic hyphenation, there is a small code extract from the
current 'playground prototype' ;-) .<br>
</font><font face="Courier New, Courier, monospace">(Yes, thats C#,
even if I wrote F#. The source is currently a combination of
(C&F)# Libraries)<br>
</font><font face="Courier New, Courier, monospace"><br>
Pango.Layout pgLayout2 =
Pango.CairoHelper.CreateLayout(ctx);<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.Wrap = Pango.WrapMode.Word;<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.Alignment = Pango.Alignment.Left;<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.SingleParagraphMode = true;<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.Justify = true;<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.Width = Convert.ToInt32(GlobalPageWidth *
Pango.Scale.PangoScale);<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.Spacing = Convert.ToInt32(5 * Pango.Scale.PangoScale);<br>
</font><font face="Courier New, Courier, monospace">
pgLayout2.FontDescription =
Pango.FontDescription.FromString("Linux Libertine 8");</font><br>
<font face="Courier New, Courier, monospace">
pgLayout2.SetMarkup("..some longer raw text input...");<br>
</font><font face="Courier New, Courier, monospace">
var resultlines = pgLayout2.Lines<br>
</font><font face="Courier New, Courier, monospace"><br>
So, what we are doing is using the Layout Class of Pango, pass
some formatting attributes to it and let the layout-class do the
work to split the given text into Layoutlines. Those layout lines
are then used for the current pagination algorithm, as they also
include the most relevant geometric information and can be just
placed in the pdf output using a Context.moveto(x,y) and the
showLayoutline-function. The feature we are now looking for is a
build-in hyphenation with the Layout-class.<br>
</font><font face="Courier New, Courier, monospace"><br>
So, the question is: Is there anything like this ? <br>
<br>
Thanks alot for any information about this !<br>
</font><font face="Courier New, Courier, monospace">This text will
be also posted on the</font><font face="Courier New, Courier,
monospace"> Pango mailing list as well as there are two different
mailing lists given for Cairo and Pango. I hope not to offend
someone with this procedure.<br>
</font><font face="Courier New, Courier, monospace"><br>
Greetings !<br>
<br>
roland schwarz<br>
</font> <br>
</body>
</html>