Skip to content

Commit 8dd1207

Browse files
Include Symbols and Zapf Dingbats fonts. Part of base 14 fonts
https://www.xpdfreader.com/download.html
1 parent f7ed797 commit 8dd1207

7 files changed

Lines changed: 114 additions & 1 deletion

File tree

dependency-builder/build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ task gatherLicenses {
7272
// LGPL2.1 and GPLv2 licenses include form feed (page break) characters.
7373
// XML does not take kindly to form feed characters.
7474
if ((depName == "cairo" && licenseFilename == "COPYING-LGPL-2.1") ||
75+
(depName == "Fonts-SymbolAndZapfDingbats" && licenseFilename == "COPYING") ||
7576
(depName == "freetype" && licenseFilename == "docs/GPLv2.TXT") ||
7677
(depName == "glib-2.0" && licenseFilename == "COPYING") ||
7778
(depName == "fribidi" && licenseFilename == "COPYING") ||
@@ -90,6 +91,7 @@ task gatherLicenses {
9091
addLicense("pdf2htmlEX", ["LICENSE", "LICENSE_GPLv3"])
9192
addLicense("cairo", ["COPYING", "COPYING-LGPL-2.1", "COPYING-MPL-1.1"])
9293
addLicense("fontconfig", ["COPYING"])
94+
addLicense("Fonts-SymbolAndZapfDingbats", ["COPYING"])
9395
addLicense("freetype", ["docs/LICENSE.TXT", "docs/GPLv2.TXT", "docs/FTL.TXT"])
9496
addLicense("fribidi", ["COPYING"])
9597
addLicense("glib-2.0", ["COPYING"])
@@ -138,6 +140,15 @@ task collectReleaseAssetsFromShareFolder {
138140
duplicatesStrategy('exclude')
139141
}
140142
}
143+
// @TODO: maybe make EPTarball extract to "installed" ?
144+
doLast {
145+
copy {
146+
def abi = project.hasProperty('abi') ? project.property('abi') : 'armeabi-v7a'
147+
from("$projectDir/.cxx/cmake/release/" + abi + "/Fonts-SymbolAndZapfDingbats-prefix/src/Fonts-SymbolAndZapfDingbats/")
148+
include("*.pfb")
149+
into("$buildDir/assets/fonts")
150+
}
151+
}
141152
}
142153

143154
task collectDebugAssetsFromShareFolder {
@@ -162,6 +173,15 @@ task collectDebugAssetsFromShareFolder {
162173
duplicatesStrategy('exclude')
163174
}
164175
}
176+
// @TODO: maybe make EPTarball extract to "installed" ?
177+
doLast {
178+
copy {
179+
def abi = project.hasProperty('abi') ? project.property('abi') : 'armeabi-v7a'
180+
from("$projectDir/.cxx/cmake/debug/" + abi + "/Fonts-SymbolAndZapfDingbats-prefix/src/Fonts-SymbolAndZapfDingbats/")
181+
include("*.pfb")
182+
into("$buildDir/assets/fonts")
183+
}
184+
}
165185
}
166186

167187
tasks.whenTaskAdded {

dependency-builder/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/EPHelpers.cmake)
4949
include(${CMAKE_CURRENT_SOURCE_DIR}/EPAutotools.cmake)
5050
include(${CMAKE_CURRENT_SOURCE_DIR}/EPCMake.cmake)
5151
include(${CMAKE_CURRENT_SOURCE_DIR}/EPMeson.cmake)
52+
include(${CMAKE_CURRENT_SOURCE_DIR}/EPTarball.cmake)
5253

