changes in PDF: font, no cover, paragraph style
authorJan Szejko <janek37@gmail.com>
Thu, 22 Mar 2018 11:11:57 +0000 (12:11 +0100)
committerJan Szejko <janek37@gmail.com>
Thu, 22 Mar 2018 11:11:57 +0000 (12:11 +0100)
librarian/fonts/Dosis-Bold.ttf [new file with mode: 0644]
librarian/fonts/Dosis-ExtraBold.ttf [new file with mode: 0644]
librarian/fonts/Dosis-ExtraLight.ttf [new file with mode: 0644]
librarian/fonts/Dosis-Light.ttf [new file with mode: 0644]
librarian/fonts/Dosis-Medium.ttf [new file with mode: 0644]
librarian/fonts/Dosis-Regular.ttf [new file with mode: 0644]
librarian/fonts/Dosis-SemiBold.ttf [new file with mode: 0644]
librarian/formats/pdf/__init__.py
librarian/formats/pdf/res/wl.cls

diff --git a/librarian/fonts/Dosis-Bold.ttf b/librarian/fonts/Dosis-Bold.ttf
new file mode 100644 (file)
index 0000000..d5e938e
Binary files /dev/null and b/librarian/fonts/Dosis-Bold.ttf differ
diff --git a/librarian/fonts/Dosis-ExtraBold.ttf b/librarian/fonts/Dosis-ExtraBold.ttf
new file mode 100644 (file)
index 0000000..2144a25
Binary files /dev/null and b/librarian/fonts/Dosis-ExtraBold.ttf differ
diff --git a/librarian/fonts/Dosis-ExtraLight.ttf b/librarian/fonts/Dosis-ExtraLight.ttf
new file mode 100644 (file)
index 0000000..2e3bf1b
Binary files /dev/null and b/librarian/fonts/Dosis-ExtraLight.ttf differ
diff --git a/librarian/fonts/Dosis-Light.ttf b/librarian/fonts/Dosis-Light.ttf
new file mode 100644 (file)
index 0000000..a22e7d7
Binary files /dev/null and b/librarian/fonts/Dosis-Light.ttf differ
diff --git a/librarian/fonts/Dosis-Medium.ttf b/librarian/fonts/Dosis-Medium.ttf
new file mode 100644 (file)
index 0000000..3254ef5
Binary files /dev/null and b/librarian/fonts/Dosis-Medium.ttf differ
diff --git a/librarian/fonts/Dosis-Regular.ttf b/librarian/fonts/Dosis-Regular.ttf
new file mode 100644 (file)
index 0000000..4b20862
Binary files /dev/null and b/librarian/fonts/Dosis-Regular.ttf differ
diff --git a/librarian/fonts/Dosis-SemiBold.ttf b/librarian/fonts/Dosis-SemiBold.ttf
new file mode 100644 (file)
index 0000000..5f48caf
Binary files /dev/null and b/librarian/fonts/Dosis-SemiBold.ttf differ
index a8fe38f..bc3d2f5 100644 (file)
@@ -118,26 +118,6 @@ class PdfFormat(Format):
         doc = etree.SubElement(t, TexmlNS('env'), name="document")
         doc.append(texml_cmd("thispagestyle", "empty"))
 
-        # title page
-        height_left = 297
-        cover_url = self.doc.meta.get_one(DCNS('relation.coverimage.url'))
-        if cover_url:
-            self.add_file(build_ctx, 'cover.png', cover_url, image=True)
-            
-            img = Image.open(self.get_file(build_ctx, 'cover.png'))
-            size = img.size
-
-            if size[1] > size[0]:
-                img = img.crop((0, 0, size[0], size[0]))
-                img.save(self.get_file(build_ctx, 'cover.png'), format=img.format, quality=90)
-            size = img.size
-
-            # TODO: hardcoded paper size here
-            height = 210.0 * size[1] / size[0]
-            doc.append(texml_cmd("makecover", "%fmm" % height))
-        else:
-            doc.append(texml_cmd("vfill*"))
-
         # Wielkości!
         grp = etree.SubElement(doc, 'group')
         grp.append(texml_cmd("raggedright"))
