summaryrefslogtreecommitdiff
blob: b71dfc4cea0f662df94e7b6099e6b98008c93454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit font xdg-utils

DESCRIPTION="Chinese TrueType Arphic Fonts"
HOMEPAGE="http://www.arphic.com.tw/
	https://www.freedesktop.org/wiki/Software/CJKUnifonts"
SRC_URI="mirror://gnu/non-gnu/chinese-fonts-truetype/gkai00mp.ttf.gz
	mirror://gnu/non-gnu/chinese-fonts-truetype/bkai00mp.ttf.gz
	mirror://gnu/non-gnu/chinese-fonts-truetype/bsmi00lp.ttf.gz
	mirror://gnu/non-gnu/chinese-fonts-truetype/gbsn00lp.ttf.gz
	mirror://ubuntu/pool/main/t/ttf-arphic-uming/ttf-arphic-uming_${PV}.orig.tar.gz
	mirror://ubuntu/pool/main/t/ttf-arphic-ukai/ttf-arphic-ukai_${PV}.orig.tar.gz"
S="${WORKDIR}"

LICENSE="Arphic"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE=""

# No binaries, only fonts
RESTRICT="strip binchecks"

BDEPEND="media-gfx/fontforge"

PATCHES=( "${FILESDIR}"/${P}-fontconfig.patch )

FONT_CONF=(
	ukai/25-ttf-arphic-ukai-render.conf
	ukai/35-ttf-arphic-ukai-aliases.conf
	ukai/41-ttf-arphic-ukai.conf
	ukai/75-ttf-arphic-ukai-select.conf
	ukai/90-ttf-arphic-ukai-embolden.conf
	uming/25-ttf-arphic-uming-bitmaps.conf
	uming/25-ttf-arphic-uming-render.conf
	uming/35-ttf-arphic-uming-aliases.conf
	uming/41-ttf-arphic-uming.conf
	uming/64-ttf-arphic-uming.conf
	uming/90-ttf-arphic-uming-embolden.conf
)
FONT_SUFFIX="ttc ttf"

# ensure that we don't overwrite one font's docs with another's
src_unpack() {
	unpack {gk,bk}ai00mp.ttf.gz {bsmi,gbsn}00lp.ttf.gz

	do_unpack() {
		mkdir ${1} || die
		pushd ${1} > /dev/null || die
			unpack ttf-arphic-${1}_${PV}.orig.tar.gz
		popd > /dev/null || die
		mv ${1}/${1}.ttc . || die
	}
	do_unpack ukai
	do_unpack uming
}

src_prepare() {
	default
	xdg_environment_reset
	fontforge -script "${FILESDIR}"/${P}.pe b*.ttf || die
}

src_install() {
	font_src_install

	do_doc() {
		for doc in FONTLOG KNOWN_ISSUES TODO README README.Bitmap NEWS CONTRIBUTERS
		do
			[[ -f ${1}/${doc} ]] && newdoc ${1}/${doc} ${1}.${doc}
		done
	}
	do_doc ukai
	do_doc uming
}