Package: ttf-tmuni
Version: 0.0.20040806-1.2
Severity: wishlist
Tags: patch


A while back (see [1]) there was a discussion about a new version
already packaged and ready to be uploaded; problem was that fontsize
become too big, especially for the graphical installer.

I found out the cause [2] and the solution was to strip not needed glyphs 
out of the udeb. It was never implemented and apparently everyone (including
myself) forgot about that message.

The attached patch fixes the size problem.
Please review it and upload the new package

regards,
Davide

[1] http://www.mail-archive.com/debian-b...@lists.debian.org/msg99313.html
[2] http://www.mail-archive.com/debian-b...@lists.debian.org/msg101251.html

diff --git a/debian/changelog b/debian/changelog
index bb202c2..2338568 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
 ttf-tmuni (1.901b-1) unstable; urgency=medium
 
+  [ Tom Soderlund ]
   * New upstream release
 
- -- Tom Soderlund <t...@iki.fi>  Fri, 06 Jun 2008 21:58:02 +0800
+  [ Davide Viti ]
+  * Strip glyhs from the udeb to reduce file size
+
+ -- Davide Viti <zino...@tiscali.it>  Thu, 05 Mar 2009 15:14:06 +0100
 
 ttf-tmuni (0.0.20040806-1.2) unstable; urgency=low
 
diff --git a/debian/rules b/debian/rules
index d1ca087..fb5e944 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,8 +8,13 @@ DEB_ARCH=all
 install/ttf-tmuni::
 	mkdir tmp
 	ln TibMachUni-1.901b.ttf tmp/TibetanMachineUni.ttf
+	chmod u+x debian/scripts/strip
+	chmod u+x debian/scripts/strip_glyphs.pe
+	# Strip fonts for the udeb used in the Debian installer
+	mkdir stripped-ttf/
+	debian/scripts/strip TibMachUni-1.901b.ttf stripped-ttf/TibMachUni-1.901b.ttf
 	dh_installdefoma
 
 
 clean::
-	rm -fr tmp/
+	rm -fr tmp/ stripped-ttf/
diff --git a/debian/scripts/strip b/debian/scripts/strip
new file mode 100755
index 0000000..047e352
--- /dev/null
+++ b/debian/scripts/strip
@@ -0,0 +1,31 @@
+#! /bin/bash
+
+2> /dev/null
+
+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 u2070:u209F"
+ranges="$ranges u2190:u21FF"
+ranges="$ranges uF0031:uF15B2"
+
+$strip $1 $2 $ranges
diff --git a/debian/scripts/strip_glyphs.pe b/debian/scripts/strip_glyphs.pe
new file mode 100644
index 0000000..b0c42e4
--- /dev/null
+++ b/debian/scripts/strip_glyphs.pe
@@ -0,0 +1,81 @@
+#! /usr/bin/fontforge 
+#
+#     Copyright (C) 2005 Davide Viti <zino...@tiscali.it>
+#
+#     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 --git a/debian/ttf-tmuni-udeb.install b/debian/ttf-tmuni-udeb.install
index 74a2cd5..164dbd8 100644
--- a/debian/ttf-tmuni-udeb.install
+++ b/debian/ttf-tmuni-udeb.install
@@ -1 +1 @@
-tmp/*.ttf usr/share/fonts/truetype/ttf-tmuni
+stripped-ttf/*.ttf usr/share/fonts/truetype/ttf-tmuni

Attachment: signature.asc
Description: Digital signature

Reply via email to