Gastarbeiter

Tales of a guest worker in Sweden.

To content | To menu | To search

Monday, February 22 2010

Scribus, XeTeX and OpenType

Scribus is an excellent open source DTP program that’s currently under heavy development, new features being added all the time. The developers have a high level of ambition and their product is constantly gaining in popularity. I’ve installed the 1.3.5 version - aka “scribus-ng” - on my Ubuntu desktop and the little “Τεχ” icon in the toolbar immediately caught my attention. That’s right: The text frame is dead, long live the TeX frame!

Most people associate TeX with mathematic typesetting, but it can be used to typeset any kind of document. My favorite TeX typesetting engine is the Unicode-aware XeTeX. Like Scribus, XeTeX is free software and available on most major platforms. Unlike Scribus, XeTeX supports the advanced typographic features of OpenType.

So, what if we could use some of the power of XeTeX to overcome the shortcomings of Scribus? For that, we will need a nice OpenType font to experiment with - I suggest the freely (as in freedom) available Linux Libertine font. Linux Libertine can be viewed as a replacement for the Times New Roman cliché, with added support for some nice features such as historical ct an st ligatures. My purpose in this tutorial is to do the following in Scribus:

Linux Libertine, historical ligatures enabled

As said, Scribus’ old traditional text frames can’t do that at the current stage of development. But XeTeX can, and if XeTeX does it, so does Scribus. Let’s do this together, step by step:

  • Set XeTeX as the default typesetting engine for TeX frames. Go to File, Properties, External Tools and under Render Frames locate LaTeX. Click on Change Command and change the default to this:
    xelatex --interaction=nonstopmode
  • Add a new TeX frame.
  • Edit the source of the frame, and replace the default code with:
\fontspec[Ligatures=Historical,
     SizeFeatures={{Size=50}}]{Linux Libertine O} Acts of the Apostles
  • Inside the code editor, click on the Fonts/Headers tab and replace the defaults with the following:
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}

Done!… But wait a minute, doesn’t the output look a little bit grainy? It does, because the output of XeTeX has been rasterized, and that’s how Scribus renders TeX frames - rasterization. There’s certainly an option allowing you to set the rasterization resolution higher, but at 600 DPI the image still doesn’t look good to me and at 1200 DPI it takes ages to render… And why rasterize anyway? XeTeX renders OpenType fonts as vectors in PDF, and Scribus is certainly vector-aware. Rasterization seems like re-inventing the wheel in this case.

To get a clear picture of what I’m talking about, download this PDF and view it with Adobe Reader. The file was produced in Scribus, and includes the TeX frame produced with the above procedure, as well the same XeTeX output imported in EPS vector format. Check how the samples scale and print and you will notice the difference at once.

The process of producing the vector sample is little more complicated, but definitely worth discussing:

  • Open up your favorite TeX IDE, let’s say Kile, and copy-paste the following:
\documentclass[a4paper]{article}
\usepackage[landscape,vmargin=12pt,hmargin=12pt]{geometry}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\begin{document}
\pagestyle{empty}
\fontspec[Ligatures=Historical,
     SizeFeatures={{Size=50}}]{Linux Libertine O} Acts of the Apostles
\end{document}
  • Save the above as acts.tex.
  • At your Linux command line, create a PDF from your TeX file:
    xelatex acts.tex
  • Use GhostScript’s pdf2ps to convert the PDF to PostScript:
    pdf2ps acts.pdf
  • With another GhostScript tool, the eps2eps2 PostScript “distiller”, grab only the type discarding the whitespace:
    eps2eps acts.ps acts.eps
  • Now in Scribus, go to File, Import, Get Vector File and select acts.eps. Place it in your document.