5354
SET(TARBALL_STORAGE ${CMAKE_CURRENT_SOURCE_DIR}/tarballs/ CACHE PATH "Path to manually downloaded tarballs. Used to look up before downloading from the internet.")
5455

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# EPTarball.cmake
2+
#
3+
# pdf2htmlEX-Android (https://github.com/ViliusSutkus89/pdf2htmlEX-Android)
4+
# Android port of pdf2htmlEX - Convert PDF to HTML without losing text or format.
5+
#
6+
# Copyright (c) 2019 Vilius Sutkus <ViliusSutkus89@gmail.com>
7+
#
8+
# This program is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License version 3 as
10+
# published by the Free Software Foundation.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
function(ExternalProjectTarball EXTERNAL_PROJECT_NAME)
21+
set(options)
22+
set(oneValueArgs URL URL_HASH)
23+
set(multipleValueArgs DEPENDS)
24+
cmake_parse_arguments(EP "${options}" "${oneValueArgs}" "${multipleValueArgs}" ${ARGN})
25+
26+
FilterDependsList(EP_DEPENDS)
27+
CheckIfPackageAlreadyBuilt(${EXTERNAL_PROJECT_NAME})
28+
if ("${${EXTERNAL_PROJECT_NAME}_FOUND}")
29+
return()
30+
endif()
31+
32+
CheckIfTarballCachedLocally(${EXTERNAL_PROJECT_NAME} EP_URL)
33+
34+
ExternalProject_Add(${EXTERNAL_PROJECT_NAME}
35+
${EP_DEPENDS}
36+
37+
URL ${EP_URL}
38+
URL_HASH ${EP_URL_HASH}
39+
40+
BUILD_IN_SOURCE 1
41+
42+
CONFIGURE_COMMAND /bin/true
43+
BUILD_COMMAND /bin/true
44+
INSTALL_COMMAND /bin/true
45+
46+
LOG_DOWNLOAD 1
47+
LOG_INSTALL 1
48+
)
49+
endfunction(ExternalProjectTarball)
50+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://www.xpdfreader.com/download.html
2+
3+
ExternalProjectTarball(Fonts-SymbolAndZapfDingbats
4+
URL https://xpdfreader-dl.s3.amazonaws.com/xpdf-t1fonts.tar.gz
5+
URL_HASH SHA256=513853afed2a4ada0217bd93d95ab7f1663b6a0f37a07136e22404c6c6eaf342
6+
)
7+

dependency-builder/src/main/cpp/packages/pdf2htmlEX.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include_guard(GLOBAL)
22

33
ExternalProjectCMake(pdf2htmlEX
4-
DEPENDS cairo freetype libfontforge poppler
4+
DEPENDS cairo Fonts-SymbolAndZapfDingbats freetype libfontforge poppler
55

66
URL https://github.com/pdf2htmlEX/pdf2htmlEX/archive/v0.18.7-poppler-0.81.0.tar.gz
77
URL_HASH SHA256=510d9fc2175fda1ab6968c389fa78d7078183583a543019f4eefe09b8373c6e4

pdf2htmlEX/src/androidTest/java/com/viliussutkus89/android/pdf2htmlex/FontconfigInstrumentedTests.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,25 @@ public synchronized void matchTimesTest() {
9494
.contains(getFontFilenameFromFontconfig("Times:Bold:Italic")));
9595
}
9696

97+
@Test
98+
public synchronized void matchSymbolTest() {
99+
// @TODO: init only FontconfigAndroid, not the whole pdf2htmlEX
100+
new pdf2htmlEX(InstrumentationRegistry.getInstrumentation().getTargetContext());
101+
102+
assertEquals("s050000l.pfb", getFontFilenameFromFontconfig("Symbol"));
103+
assertEquals("s050000l.pfb", getFontFilenameFromFontconfig("StandardSymbolsL"));
104+
assertEquals("s050000l.pfb", getFontFilenameFromFontconfig("Standard Symbols L"));
105+
}
106+
107+
@Test
108+
public synchronized void matchDingbatsTest() {
109+
// @TODO: init only FontconfigAndroid, not the whole pdf2htmlEX
110+
new pdf2htmlEX(InstrumentationRegistry.getInstrumentation().getTargetContext());
111+
112+
assertEquals("d050000l.pfb", getFontFilenameFromFontconfig("Dingbats"));
113+
assertEquals("d050000l.pfb", getFontFilenameFromFontconfig("ZapfDingbats"));
114+
assertEquals("d050000l.pfb", getFontFilenameFromFontconfig("Zapf Dingbats"));
115+
}
116+
97117
private native String getFontFilenameFromFontconfig(String pattern);
98118
}

pdf2htmlEX/src/main/assets/etc/fonts/local.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,19 @@
77

88
<description>Load Android font files from /system/fonts</description>
99
<dir>/system/fonts</dir>
10+
11+
<include ignore_missing="yes">system-etc-fonts-xml-translated.conf</include>
12+
13+
<dir prefix="relative">../../fonts</dir>
14+
15+
<alias binding="strong">
16+
<family>Symbol</family>
17+
<prefer><family>Standard Symbols L</family></prefer>
18+
</alias>
19+
20+
<alias binding="strong">
21+
<family>Zapf Dingbats</family>
22+
<prefer><family>Dingbats</family></prefer>
23+
</alias>
24+
1025
</fontconfig>

0 commit comments

Comments
 (0)