summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-06-23 16:41:18 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-29 11:10:07 +0200
commit954e3bb173c3302bf458875e86c49c712f0789d4 (patch)
tree4650ec1dc82717d9b29f5996ed72bf4e0bc9d516
parentcd100e900b4bd5de4fd9b5971a00fa7c280bcd7d (diff)
downloadmupdf-954e3bb173c3302bf458875e86c49c712f0789d4.tar.xz
Add Source Han Sans CJK per-language fonts.
Import fonts from v1.004.
-rw-r--r--Makefile10
-rw-r--r--platform/win32/generate.bat5
-rw-r--r--platform/win32/libfonts.vcproj16
-rw-r--r--resources/fonts/han/LICENSE.txt92
-rw-r--r--resources/fonts/han/README.md37
-rw-r--r--resources/fonts/han/SourceHanSansCN-Regular.otfbin0 -> 8369364 bytes
-rw-r--r--resources/fonts/han/SourceHanSansJP-Regular.otfbin0 -> 4480124 bytes
-rw-r--r--resources/fonts/han/SourceHanSansKR-Regular.otfbin0 -> 4560056 bytes
-rw-r--r--resources/fonts/han/SourceHanSansTW-Regular.otfbin0 -> 5649140 bytes
-rw-r--r--source/fitz/noto.c16
10 files changed, 172 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b69e7547..38758966 100644
--- a/Makefile
+++ b/Makefile
@@ -115,22 +115,26 @@ $(GPRF_OBJ) : $(FITZ_HDR) $(GPRF_HDR) $(GPRF_SRC_HDR)
FONT_BIN_DROID := $(wildcard resources/fonts/droid/*.ttf)
FONT_BIN_NOTO := $(wildcard resources/fonts/noto/*.ttf)
+FONT_BIN_HAN := $(wildcard resources/fonts/han/*.otf)
FONT_BIN_URW := $(wildcard resources/fonts/urw/*.cff)
FONT_BIN_SIL := $(wildcard resources/fonts/sil/*.cff)
FONT_GEN_DROID := $(subst resources/fonts/droid/, $(GEN)/, $(addsuffix .c, $(basename $(FONT_BIN_DROID))))
FONT_GEN_NOTO := $(subst resources/fonts/noto/, $(GEN)/, $(addsuffix .c, $(basename $(FONT_BIN_NOTO))))
+FONT_GEN_HAN := $(subst resources/fonts/han/, $(GEN)/, $(addsuffix .c, $(basename $(FONT_BIN_HAN))))
FONT_GEN_URW := $(subst resources/fonts/urw/, $(GEN)/, $(addsuffix .c, $(basename $(FONT_BIN_URW))))
FONT_GEN_SIL := $(subst resources/fonts/sil/, $(GEN)/, $(addsuffix .c, $(basename $(FONT_BIN_SIL))))
-FONT_BIN := $(FONT_BIN_DROID) $(FONT_BIN_NOTO) $(FONT_BIN_URW) $(FONT_BIN_SIL)
-FONT_GEN := $(FONT_GEN_DROID) $(FONT_GEN_NOTO) $(FONT_GEN_URW) $(FONT_GEN_SIL)
+FONT_BIN := $(FONT_BIN_DROID) $(FONT_BIN_NOTO) $(FONT_BIN_HAN) $(FONT_BIN_URW) $(FONT_BIN_SIL)
+FONT_GEN := $(FONT_GEN_DROID) $(FONT_GEN_NOTO) $(FONT_GEN_HAN) $(FONT_GEN_URW) $(FONT_GEN_SIL)
FONT_OBJ := $(subst $(GEN)/, $(OUT)/fonts/, $(addsuffix .o, $(basename $(FONT_GEN))))
$(GEN)/%.c : resources/fonts/droid/%.ttf $(FONTDUMP)
$(QUIET_GEN) $(FONTDUMP) $@ $<
$(GEN)/%.c : resources/fonts/noto/%.ttf $(FONTDUMP)
$(QUIET_GEN) $(FONTDUMP) $@ $<
+$(GEN)/%.c : resources/fonts/han/%.otf $(FONTDUMP)
+ $(QUIET_GEN) $(FONTDUMP) $@ $<
$(GEN)/%.c : resources/fonts/urw/%.cff $(FONTDUMP)
$(QUIET_GEN) $(FONTDUMP) $@ $<
$(GEN)/%.c : resources/fonts/sil/%.cff $(FONTDUMP)
@@ -139,7 +143,9 @@ $(GEN)/%.c : resources/fonts/sil/%.cff $(FONTDUMP)
$(FONT_OBJ) : $(FONT_GEN)
$(FONT_GEN_DROID) : $(FONT_BIN_DROID)
$(FONT_GEN_NOTO) : $(FONT_BIN_NOTO)
+$(FONT_GEN_HAN) : $(FONT_BIN_HAN)
$(FONT_GEN_URW) : $(FONT_BIN_URW)
+$(FONT_GEN_SIL) : $(FONT_BIN_SIL)
# --- Library ---
diff --git a/platform/win32/generate.bat b/platform/win32/generate.bat
index 8e7a79df..6e073d3c 100644
--- a/platform/win32/generate.bat
+++ b/platform/win32/generate.bat
@@ -52,6 +52,11 @@ if not exist generated/CharisSIL-I.c fontdump.exe generated/CharisSIL-I.c resour
if not exist generated/CharisSIL-B.c fontdump.exe generated/CharisSIL-B.c resources/fonts/sil/CharisSIL-B.cff
if not exist generated/CharisSIL-BI.c fontdump.exe generated/CharisSIL-BI.c resources/fonts/sil/CharisSIL-BI.cff
+if not exist generated/SourceHanSansCN-Regular.c fontdump.exe generated/SourceHanSansCN-Regular.c resources/fonts/sil/SourceHanSansCN-Regular.otf
+if not exist generated/SourceHanSansJP-Regular.c fontdump.exe generated/SourceHanSansJP-Regular.c resources/fonts/sil/SourceHanSansJP-Regular.otf
+if not exist generated/SourceHanSansKR-Regular.c fontdump.exe generated/SourceHanSansKR-Regular.c resources/fonts/sil/SourceHanSansKR-Regular.otf
+if not exist generated/SourceHanSansTW-Regular.c fontdump.exe generated/SourceHanSansTW-Regular.c resources/fonts/sil/SourceHanSansTW-Regular.otf
+
if not exist generated/NotoEmoji-Regular.c fontdump.exe generated/NotoEmoji-Regular.c resources/fonts/noto/NotoEmoji-Regular.ttf
if not exist generated/NotoKufiArabic-Regular.c fontdump.exe generated/NotoKufiArabic-Regular.c resources/fonts/noto/NotoKufiArabic-Regular.ttf
if not exist generated/NotoNaskhArabic-Regular.c fontdump.exe generated/NotoNaskhArabic-Regular.c resources/fonts/noto/NotoNaskhArabic-Regular.ttf
diff --git a/platform/win32/libfonts.vcproj b/platform/win32/libfonts.vcproj
index 6fa6d61d..9ab7dcda 100644
--- a/platform/win32/libfonts.vcproj
+++ b/platform/win32/libfonts.vcproj
@@ -877,6 +877,22 @@
>
</File>
<File
+ RelativePath="..\..\generated\SourceHanSansCN-Regular.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generated\SourceHanSansJP-Regular.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generated\SourceHanSansKR-Regular.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generated\SourceHanSansTW-Regular.c"
+ >
+ </File>
+ <File
RelativePath="..\..\generated\StandardSymbolsPS.c"
>
</File>
diff --git a/resources/fonts/han/LICENSE.txt b/resources/fonts/han/LICENSE.txt
new file mode 100644
index 00000000..d952d62c
--- /dev/null
+++ b/resources/fonts/han/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.
diff --git a/resources/fonts/han/README.md b/resources/fonts/han/README.md
new file mode 100644
index 00000000..3f552210
--- /dev/null
+++ b/resources/fonts/han/README.md
@@ -0,0 +1,37 @@
+# Source Han Sans
+
+Source Han Sans is a set of OpenType/CFF Pan-CJK fonts. In addition to functional OpenType fonts, this open source project provides all of the source files that were used to build these OpenType fonts by using the AFDKO *makeotf* and *otf2otc* tools.
+
+## Download the fonts (OTF, OTC, Super OTC, Subset OTF)
+
+Individual font resources or ZIP files for various deployment configurations are available for download:
+
+* [Latest release](https://github.com/adobe-fonts/source-han-sans/tree/release)
+
+To help decide which fonts to download, please refer to the Configurations section of the [official font readme file](https://github.com/adobe-fonts/source-han-sans/raw/release/SourceHanSansReadMe.pdf).
+
+You can also download entire [releases](../../releases) that include all available configurations in a single ZIP file. The ZIP file for the [latest release](../../releases/latest) is approximately 1.6GB.
+
+## Font installation instructions
+
+* [OS X](http://support.apple.com/kb/HT2509)
+* [Windows](http://windows.microsoft.com/en-us/windows-vista/install-or-uninstall-fonts)
+* [Linux/Unix-based systems](https://github.com/adobe-fonts/source-code-pro/issues/17#issuecomment-8967116)
+
+## Building the fonts from source
+
+### Requirements
+
+To build the binary font files from source, you need to have installed the [Adobe Font Development Kit for OpenType](http://www.adobe.com/devnet/opentype/afdko.html) (AFDKO). The AFDKO tools are widely used for font development today, and are part of most font editor applications.
+
+### Build all fonts
+
+In this repository, all necessary files are in place for building the OpenType/CFF and OpenType/CFF Collection fonts. The [COMMANDS.txt](COMMANDS.txt) file provides the command lines that are used to build the OTFs and OTCs.
+
+## Getting Involved
+
+Send suggestions for changes to the Source Han Sans project maintainer, [Dr. Ken Lunde](mailto:lunde@adobe.com?subject=[GitHub] Source Han Sans), for consideration.
+
+## Further information
+
+For information about the design and background of Source Han Sans, please refer to the [design guide] (https://github.com/adobe-fonts/source-han-sans/raw/release/SourceHanSansDesignGuide.pdf) and [official font readme file](https://github.com/adobe-fonts/source-han-sans/raw/release/SourceHanSansReadMe.pdf).
diff --git a/resources/fonts/han/SourceHanSansCN-Regular.otf b/resources/fonts/han/SourceHanSansCN-Regular.otf
new file mode 100644
index 00000000..e28777ff
--- /dev/null
+++ b/resources/fonts/han/SourceHanSansCN-Regular.otf
Binary files differ
diff --git a/resources/fonts/han/SourceHanSansJP-Regular.otf b/resources/fonts/han/SourceHanSansJP-Regular.otf
new file mode 100644
index 00000000..c198e98d
--- /dev/null
+++ b/resources/fonts/han/SourceHanSansJP-Regular.otf
Binary files differ
diff --git a/resources/fonts/han/SourceHanSansKR-Regular.otf b/resources/fonts/han/SourceHanSansKR-Regular.otf
new file mode 100644
index 00000000..ce37a3a6
--- /dev/null
+++ b/resources/fonts/han/SourceHanSansKR-Regular.otf
Binary files differ
diff --git a/resources/fonts/han/SourceHanSansTW-Regular.otf b/resources/fonts/han/SourceHanSansTW-Regular.otf
new file mode 100644
index 00000000..9fd63001
--- /dev/null
+++ b/resources/fonts/han/SourceHanSansTW-Regular.otf
Binary files differ
diff --git a/source/fitz/noto.c b/source/fitz/noto.c
index 894d7bd6..0fdb5b9a 100644
--- a/source/fitz/noto.c
+++ b/source/fitz/noto.c
@@ -3,13 +3,15 @@
/*
Base 14 PDF fonts from URW.
Noto fonts from Google.
+ Source Han Sans from Adobe for CJK.
DroidSansFallback from Android for CJK.
Charis SIL from SIL.
Define TOFU to only include the Base14 and CJK fonts.
- Define TOFU_CJK to skip CJK font.
- Define TOFU_CJK_EXT to skip CJK Extension A support.
+ Define TOFU_CJK_LANG to skip Source Han Sans per-language fonts.
+ Define TOFU_CJK_EXT to skip DroidSansFallbackFull (and the above).
+ Define TOFU_CJK to skip DroidSansFallback (and the above).
Define TOFU_EMOJI to skip emoji font.
Define TOFU_HISTORIC to skip ancient/historic scripts.
@@ -133,7 +135,17 @@ fz_lookup_cjk_font(fz_context *ctx, int registry, int serif, int wmode, int *siz
if (index) *index = 0;
#ifndef TOFU_CJK
#ifndef TOFU_CJK_EXT
+#ifndef TOFU_CJK_LANG
+ switch (registry) {
+ case FZ_ADOBE_JAPAN_1: RETURN(SourceHanSansJP_Regular_otf);
+ case FZ_ADOBE_KOREA_1: RETURN(SourceHanSansKR_Regular_otf);
+ default:
+ case FZ_ADOBE_GB_1: RETURN(SourceHanSansCN_Regular_otf);
+ case FZ_ADOBE_CNS_1: RETURN(SourceHanSansTW_Regular_otf);
+ }
+#else
RETURN(DroidSansFallbackFull_ttf);
+#endif
#else
RETURN(DroidSansFallback_ttf);
#endif