What’s the point of doing the above? That’s certainly a good question. In my opinion, the above demonstrates that:

  • There’s good quality open source DTP and typesetting software available, right here right now.
  • Using them creatively can help you overcome their apparent shortcomings - if the above is not convincing enough, see what this guy has done typesetting Arabic texts in XeTeX/Scribus.
  • The potential of a closer integration between *TeX and Scribus, bringing the best of two worlds together, is simply amazing.

I certainly hope the Scribus developers value my last point as much as I do, starting by making TeX frames embeddable in vector format!

Update Mar 6, 2010: There seems to be a better way to do this within Scribus, without ever using the command line. You will need the latest version of scribus-ng and the PoDoFo library installed. When exporting to PDF, choose the Embed EPS & PDF files experimental option. This will properly embed the font and its meta-information without resorting to outlining. As this is still an experimental option, you may encounter some quirks regarding e.g. colorspaces. Nevertheless, it has worked perfectly for me and for what I’ve intended to do. Thanks to the Scribus developers for bringing this to my attention.

The above is licensed under the terms of the Creative Commons Attribution-Share Alike 3.0 license.
The author encourages attribution on the web by linking to the source article.

Sunday, September 6 2009

Mythbuster or mythmaker?

As winter approaches, the new H1N1 ‘flu is making lots of headlines. Ranging from the totally unsubstantiated fear-mongering to the more sophisticated and better informed, the medias’ coverage of the pandemic has done a lot to confuse the public who doesn’t seem able to distinguish between these two. One of these headlines that certainly made heavy impact here in Sweden is Dr. Annika Dahlqvist’s claim that a low-carb diet can protect against the new H1N1 influenza.

Dahlqvist, probably the most known low-carb diet proponent in Sweden, made herself known a few years ago by opposing the current nutrition trends and recommending a low-carb, high-fat diet to her patients, including diabetics. She was seriously challenged for being so outspoken and even risked her license as a medical practitioner when she was referred to the Swedish National Board of Health and Welfare, Socialstyrelsen. However the verdict that came out was in her favor, and Dr. Dahlqvist may now continue giving her nutrition advice to patients and the public, walking on the footsteps of the late Robert Atkins.

Being a low-carb diet proponent myself, I was certainly displeased by Dahlqvist’s statement about low-carb diet offering protection against the new ‘flu. Having seen the results of low-carb diet on myself and others, I’m pretty much convinced that this is the way out of obesity, more effective than any low-GI diet and much less troublesome than bariatric surgery. But protection against the ‘flu? Without the slightest evidence to support this claim, Dahlqvist’s statement is completely out of line. Such a profound lack of seriousness has its cost: Dr Dahlqvist is about to face Socialstyrelsen for a another round.

Much like Atkins, Dahlqvist lends her name to a series of products for weight loss, mainly books. She’s also the author of a much-visited blog. Her name and image are widely recognizable and Dahlqvist has managed to turn them into a valuable marketing asset. She has admittedly the gift of the gab and knows how to draw attention to herself - sometimes the wrong way.

Speaking of marketing and lack of seriousness, can somebody please explain what’s a doctor in her white coat, with a stethoscope laid on her shoulders, doing standing next to a cook over a kitchen stove?

Dr. Dahlqvist and Airam's low-carb cookbook

Thursday, February 5 2009

Across the Aegean


Melina Kana - Erima kormia

Baba Zula and Brenna MacCrimmon - Cecom

Friday, January 30 2009

2009 - Year of the mistletoe?

MistletoeVidarkliniken, probably the most controversial health provider in Sweden, was recently granted a year’s respite by the government in order to continue selling their drugs to those who request (and can afford) them. This came amidst heated discussions about Vidarkliniken’s rôle in the Swedish health care system, and whether such medicine should be allowed to be on the market while there’s no scientific evidence to support its usefulness.

Roughly translated as “the clinic beyond”, Vidarkliniken is a private clinic situated in Järna, outside of Stockholm. They describe themselves as “Scandinavia’s only anthroposophic hospital” and offer services such as palliative care, rehabilitation, treatment of chronic anxiety, fibromyalgia etc. Their hospital pharmacy is equipped with drugs that may be accepted by mainstream medicine, or not. The latter are the so-called “anthroposophic drugs”, a legacy of the founder of Anthroposophy, the Austrian mystic Rudolf Steiner.

