summaryrefslogtreecommitdiffstats
path: root/media-fonts/ds-fonts/ds-fonts-1.0-r2.ebuild
blob: 1d2660ea0cac108a90d4ddfab489cfcd1a6759d7 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header:

EAPI=5
inherit font eutils

DESCRIPTION="DarkSoft Fonts (Bitmap,Type1,TrueType)"
SLOT="0"
SRC_URI="http://darksoft.org/files/darklin/ds-xfonts.tar.bz2 
	 http://darksoft.org/files/darklin/ds-ttffonts.tar.bz2
	 http://darksoft.org/files/darklin/ds-type1fonts.tar.bz2
	 http://darksoft.org/files/darklin/uming.ttf.bz2"
KEYWORDS="alpha amd64 ppc sparc x86"
DEPEND="dev-lang/perl 
	x11-base/xorg-x11"

# Old crap
FONT_ROOT=/usr/share/fonts/DarkLin
# This we need 
FONT_DIR=/usr/share/fonts/ds-fonts

S="${WORKDIR}"

src_unpack() {
    einfo "Unpacking sources..."
    unpack uming.ttf.bz2
}

src_install() {
    GS_VER=`gs -v | perl -pe '$_ =~ m/([7-9]\.\d{1,3})(.\d{1,3})?/;print $1;s/.*\n//'`

    mkdir -p ${D}/${FONT_ROOT}
    tar xjf ${DISTDIR}/ds-xfonts.tar.bz2 -C ${D}/${FONT_ROOT}
    tar xjf ${DISTDIR}/ds-ttffonts.tar.bz2 -C ${D}/${FONT_ROOT}
    tar xjf ${DISTDIR}/ds-type1fonts.tar.bz2 -C ${D}/${FONT_ROOT}
    tar xjf ${FILESDIR}/aliases.tar.bz2 -C ${D}/${FONT_ROOT}/Type1
    
    chmod 0755 `find ${D}/${FONT_ROOT} -type d`
    chmod 0644 `find ${D}/${FONT_ROOT} -type f`

    for name in `find ${D}/${FONT_ROOT} -type f -name *.Z`; do
	gunzip $name
	(
	    cd `dirname $name`
	    gzip `basename $name .Z`
	)
    done

    mkdir -p ${D}/${FONT_DIR} || die
    mv *.ttf ${D}/${FONT_DIR} || die
    chmod 0755 `find ${D}/${FONT_DIR} -type d` || die
    chmod 0644 `find ${D}/${FONT_DIR} -type f` || die
}


rebuild_fontfiles() {
    einfo "Refreshing fonts.scale and fonts.dir..."

    (
	cd ${FONT_ROOT}/TrueType/win
	mkfontscale
	mkfontdir
    )

    (
	cd ${FONT_ROOT}/TrueType/misc
	mkfontscale
	mkfontdir
    )

    (
	cd ${FONT_ROOT}/Russian
	for name in `find . -type d`; do
	    ( 
		cd $name || die
		mkfontdir
	    )
	done
    )

    (
	cd ${FONT_DIR}
	mkfontscale
	mkfontdir
    )
}

pkg_postinst() {
    rebuild_fontfiles

    einfo "In order to make X see the fonts, you need to add the"
    einfo "following lines to the files section of your "
    einfo "/etc/X11/XF86Config (or the XOrg equivalent):"
    einfo "  FontPath \"${FONT_ROOT}/TrueType/win:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/TrueType/misc:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Russian/misc:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Russian/100dpi:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Russian/75dpi:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Russian/AltIsoKoi:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Russian/Win:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Unicode:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Type1/All:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Type1/ER-KOI8:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Type1/ER-CP1251:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Type1/KOI8:unscaled\""
    einfo "  FontPath \"${FONT_ROOT}/Type1/Misc-KOI8:unscaled\""

    einfo ""
    einfo "In order to make them accessible to your current X"
    einfo "session, run:"
    einfo "  xset fp+ ${FONT_DIR}"
    einfo "  xset fp rehash"
}