LibOConf2011_DTP

37
1 LibreOffice Paris 2011 Conference – Towards Desktop Publishing Towards Desktop Publishing László Németh FSF.hu Foundation, Hungary

Transcript of LibOConf2011_DTP

Page 1: LibOConf2011_DTP

1LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Towards Desktop PublishingLászló NémethFSF.hu Foundation, Hungary

Page 2: LibOConf2011_DTP

2LibreOffice Paris 2011 Conference – Towards Desktop Publishing

In memoriam Keith Stribley (1976–2011)OpenOffice.org/LibreOffice developer

Page 3: LibOConf2011_DTP

3LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Why Desktop Publishing?

Competitive featureMS Office 2010: a few optional OpenType features

Niche in open source DTPHuge, mostly text documentsGenerated & structured documents (ODF)

Answer for real problemsi18nUnique in open source DTP (eg. Scribus is a page layout program without orphan/widow control).

Attractive feature for professionalsBetter, than bad typography (WordArt/Fontwork)

Page 4: LibOConf2011_DTP

4LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Why Graphite?

Smart font technology of LibreOffice (since OOo 3.2)Open standard with open source reference library (unlike Apple AAT)Answers for major and minor language related/typographical problems

Graphite smart font logic in the font files, described in GDL language and compiled by the Graphite compiler (OpenType is not so general and more vendor specific)Languages (free SIL Graphite fonts): Burmese, Coptic, Ethiopic, Greek, Khmer etc.

Page 5: LibOConf2011_DTP

5LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Towards DTP

Advanced fonts for DTPFix Graphite integrationStandardizationDTP GUIPDF output for printingOpenType supportOther LibreOffice developmentsTest examplesEtc. (extended LibreOffice help)

Page 6: LibOConf2011_DTP

6LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Linux Libertine and Biolinum

Developed by Philipp H. Poll since 2003http://www.linuxlibertine.orgMore than 2000 glyphsLinux Libertine

Modern baroque font faceRegular, Italic, Bold, Semibold, Bold ItalicDisplay: regular font variant for greater point sizeTrue small caps, superiors, old figures