The flagship “anthroposophic drug” is Iscador, a mistletoe extract that’s marketed as cure against cancer. Vidarkliniken is the place to go if you want access to Iscador — or fervent pro-Iscador advocacy. Iscador’s manufacturer is no other than Weleda, the company co-founded by Steiner himself back in 1921. Below is Steiner’s own testimony on mistletoe’s otherworldly properties:

There are beings whose progress is checked, who remain at a lower stage of evolution. The mistletoe, for instance, is a token of this ancient epoch. It is a survival of the parasitic plant-beings which once lived on the Earth as upon a plant. Hence its peculiar, occult properties, known to the Druids who spoke of it as the most sacred of all plants. Mistletoe is a survival from the lunar epoch of the Earth. It is parasitic because it has not learned, like other plants, to live directly upon mineral substance.

Disease is something of an analogy. It is a regression, caused by the parasitic elements in the organism. The Druids and the Skalds knew of the relation between the mistletoe and man. There is an echo of this in the legend of Baldur. The God Baldur is put to death by the mistletoe because the mistletoe is a hostile element from the preceding epoch — an element no longer united — with man. The other plants, having adapted themselves to the subsequent epoch, swore friendship to him.

Rudolf Steiner, An Esoteric Cosmology

The utter absurdity above would be laughed at by anyone with some scientific background. Nevertheless, Steiner and his adherents created a true mistletoe cult. They noted that the mistletoe bears a resemblance with cancer: Just as cancer feeds on the healthy parts of the body “as a parasite” (sic), so does mistletoe feed on its host plant. By the “doctrine of signatures”, this is a revelation of mistletoe’s purpose of existence, and what makes mistletoe a cure for cancer!

So, out of this concoction of mythology, pseudoscience and occultism emerged Iscador. A miracle drug capitalizing on mistletoe’s perceived uniqueness (as if there weren’t any other parasites in nature), “ethereal surplus” and other irrelevant nonsense. It became soon enough a prosperous industry, a source of hope for the hopeless.

Iscador has been on the market since 1926 but until now there’s no clear evidence from clinical research to demonstrate its effect on cancer patients’ survival or quality of life. This hasn’t stopped Weleda from claiming that their product does work, or the masses of desperate patients swarming to get access to this drug.

“Mistletoe therapy” is marketed as a “complementary” therapy to other, well-established cancer treatments such as chemotherapy, irradiation and surgery — it is even claimed that Iscador reduces the side effects of other cancer treatments. The manufacturer does not promote Iscador as a single therapy. Why? Because of the frightening prospect of cancer patients on Iscador denying themselves any actually useful treatment, and thus suffering devastating consequences upon their health. So the manufacturer has chosen to be on the safe side, declaring Iscador “complementary” to avoid serious legal repercussions.

It’s bad enough that quack “anthroposophic medicine” is allowed to be on the market, while “conventional medicine” has to be extensively tested through laboratory experiments and clinical trials before approval — this is obviously a case of double standards. It’s hard to imagine why an obscure sect gets more credibility than science. A self-proclaimed clairvoyant such as Steiner who just dictates his visions never has to explain how and why things work for him; on the other hand a scientist does.

It’s also criminal that there’s such a prolific industry of selling false hope to desperate people. What adds insult to injury is that Vidarkliniken and “anthroposophic medicine” are actually integrated into the Swedish health care system and receive state funding.

See also

Tuesday, January 27 2009

Welcome

Hello everyone! It took me a while to set this blog up but right now everything seems to be working fine. It’s high time we cut the red ribbon! While I’m writing my first article, allow me to entertain you with this little song:


Lip Dub - Tambureddu HD