Package: fontforge
Version: 0.0.20050911-1.dkg.0
Severity: wishlist
Tags: patch


Attached is a patch to add a function SetTTFWeight() to fontforge's
scripting commands, since i couldn't find a way to set this variable
from any existing script function.

You can currently access this information through the GUI via the
"Font Info..." dialog [0].

My patch also modifies the shipped documentation to include a
reference to the new function.  Modifying the documentation uses a new
debian/htdocs-patches directory, along with a new line in debian/rules
to invoke those patches.

Please let me know if there are any problems with the patch.

        --dkg

[0] http://fontforge.sourceforge.net/fontinfo.html#TTF-Values



-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (700, 'testing'), (700, 'stable'), (600, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages fontforge depends on:
ii  libc6                     2.3.5-6        GNU C Library: Shared libraries an
ii  libfreetype6              2.1.7-2.4      FreeType 2 font engine, shared lib
ii  libice6                   6.8.2.dfsg.1-7 Inter-Client Exchange library
ii  libjpeg62                 6b-10          The Independent JPEG Group's JPEG 
ii  libpng12-0                1.2.8rel-1     PNG library - runtime
ii  libsm6                    6.8.2.dfsg.1-7 X Window System Session Management
ii  libtiff4                  3.7.3-1        Tag Image File Format (TIFF) libra
ii  libungif4g                4.1.3-3        shared library for GIF images (run
ii  libx11-6                  6.8.2.dfsg.1-7 X Window System protocol client li
ii  libxi6                    6.8.2.dfsg.1-7 X Window System Input extension li
ii  libxkbui1                 6.8.2.dfsg.1-7 X Keyboard Extension user interfac
ii  libxml2                   2.6.22-1       GNOME XML library
ii  xlibs                     6.8.2.dfsg.1-7 X Window System client libraries m
ii  zlib1g                    1:1.2.3-4      compression library - runtime

fontforge recommends no packages.

-- no debconf information
diff -ruN debian.orig/fontforge-patches/008_add_ttfweight.diff 
debian/fontforge-patches/008_add_ttfweight.diff
--- debian.orig/fontforge-patches/008_add_ttfweight.diff        1969-12-31 
19:00:00.000000000 -0500
+++ debian/fontforge-patches/008_add_ttfweight.diff     2005-10-12 
15:44:26.000000000 -0400
@@ -0,0 +1,29 @@
+diff -ur fontforge-20050911/fontforge/scripting.c.orig 
fontforge-20050911/fontforge/scripting.c
+--- fontforge-20050911/fontforge/scripting.c.orig      2005-09-08 
23:53:00.000000000 -0400
++++ fontforge-20050911/fontforge/scripting.c   2005-10-11 12:03:44.000000000 
-0400
+@@ -2679,6 +2679,17 @@
+     _SetFontNames(c,sf);
+ }
+ 
++static void bSetTTFWeight(Context *c) {
++    SplineFont *sf = c->curfv->sf;
++    if ( c->a.argc!=2 )
++      error( c, "Wrong number of arguments");
++    if ( c->a.vals[1].type!=v_int )
++      error(c,"Bad argument type");
++    if ( c->a.vals[1].u.ival > 0 ) {
++      sf->pfminfo.weight = c->a.vals[1].u.ival;
++    }
++}
++
+ static void bSetFondName(Context *c) {
+     SplineFont *sf = c->curfv->sf;
+     if ( c->a.argc!=2 )
+@@ -5553,6 +5564,7 @@
+     { "SetFontHasVerticalMetrics", bSetFontHasVerticalMetrics },
+     { "SetFontNames", bSetFontNames },
+     { "SetFondName", bSetFondName },
++    { "SetTTFWeight", bSetTTFWeight },
+     { "SetTTFName", bSetTTFName },
+     { "GetTTFName", bGetTTFName },
+     { "SetItalicAngle", bSetItalicAngle },
diff -ruN debian.orig/htdocs-patches/000_add_ttf_weight.diff 
debian/htdocs-patches/000_add_ttf_weight.diff
--- debian.orig/htdocs-patches/000_add_ttf_weight.diff  1969-12-31 
19:00:00.000000000 -0500
+++ debian/htdocs-patches/000_add_ttf_weight.diff       2005-10-12 
15:44:26.000000000 -0400
@@ -0,0 +1,16 @@
+diff -ur htdocs/scripting.html.orig htdocs/scripting.html
+--- htdocs/scripting.html.orig 2005-10-11 12:21:23.000000000 -0400
++++ htdocs/scripting.html      2005-10-11 12:29:40.000000000 -0400
+@@ -1446,6 +1446,12 @@
+     If the argument is a string then the string should be the concatenation of
+     various style names, as "Bold Italic Condensed"
+   <DT>
++    <A HREF="fontinfo.html#TTF-Values">SetTTFWeight</A>(int)
++  <DD>
++    Sets the indicated truetype Weight in the OS/2 TTF header.  Use 500 for 
normal weight, 700 for bold, etc...<BR>
++    Example: To set the TTF weight to bold, use:<BR>
++    <CODE>&nbsp; &nbsp;SetTTFWeight(700)</CODE>
++  <DT>
+     <A HREF="fontinfo.html#TTF-Names">SetTTFName</A>(lang,nameid,utf8-string)
+   <DD>
+     Sets the indicated truetype name in the MS platform. Lang must be one of
diff -ruN debian.orig/rules debian/rules
--- debian.orig/rules   2005-10-12 15:44:13.000000000 -0400
+++ debian/rules        2005-10-12 15:44:26.000000000 -0400
@@ -52,6 +52,7 @@
 
        # Now configure fontforge
        (cd $(FONTFORGE_DIR); for p in ../debian/fontforge-patches/*; do patch 
-p1 < $$p ; done)
+       (cd htdocs; for p in ../debian/htdocs-patches/*; do patch -p1 < $$p ; 
done)
 
        # Update config.sub and config.guess
        cp /usr/share/misc/config.guess /usr/share/misc/config.sub 
$(FONTFORGE_DIR)/

Reply via email to