Package: ttf-dejavu Version: 2.7-1 Tags: d-i, patch both nazli and dejavu provide Arabic / Farsi glyphs, but dejavu ones, being dejavu used as default font, are used. In order to use nazli for displaying Arabic / Farsi, such glyphs need to stripped out from ttf files. The attached patch strips such glyphs plus sets of other unused glyphs, making the udeb much smaller:
* unstripped * 440236 Jun 20 23:17 generated/DejaVuSans-Bold.ttf 406092 Jun 20 23:17 generated/DejaVuSans-Oblique.ttf 463320 Jun 20 23:17 generated/DejaVuSans.ttf * stripped * 180864 Jun 20 23:17 DejaVuSans-Bold.ttf 181644 Jun 20 23:17 DejaVuSans-Oblique.ttf 195320 Jun 20 23:17 DejaVuSans.ttf stripping was very much inspired from the way it's done for ttf-freefont package. regards, Davide PS: dejavu support for Arabic / Farsi is quite "young"; OTOH we ad positive feedback for nazli fonts.
diff -ruN ttf-dejavu-2.7/debian/changelog ttf-dejavu-2.7_new/debian/changelog --- ttf-dejavu-2.7/debian/changelog 2006-06-20 22:24:57.000000000 +0200 +++ ttf-dejavu-2.7_new/debian/changelog 2006-06-20 22:17:44.000000000 +0200 @@ -1,3 +1,9 @@ +ttf-dejavu (2.7-2) unstable; urgency=low + + * Support for stripping unnecessary glyphs from the udeb + + -- Davide Viti <[EMAIL PROTECTED]> Tue, 20 Jun 2006 22:16:26 +0200 + ttf-dejavu (2.7-1) unstable; urgency=low * New upstream version available diff -ruN ttf-dejavu-2.7/debian/rules ttf-dejavu-2.7_new/debian/rules --- ttf-dejavu-2.7/debian/rules 2006-06-20 22:24:57.000000000 +0200 +++ ttf-dejavu-2.7_new/debian/rules 2006-06-20 23:17:19.000000000 +0200 @@ -6,6 +6,9 @@ dh_testdir dh_testroot dh_clean + rm -fr TTF-stripped/ + chmod u-x debian/scripts/strip_glyphs.pe + chmod u-x debian/scripts/stripfonts.sh rm -rf generated/ rm -f debian/files @@ -15,6 +18,9 @@ dh_clean -k dh_installdirs sh generate.sh + chmod u+x debian/scripts/strip_glyphs.pe + chmod u+x debian/scripts/stripfonts.sh + debian/scripts/stripfonts.sh dh_install --sourcedir="generated" diff -ruN ttf-dejavu-2.7/debian/scripts/README.strip_glyphs ttf-dejavu-2.7_new/debian/scripts/README.strip_glyphs --- ttf-dejavu-2.7/debian/scripts/README.strip_glyphs 1970-01-01 01:00:00.000000000 +0100 +++ ttf-dejavu-2.7_new/debian/scripts/README.strip_glyphs 2006-06-20 22:18:08.000000000 +0200 @@ -0,0 +1,18 @@ +strip_glyphs.pe is a fontforge script (syntax is documented at +http://fontforge.sourceforge.net/scripting.html) + +Usage: "strip_glyphs.pe in out glyphs" + +It strips glyphs out of a font file; glyphs can be ranges +or single code points. +Code points can be expressed as integers or in unicode notation (i.e +"u215") and ranges are separated by ":". + +As a practical example, this commands were used to eliminate +Arabic glyphs from the freefont package: + +./strip_glyphs.pe FreeSerif.ttf FreeSerif_strip.ttf u60c:u6d4 ufb50:ufefe +./strip_glyphs.pe FreeSansBold.ttf FreeSansBold_strip.ttf u617:u633 + +Note that "in" and "out" can be the same file; in that case, obviously, +"in" gets overwritten. diff -ruN ttf-dejavu-2.7/debian/scripts/dejavu-strip ttf-dejavu-2.7_new/debian/scripts/dejavu-strip --- ttf-dejavu-2.7/debian/scripts/dejavu-strip 1970-01-01 01:00:00.000000000 +0100 +++ ttf-dejavu-2.7_new/debian/scripts/dejavu-strip 2006-06-20 22:18:08.000000000 +0200 @@ -0,0 +1,44 @@ +#! /bin/bash + +exepath=$(dirname $0) +strip=$exepath/strip_glyphs.pe + +if [ $# -ne 2 ] ; then + echo "Usage: $(basename $0) fontfile_in fontfile_out" + exit 0 +fi + +if [ ! -x "$strip" ] ; then + echo "Script not found: $strip" + exit 1 +fi + +if [ ! -f "$1" ] ; then + echo "File does not exist: $1" + exit 1 +fi +if [ -z "$2" ] ; then + echo "You need to specify the output file" + exit 1 +fi + +ranges="" +ranges="$ranges u0530:u058F" # Armenian +ranges="$ranges u0600:u06FF" # Arabic +ranges="$ranges u0700:u074F" # Syriac +ranges="$ranges u1D00:u1DBF" # Phonetic Extensions +ranges="$ranges u2070:u209f" # Superscripts and Subscripts +ranges="$ranges u20a0:u20cf" # Currency Symbols +ranges="$ranges u2150:u218f" # Number Forms +ranges="$ranges u2190:u21ff" # Arrows +ranges="$ranges u2200:u24FF" # Mathematical, Techical, Control, OCR +ranges="$ranges u2580:u25FF" # Block elements, Geometric Shapes +ranges="$ranges u2600:u26FF" # Miscellaneous Symbols +ranges="$ranges u2700:u27EF" # Dingbats, Miscellaneous Mathematical Symbols-A +ranges="$ranges u2800:u28FF" # Braille Patterns +ranges="$ranges u2900:u2BFF" # Suppl. Arrows-B, Misc Math Symbols-B, Suppl Math Ops, Misc Symbols and Arrows +ranges="$ranges u3000:u30FF" # CJK Symbols and Punctuation +ranges="$ranges uFB50:uFBFF" # Arabic Presentation Forms-A +ranges="$ranges uFE70:uFEFF" # Arabic Presentation Forms-B + +$strip $1 $2 $ranges diff -ruN ttf-dejavu-2.7/debian/scripts/strip_glyphs.pe ttf-dejavu-2.7_new/debian/scripts/strip_glyphs.pe --- ttf-dejavu-2.7/debian/scripts/strip_glyphs.pe 1970-01-01 01:00:00.000000000 +0100 +++ ttf-dejavu-2.7_new/debian/scripts/strip_glyphs.pe 2006-06-20 22:18:08.000000000 +0200 @@ -0,0 +1,81 @@ +#! /usr/bin/fontforge +# +# Copyright (C) 2005 Davide Viti <[EMAIL PROTECTED]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# "glyphs_to_remove" argument can be a single code point +# or a range of codepoints separated by ":" +# +# code points can be specified both as integers and as unicode +# you can also mix the two formats (i.e "48:u54") +# +# example: +# +# "strip_glyphs in.ttf out.ttf 12 u20 100:150 u200:u230 u300:65000" + +if ($argc < 4) + Print( "Usage: strip_glyphs in out glyphs_to_remove..." ) + Quit() +endif + + +Open($1); shift +Reencode("unicode") +out = $1; shift + +# +# Loop through the arguments and select the glyphs +# which need to be cleared +# +while ($argc > 1) + len = Strlen($1) + colon_idx = Strstr($1, ":") + + # + # argument is a single glyph + # + if (colon_idx == -1) + if(Strstr($1, "u") == -1) + SelectMore(Strtol($1)) ## Integer + else + SelectMore($1) ## Unicode code point (i.e "u0027") + endif + + # + # argument is a range low:high + # + else + low = Strsub($1, 0, colon_idx) + if(Strstr($1, "u") == -1) + low = Strtol(low) ## Integer + endif + + high = Strsub($1, colon_idx+1, len) + if(Strstr($1, "u") == -1) + high = Strtol(high) ## Integer + endif + + SelectMore(low, high); + endif + + shift +endloop + +Clear() + +Generate(out, "") +Quit() diff -ruN ttf-dejavu-2.7/debian/scripts/stripfonts.sh ttf-dejavu-2.7_new/debian/scripts/stripfonts.sh --- ttf-dejavu-2.7/debian/scripts/stripfonts.sh 1970-01-01 01:00:00.000000000 +0100 +++ ttf-dejavu-2.7_new/debian/scripts/stripfonts.sh 2006-06-20 22:18:08.000000000 +0200 @@ -0,0 +1,13 @@ +#!/bin/sh + +STRIPFONT=$(pwd)/debian/scripts/dejavu-strip +SRC="generated" +TARGET="TTF-stripped" +FONTPAT="FreeSans*.ttf" +test ! -d ${TARGET} && mkdir ${TARGET} + +FONTS="DejaVuSans DejaVuSans-Bold DejaVuSans-Oblique" +for font in ${FONTS}; do + echo $font + (cd ${TARGET} && sh ${STRIPFONT} ../${SRC}/${font}.ttf ${font}.ttf) +done diff -ruN ttf-dejavu-2.7/debian/ttf-dejavu-udeb.install ttf-dejavu-2.7_new/debian/ttf-dejavu-udeb.install --- ttf-dejavu-2.7/debian/ttf-dejavu-udeb.install 2006-06-20 22:24:57.000000000 +0200 +++ ttf-dejavu-2.7_new/debian/ttf-dejavu-udeb.install 2006-06-20 22:23:20.000000000 +0200 @@ -1,3 +1,3 @@ -DejaVuSans-Bold.ttf usr/share/fonts/truetype/ttf-dejavu -DejaVuSans-Oblique.ttf usr/share/fonts/truetype/ttf-dejavu -DejaVuSans.ttf usr/share/fonts/truetype/ttf-dejavu +../TTF-stripped/DejaVuSans-Bold.ttf usr/share/fonts/truetype/ttf-dejavu +../TTF-stripped/DejaVuSans-Oblique.ttf usr/share/fonts/truetype/ttf-dejavu +../TTF-stripped/DejaVuSans.ttf usr/share/fonts/truetype/ttf-dejavu
signature.asc
Description: Digital signature