Linux BiolinumHumanist sans serif (modeled after Zapf's Optima)Regular, Bold, Italic, Bold Italic

Page 7: LibOConf2011_DTP

7LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Linux Libertine G and Linux Biolinum G

Advanced fonts of LibreOfficeGraphite port: kerning, features, anchors (OTF2GDL)Default ligatures, thousand separation, minus signOptional true small caps, old figures, superiors, regular parentheses in Italic, Tex mode for math inputExtended superiors for footnote texts etc.Usage: extended font names (or Graphite extensions)Fixes for bugs reported years ago

Right aligned footnote numberingFootnote annotation: 1, 2, 3 .Native numbering (Chapter Two.), etc.

Page 8: LibOConf2011_DTP

8LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Example » Ligatures

Letter replacements for better kerning & layoutLiving tradition in typographyLinux Libertine:

Unicode: ff, fi, fl, ffi, ffl, st, ff, fi, fl, ffi, ffl, ij, stExtra: c, fb, fh, ffh, fj, ffj, fk, ffk, Th, Q

c, f, f, f, f, T, QExtra ligatures of Linux Libertine G:

gf, gfö, gfi, gj (frequent in Hungarian)g (Hungarian digraph – optional ligature)

Page 9: LibOConf2011_DTP

9LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Example » Number variants

Old figuresProportional numbersCase variant for uppercase texts

|0|1|2|3|4|5|6|7|8|9| 1945 to 2011 (default)|0|1|2|3|4|5|6|7|8|9| 1945 to 2011 (onum)|0|1|2|3|4|5|6|7|8|9| 1945 to 2011 (o+pnum)|0|1|2|3|4|5|6|7|8|9| 1945 to 2011 (pnum)|0|1|2|3|4|5|6|7|8|9| 1945 TO 2011 (CASE)

Page 10: LibOConf2011_DTP

10LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Example » True small caps

Fix letter mixing and bad kerning with fake small caps

True Small CapsTrue Small CapsTrue Small CapsTrue Small Caps

Page 11: LibOConf2011_DTP

11LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Optical weighting

Three optical weights of Linux Libertine G (like expensive Adobe font families for InDesign) in the upcoming version of LibreOffice:

Linux Libertine (for 8–16 pt)The quick brown fox jumps over the lazy dog.Linux Libertine Display (16 pt\)

The quick brown fox jumps over the lazy dog.Linux Libertine Caption (\8 pt, with feature sups)The quick brown fox jumps over the lazy dog.

Page 12: LibOConf2011_DTP

12LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Optical weighting II

Comparison of the letter k of these three weights

Display Normal Caption (superior)

Page 13: LibOConf2011_DTP

13LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Example » Using styles for typography

Fix fake footnote index numbers:Set “Linux Libertine G:sups=1&pnum=1” extendedfont name in thedefault characterstyle “Footnoteanchor”And set normalposition

Page 14: LibOConf2011_DTP

14LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Optical margin

Hanging punctuation (feature hang)hang=2 for automatic hyphenhang=1 for other (non-automatic) punctuation marks (experimental)

For letters: initial LinuxLibertine development

Page 15: LibOConf2011_DTP

15LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Combining diacritics

Requirement of languages and scientific notationsLetter + Unicode marks (U+300–U+36F), see inputAnchoring: o, gCase variants: m, MMultiple combining diacritical marks: o, OSuperiors: mw Small caps: maKerning

AVAW, AVAW

Page 16: LibOConf2011_DTP

16LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Task » Fix Graphite integration

GDL rules for line boundaries not supported (need for optical margin)New Graphite engine in LibO 3.4: Graphite 2

Missing space detection (need for Italic correction)Missing space replacement (for space variants in small caps, all caps and superiors)

Page 17: LibOConf2011_DTP

17LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Task » Standardization

Recent usage in OpenOffice.org/LibreOffice:Extended font names, eg. Linux Libertine G with small caps, old figures and proportional numbers:Linux Libertine G:smcp=1&onum=1&pnum=1Use font alternatives for better ODF compatibility:Linux Libertine G:onum=1;Linux Libertine G

Proposal for adding Font Feature support to ODF by Keith Stribley & Martin Hosken

Page 18: LibOConf2011_DTP

18LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Task » DTP GUI

Smart font GUIRecent tools: Graphite extension by Keith StribleyTypography toolbar

DTP GUI for advanced text and paragraph settingsLast line justificationMicrotypography “slider”

Minimal difference in paragraph/text width can fix huge hyphenation/typographical problems of the paragraph

Page 19: LibOConf2011_DTP

19LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Task » OpenType support

Via Graphite engineRun-time conversion of OpenType tables to GDLRun-time GDL compilingUsing the same TrueType font with the new Graphite tablesTools: Fontforge/Graphite compiler/OTFGDL

Page 20: LibOConf2011_DTP

20LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Task » PDF for printing

Industrial requirementsCropped and monochrome/CMYK PDFsFuture options in PDF export

Recent solution: post-processing of PDFSet cropping (CropBox)gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf -c .setpdfwrite -f doc.pdf pdfmark.txt

Content of pdfmark.txt:% cropping box coordinates in pt (x1 y1 x2 y2), here 5 mm (A4)[/CropBox [14.17 14.17 581.1 827.72] /PAGES pdfmark

Color conversiongs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sColorConversionStrategy=CMYK -sOutputFile=doc_CMYK.pdf -dProcessColorModel=/DeviceCMYK -dCompatibilityLevel=1.4 doc.pdf gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -sOutputFile=doc_gray.pdf -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 doc.pdf

Page 21: LibOConf2011_DTP

21LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Task » Table styles

ODF feature, missing in LibreOffice“Huge effort” to implement (OOo Issue 111121)Temporary solution: table style extension, using macros and autoformat styles

Example: modify all tables by one of the autoformat styles:

for i = 0 to ThisComponent.TextTables.CountThisComponent.TextTables(i).autoFormat("Blue")

next I

Page 22: LibOConf2011_DTP

22LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Other tasks

Vertical alignment (OOo Issue 201386, 791877)Paragraph-level justificationHyphenation zone for left aligned textsZone for automatic justification of the last lineBetter justification with letter scalingKerning of the automatic hyphen markRight aligned footnote numbering (recent solution: feature algn of Linux Libertine G)Separated columns of multiline titles and page numbers in TOC (MS Office: hidden feature by tabulator positions exceeding paragraph width)

Page 23: LibOConf2011_DTP

23LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Case studies

Keith Humble: Earliest piano worksKiadványszerkesztés LibreOffice Writer szövegszerkesztővelLively AlphabetBible

Page 24: LibOConf2011_DTP

24LibreOffice Paris 2011 Conference – Towards Desktop Publishing

An early adopter from Australia

Edited by Kim Bastin, 2010

Page 25: LibOConf2011_DTP

25LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Editorial notes with Linux Libertine G

Ligatures, old figures, true small caps and superiors

Page 26: LibOConf2011_DTP

26LibreOffice Paris 2011 Conference – Towards Desktop Publishing

DTP with LibreOffice Writer

Textbook & example

Page 27: LibOConf2011_DTP

27LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Page layout demo of the textbook

Page 28: LibOConf2011_DTP

28LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Extensive frame handling in LibreOffice

Page 29: LibOConf2011_DTP

29LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Lively Alphabet

Open source coloring bookhttp://www.numbertext.org/linux/Lively_Alphabet.pdf http://www.numbertext.org/linux/Lively_Alphabet.odpDemo of the new font size variant and SVGLinux Libertine Display

High quality size variantFor titles, business cards, children books

SVG picture formatW3C open standardHigh quality vector graphics in LibreOfficeUse external vectorization (Inkscape/potrace)

Page 30: LibOConf2011_DTP

30LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Page 31: LibOConf2011_DTP

31LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Typesetting Bible » Motivations

Huge test document (Bible ~ books)Free text (except the recent revisions and new translations)Tradition

Johannes Gutenberg (1455, 42-line Bible)Misztótfalusi Kis Miklós (1685, “Aranyos Biblia”)

SIL International (Graphite font technology)Christian non-profit organizationprimary partner of Wycliffe Bible Translators

Christian LibreOffice developersGolden rule & free software (see GNU manifesto)

Page 32: LibOConf2011_DTP

32LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Typesetting Bible » Methods

HTML version of the Bible (Hungarian Károli)Unix command line: convert to a single HTML filecat `grep -o '[-a-z0-9]*/[a-z0-9]*.html' {o,uj}/index.html | sed \ 's/index.html:\?//g;s/$/chap*/' > biblia.html

Convert to OpenDocument using ODFpy libraryimport re, sysfrom odf.opendocument import OpenDocumentTextfrom odf.style import Style, TextProperties, ParagraphProperties, FontFacefrom odf.text import P, H, Span

textdoc = OpenDocumentText()

# Fonttextdoc.fontfacedecls.addElement((FontFace(name="Linux Libertine G",fontfamily="Linux Libertine G", fontfamilygeneric="roman",fontpitch="variable")))textdoc.fontfacedecls.addElement((FontFace(name="Linux Libertine Display G",fontfamily="Linux Libertine Display G", fontfamilygeneric="roman",fontpitch="variable")))textdoc.fontfacedecls.addElement((FontFace(name="sups",fontfamily="Linux Libertine G:sups=1", fontfamilygeneric="roman",fontpitch="variable")))

# Styless = textdoc.stylesStandardStyle = Style(name="Standard", family="paragraph")s.addElement(StandardStyle) TextBodyStyle = Style(name="Text_20_body",family="paragraph", parentstylename='Standard', displayname="Text body")TextBodyStyle.addElement(ParagraphProperties(margintop="0pt",marginbottom="0pt", textalign="justify"))TextBodyStyle.addElement(TextProperties(fontname="Linux Libertine G",hyphenate="true", language="hu", country="HU"))s.addElement(TextBodyStyle)

h1style = Style(name="Heading 1", family="paragraph")h1style.addElement(TextProperties(attributes ={'fontsize':"24pt",'fontname': 'Linux Libertine Display G' }))s.addElement(h1style)

# An automatic styleboldstyle = Style(name="Bold", family="text")boldprop = TextProperties(fontweight="bold")boldstyle.addElement(boldprop)textdoc.automaticstyles.addElement(boldstyle)supsstyle = Style(name="Superiors", family="text")supsprop = TextProperties(fontname="sups")supsstyle.addElement(supsprop)textdoc.automaticstyles.addElement(supsstyle)

f = open("biblia.html", "r")remove_tags = re.compile("<[^>]*>")

p = P(stylename="Text body")

for i in f:if "TITLE" in i:if " 1 Fejezet" in i:t = re.sub(remove_tags, "", unicode(i, "utf-8").replace(", 1 Fejezet", "").strip())textdoc.text.addElement(H(outlinelevel=1, stylename=h1style, text=t))textdoc.text.addElement(p)p = P(stylename="Text body")ch = re.sub("^.* ([0-9]*) Fejezet.*$", r"\1", unicode(i, "utf-8"))p.addElement(Span(stylename="Bold",text=ch))if "para_" in i:if "A NAME" in i:p.addElement(Span(stylename="Superiors", text = " " + re.sub("^.*para_([0-9]*).*$", r"\1", unicode(i.strip(), "utf-8"))))p.addText(re.sub(remove_tags, "", unicode(i, "utf-8").strip()))

textdoc.text.addElement(p)textdoc.save("text.odt")

Page 33: LibOConf2011_DTP

33LibreOffice Paris 2011 Conference – Towards Desktop Publishing

~770 A4 pages (font size: 12 pt)PDF output: 5.7 Mb (conversion takes a few minutes)Catched and fixed bug:

bad hyphenation of words with leading and trailing numbers (numbering of sentences of the Bible)Fixed by Hyphen 2.8.3 (hyphenation library of LibreOffice)

Typesetting Bible » Results

Page 34: LibOConf2011_DTP

34LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Example » Bible in LibreOffice

Page 35: LibOConf2011_DTP

35LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Desktop publishing in LibreOffice

True small caps

Language specific kerning

Ligatures

Optical weighting (Display)

Hanging punctuationProportional numbers

Optical weighting (Caption)

Page 36: LibOConf2011_DTP

36LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Summary

LibreOffice is a free DTP alternative with several advanced typographical features:

High quality free font technology & fonts with true small caps, ligatures, old figures, optical weighting, and experimental optical margin alignmentStyles, frames, macros, XML based open file format (ODF) for complex typesettingExcellent PDF and SVG support

LibreOffice DTP projectFixes and enhancements with competitive featuresDocumented case studies and real-world examples

Page 37: LibOConf2011_DTP

37LibreOffice Paris 2011 Conference – Towards Desktop Publishing

Thank you for your attention!

More information:http://www.numbertext.org/linux

Main sponsor of Graphite porting of Libertine Open Fonts for LibreOffice: FSF.hu Foundation, Hungary