Parcourir la source

Import Chinese fonts from old repo

We won't put the font blobs into Git repo.  Insteadly we fetch them with
wget.  This would accelerate checkout.
Xi Ruoyao il y a 5 ans
Parent
commit
20ddbe4881
8 fichiers modifiés avec 190 ajouts et 1 suppressions
  1. 8 1
      Makefile
  2. 2 0
      fonts/.gitignore
  3. 92 0
      fonts/LICENSE.txt
  4. 15 0
      fonts/Makefile
  5. 16 0
      fonts/md5sums
  6. 33 0
      fopconfig.xml
  7. 2 0
      stylesheets/lfs-xsl/pdf.xsl
  8. 22 0
      stylesheets/lfs-xsl/pdf/lctt-chinese-fonts.xsl

+ 8 - 1
Makefile

@@ -84,13 +84,20 @@ pdf: validate
 	$(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
 	$(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
 
+	@echo "Fetch fonts from the server if necessary..."
+	$(Q)make -C fonts
+
+	@echo "Copying fonts to temporary directory..."
+	$(Q)mkdir -p $(RENDERTMP)/fonts
+	$(Q)cp fonts/* $(RENDERTMP)/fonts
+
 	@echo "Generating PDF file..."
 	$(Q)mkdir -p $(RENDERTMP)/images
 	$(Q)cp images/*.png $(RENDERTMP)/images
 
 	$(Q)mkdir -p $(BASEDIR)
 
-	$(Q)fop -q  $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
+	$(Q)fop -q  $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) -c fopconfig.xml 2>fop.log
 	@echo "$(BASEDIR)/$(PDF_OUTPUT) created"
 	@echo "fop.log created"
 

+ 2 - 0
fonts/.gitignore

@@ -0,0 +1,2 @@
+*.xml
+*.ttc

+ 92 - 0
fonts/LICENSE.txt

@@ -0,0 +1,92 @@
+This Font Software is licensed under the SIL Open Font License,
+Version 1.1.
+
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font
+creation efforts of academic and linguistic communities, and to
+provide a free and open framework in which fonts may be shared and
+improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply to
+any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to,
+deleting, or substituting -- in part or in whole -- any of the
+components of the Original Version, by changing formats or by porting
+the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed,
+modify, redistribute, and sell modified and unmodified copies of the
+Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in
+Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the
+corresponding Copyright Holder. This restriction only applies to the
+primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created using
+the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.

+ 15 - 0
fonts/Makefile

@@ -0,0 +1,15 @@
+all: download
+
+.PHONY: download
+
+download:
+	if ! md5sum -c md5sums; then \
+		awk '{print $$2}' md5sums | wget -c -i - \
+			-B "https://bf.mengyan1223.wang/lfs/fonts/"; \
+		if ! md5sum -c md5sums; then \
+			rm $$(awk '{print $$2}') -f; \
+			awk '{print $$2}' md5sums | wget -c -i - \
+				-B "https://bf.mengyan1223.wang/lfs/fonts/"; \
+		fi; \
+		md5sum -c md5sums; \
+	fi

+ 16 - 0
fonts/md5sums

@@ -0,0 +1,16 @@
+41b19881af2208d9e3eeb3f6243cdde2  sarasa-bolditalic.ttc
+97b10f23bfe0d701c56df65cec4c15f4  sarasa-bolditalic.xml
+748af676e529e2d3450ff729b48512de  sarasa-bold.ttc
+ab4cd30b38f8852eae9cb06343889e8b  sarasa-bold.xml
+c90d52a03271b3e263493fea3dc8b35a  sarasa-italic.ttc
+22da407bd6745f1a886d355a0f931eb9  sarasa-italic.xml
+69a5f30bef5c82da1db39884ac815694  sarasa-regular.ttc
+d000ae4d38d1d39edf6bed42689087b6  sarasa-regular.xml
+9258431e257296f586cdb18faf45ea5d  SourceHanSans-Medium.ttc
+832234e5f92a97a0c7628b614f7e1ca6  SourceHanSans-Medium.xml
+b19e63ce1d2bee4c0e0f60a833f4cdfa  SourceHanSans-Normal.ttc
+e7347ea6aff23341991a2692a6669781  SourceHanSans-Normal.xml
+a057e3b6cfdb1d42e6404c2d78132ca0  SourceHanSerif-Medium.ttc
+9bcf5a4d12250203d2c7dca38b57bcfc  SourceHanSerif-Medium.xml
+b7155e86d9d5a146cec60e05eafad1d0  SourceHanSerif-Regular.ttc
+23bce973248a743bbbd07911f4020099  SourceHanSerif-Regular.xml

+ 33 - 0
fopconfig.xml

@@ -0,0 +1,33 @@
+<fop version="1.0">
+	<renderers>
+		<renderer mime="application/pdf">
+			<fonts>
+				<font metrics-url="fonts/SourceHanSans-Normal.xml" kerning="yes" embed-url="fonts/SourceHanSans-Normal.ttc">
+					<font-triplet name="Source Han Sans SC" style="normal" weight="normal" />
+				</font>
+				<font metrics-url="fonts/SourceHanSans-Medium.xml" kerning="yes" embed-url="fonts/SourceHanSans-Medium.ttc">
+					<font-triplet name="Source Han Sans SC" style="normal" weight="bold" />
+				</font>
+				<font metrics-url="fonts/SourceHanSerif-Regular.xml" kerning="yes" embed-url="fonts/SourceHanSerif-Regular.ttc">
+					<font-triplet name="Source Han Serif SC" style="normal" weight="normal" />
+				</font>
+				<font metrics-url="fonts/SourceHanSerif-Medium.xml" kerning="yes" embed-url="fonts/SourceHanSerif-Medium.ttc">
+					<font-triplet name="Source Han Serif SC" style="normal" weight="bold" />
+				</font>
+				<font metrics-url="fonts/sarasa-regular.xml" kerning="yes" embed-url="fonts/sarasa-regular.ttc">
+					<font-triplet name="Sarasa Term SC" style="normal" weight="normal" />
+				</font>
+				<font metrics-url="fonts/sarasa-bold.xml" kerning="yes" embed-url="fonts/sarasa-bold.ttc">
+					<font-triplet name="Sarasa Term SC" style="normal" weight="bold" />
+				</font>
+				<font metrics-url="fonts/sarasa-italic.xml" kerning="yes" embed-url="fonts/sarasa-italic.ttc">
+					<font-triplet name="Sarasa Term SC" style="italic" weight="normal" />
+					<font-triplet name="Source Han Serif SC" style="italic" weight="normal" />
+				</font>
+				<font metrics-url="fonts/sarasa-bolditalic.xml" kerning="yes" embed-url="fonts/sarasa-bolditalic.ttc">
+					<font-triplet name="Sarasa Term SC" style="italic" weight="bold" />
+				</font>
+			</fonts>
+		</renderer>
+	</renderers>
+</fop>

+ 2 - 0
stylesheets/lfs-xsl/pdf.xsl

@@ -105,4 +105,6 @@ $Date$
     <fo:block break-before='page'/>
   </xsl:template>
 
+  <xsl:include href="pdf/lctt-chinese-fonts.xsl"/>
+
 </xsl:stylesheet>

+ 22 - 0
stylesheets/lfs-xsl/pdf/lctt-chinese-fonts.xsl

@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!--
+$LastChangedBy: krejzi $
+$Date: 2013-12-10 19:37:38 -0400 (Tue, 10 Dec 2013) $
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                exclude-result-prefixes="xlink"
+                version="1.0">
+
+  <xsl:param name="body.font.family">Source Han Serif SC</xsl:param>
+  <xsl:param name="dingbat.font.family">Source Han Serif SC</xsl:param>
+  <xsl:param name="sans.font.family">Source Han Sans SC</xsl:param>
+  <xsl:param name="slide.font.family">Source Han Sans SC</xsl:param>
+  <xsl:param name="slide.title.font.family">Source Han Sans SC</xsl:param>
+  <xsl:param name="title.font.family">Source Han Sans SC</xsl:param>
+  <xsl:param name="monospace.font.family">Sarasa Term SC</xsl:param>
+
+</xsl:stylesheet>