Dear subscribers, 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. 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. 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 ;-) 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 ? 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. 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' ;-) . (Yes, thats C#, even if I wrote F#. The source is currently a combination of (C&F)# Libraries) Pango.Layout pgLayout2 = Pango.CairoHelper.CreateLayout(ctx); pgLayout2.Wrap = Pango.WrapMode.Word; pgLayout2.Alignment = Pango.Alignment.Left; pgLayout2.SingleParagraphMode = true; pgLayout2.Justify = true; pgLayout2.Width = Convert.ToInt32(GlobalPageWidth * Pango.Scale.PangoScale); pgLayout2.Spacing = Convert.ToInt32(5 * Pango.Scale.PangoScale); pgLayout2.FontDescription = Pango.FontDescription.FromString("Linux Libertine 8"); pgLayout2.SetMarkup("..some longer raw text input..."); var resultlines = pgLayout2.Lines 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. So, the question is: Is there anything like this ? Thanks alot for any information about this ! This text will be also posted on the Cairo 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. Greetings ! roland schwarz |