@@ -157,8 +137,6 @@ class PdfFormat(Format):
             p[0].append(texml_cmd("noindent"))
             p[0].append(texml_cmd("nohyphens", title))
             # p[0][-1].tail = title
-        doc.append(texml_cmd("vfill"))
-        doc.append(texml_cmd("vfill"))
 
         # IOFile probably would be better
         cover_logo_url = getattr(build_ctx, 'cover_logo', None)
@@ -171,24 +149,19 @@ class PdfFormat(Format):
             p = texml_cmd("par", "")
             doc.append(p)
             p[0].append(texml_cmd("noindent"))
-            p[0].append(texml_cmd("insertimage", 'coverlogo.png', "%fcm" % (1.0 * size[0] / size[1]), "1cm"))
-            
-        # logo organizacji!
-        doc.append(texml_cmd("clearpage"))
+            p[0].append(texml_cmd("insertimage", 'coverlogo.png', "%fcm" % (2.0 * size[0] / size[1]), "2cm"))
+        doc.append(texml_cmd("vspace", "2em"))
 
         ctx = Context(build_ctx, format=self, img=1)
         doc.extend(self.render(self.doc.edoc.getroot(), ctx))
 
         # Redakcyjna na końcu.
-        doc.append(texml_cmd("clearpage"))
-
         doc.append(texml_cmd("section*", "Information about the resource"))
         doc.append(texml_cmd("vspace", "1em"))
 
         for m, f, multiple in (
                 ('Publisher: ', DCNS('publisher'), False),
                 ('Rights: ', DCNS('rights'), False),
-                ('Intended audience: ', DCNS('audience'), True),
                 ('', DCNS('description'), False)):
             if multiple:
                 v = ', '.join(self.doc.meta.get(f))
index f336749..fb2796a 100755 (executable)
@@ -71,6 +71,7 @@
 \usepackage{fontspec}
 \usepackage{xunicode}
 \usepackage{xltxtra}
+\usepackage[Latin,Greek]{ucharclasses}
 
 \usepackage[overload]{textcase}
 \usepackage{scalefnt}
 \usepackage[hyphens]{url}
 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=blue,xetex]{hyperref}
 
+\newfontfamily\substitutefont{GFS Neohellenic}
+\setTransitionsForGreek{\begingroup\substitutefont}{\endgroup}
+
 \ifenablewlfont
 \setmainfont [
-%ExternalLocation,
-%UprightFont = Dosis-Regular,
-UprightFont = JunicodeWL-Regular,
-%ItalicFont = Dosis-SemiBold,
-%BoldFont = Dosis-Bold,
-%BoldItalicFont = Dosis-Bold,
-%SmallCapsFont = Dosis-Regular,
-ItalicFont = JunicodeWL-Italic,
-BoldFont = Junicode-Bold,
-%BoldFont = Junicode-Italic,
-BoldItalicFont = Junicode-BoldItalic,
-SmallCapsFont = JunicodeWL-Regular,
+ExternalLocation,
+UprightFont = Dosis-Regular,
+ItalicFont = Dosis-SemiBold,
+BoldFont = Dosis-Bold,
+BoldItalicFont = Dosis-Bold,
+SmallCapsFont = Dosis-Regular,
+%UprightFont = JunicodeWL-Regular,
+%ItalicFont = JunicodeWL-Italic,
+%BoldFont = Junicode-Bold,
+%BoldItalicFont = Junicode-BoldItalic,
+%SmallCapsFont = JunicodeWL-Regular,
 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 Numbers=OldStyle,
 Scale=1.04,
 LetterSpace=-1.0
-] {Junicode}
+] {Dosis}
 
 %\newfontfamily\alien[
 %\setmainfont[
@@ -156,6 +159,8 @@ Letters={SmallCaps,UppercaseSmallCaps}
 \setlength{\headsep}{0pt}
 \setlength{\textheight}{24cm}
 \setlength{\textwidth}{16cm}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{1em plus0.4em minus0.3em}
 
 
 \pagestyle{fancy}