~ubuntu-branches/ubuntu/intrepid/freetype1/intrepid

« back to all changes in this revision

Viewing changes to debian/patches/04_ftstrpnm_utf8.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Fok
  • Date: 2007-09-11 08:43:02 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20070911084302-rnx8s3d63ggmmg8u
Tags: 1.4pre.cvs20060210-1
* Old maintainer adopting this package again.  :-)  (Closes: #432579)
* New upstream version from CVS. Changes are in freetype1-contrib only:
   - Extended Unicode.sfd to cover characters beyond BMP (Closes: #405377)
   - Added HKSCS.sfd
* Applied Davide Viti's patch which extends ftstrpnm for non-ASCII input.
  (Closes: #407204)
* The binary-indep target was empty and was not listed as .PHONY.
  Fixed.  (Closes: #395686)
* Revised package description to make it more concise and clear
  about libfreetype6-dev superceding libttf2-dev.  (Closes: #200796)
* Acknowledged NMU patches.  Thank you very much!
* Use dpatch to maintain patches.
* [07_type-punned.dpatch]: Inserted intermediate (void*) cast to silence
      GCC "dereferencing type-punned pointer will break strict-aliasing
      rules" warnings.
* [98_configure_in.dpatch]: Updated configure.{in,ac}, Makefile.in and net.m4
      for newer Autoconf.  Also changed 'test "x$CC" = xgcc' to
      'test "x$GCC" = yes'
* [99_autogen.dpatch]: My try at a dpatch-based autogen to keep configure
      scripts up-to-date while keeping the Debian .diff.gz small.
      See /usr/share/doc/autotools-dev/README.Debian.gz for details.
* Upgraded Standards-Version from 3.6.2 to 3.7.2.
* Migrated from dh_movefiles to dh_install.
* Fixed Lintian warnings:
   - W: freetype1 source: debian-rules-ignores-make-clean-error
   - W: freetype1 source: substvar-source-version-is-deprecated libttf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 04_ftstrpnm_utf8.dpatch by Davide Viti <zinosat@tiscali.it>, 2007-01-16
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: [freetype1-tools] ftstrpnm should work with non-ASCII input (#407204)
 
6
## DP:
 
7
## DP: I just discovered the ftstrpnm tool which is very useful for testing
 
8
## DP: font files without the need of installing them; unfortunately input is
 
9
## DP: limited to ASCII chars. The attached patch extends the support to wide
 
10
## DP: chars: the patch is less invasive as possible and I reckon there's
 
11
## DP: still space for loads of improvements.
 
12
## DP:
 
13
## DP: See http://bugs.debian.org/407204 for further details.
 
14
 
 
15
@DPATCH@
 
16
diff -urNad freetype1-1.4pre.cvs20060210~/test/ftstrpnm.c freetype1-1.4pre.cvs20060210/test/ftstrpnm.c
 
17
--- freetype1-1.4pre.cvs20060210~/test/ftstrpnm.c       2001-12-26 04:14:29.000000000 +0800
 
18
+++ freetype1-1.4pre.cvs20060210/test/ftstrpnm.c        2007-09-08 05:27:40.000000000 +0800
 
19
@@ -17,6 +17,7 @@
 
20
 #include <stdio.h>
 
21
 #include <stdlib.h>
 
22
 #include <string.h>
 
23
+#include <locale.h>
 
24
 
 
25
 #include "common.h"
 
26
 #include "freetype.h"
 
27
@@ -175,7 +176,7 @@
 
28
 
 
29
   /* glyph management */
 
30
 
 
31
-  static void  Load_Glyphs( char*  txt, int  txtlen )
 
32
+  static void  Load_Glyphs( wchar_t*  txt, int  txtlen )
 
33
   {
 
34
     unsigned short  i, n, code, load_flags;
 
35
     unsigned short  num_glyphs = 0, no_cmap = 0;
 
36
@@ -224,8 +225,8 @@
 
37
 
 
38
     for ( i = 0; i < txtlen; ++i )
 
39
     {
 
40
-      unsigned char  j = txt[i];
 
41
 
 
42
+      wchar_t  j = txt[i];
 
43
 
 
44
       if ( TT_VALID( glyphs[j] ) )
 
45
         continue;
 
46
@@ -311,7 +312,7 @@
 
47
 
 
48
   /* rasterization stuff */
 
49
 
 
50
-  static void  Init_Raster_Areas( const char*  txt, int  txtlen )
 
51
+  static void  Init_Raster_Areas( wchar_t*  txt, int  txtlen )
 
52
   {
 
53
     int                  i, upm, ascent, descent;
 
54
     TT_Face_Properties   properties;
 
55
@@ -333,16 +334,16 @@
 
56
 
 
57
     for ( i = 0; i < txtlen; ++i )
 
58
     {
 
59
-      unsigned char  j = txt[i];
 
60
 
 
61
+      wchar_t  j = txt[i];
 
62
 
 
63
       if ( !TT_VALID( glyphs[j] ) )
 
64
         continue;
 
65
 
 
66
       TT_Get_Glyph_Metrics( glyphs[j], &gmetrics );
 
67
       pnm_width += gmetrics.advance / 64;
 
68
-    }
 
69
 
 
70
+    }
 
71
     Init_Raster_Map( &bit, pnm_width, pnm_height );
 
72
     Clear_Raster_Map( &bit );
 
73
 
 
74
@@ -392,7 +393,7 @@
 
75
   }
 
76
 
 
77
 
 
78
-  static void  Render_All_Glyphs( char*  txt, int  txtlen )
 
79
+  static void  Render_All_Glyphs( wchar_t*  txt, int  txtlen )
 
80
   {
 
81
     int               i;
 
82
     TT_F26Dot6        x, y, adjx;
 
83
@@ -404,7 +405,7 @@
 
84
 
 
85
     for ( i = 0; i < txtlen; i++ )
 
86
     {
 
87
-      unsigned char  j = txt[i];
 
88
+      wchar_t  j = txt[i];
 
89
 
 
90
       if ( !TT_VALID( glyphs[j] ) )
 
91
         continue;
 
92
@@ -445,6 +446,9 @@
 
93
     char      *txt, *filename;
 
94
     TT_Error  error;
 
95
 
 
96
+    wchar_t *wp;
 
97
+
 
98
+    setlocale(LC_ALL, "");
 
99
 
 
100
     /* Parse options */
 
101
 
 
102
@@ -498,7 +502,8 @@
 
103
     else
 
104
       txt = "The quick brown fox jumps over the lazy dog";
 
105
 
 
106
-    txtlen = strlen( txt );
 
107
+    wp = (wchar_t *)malloc( strlen(txt) * sizeof(wchar_t) );
 
108
+    txtlen = mbstowcs(wp, txt, strlen(txt) * sizeof(wchar_t));
 
109
 
 
110
     /* Initialize engine and other stuff */
 
111
 
 
112
@@ -507,12 +512,12 @@
 
113
       Panic( "Error while initializing engine, code = 0x%x.\n", error );
 
114
 
 
115
     Init_Face( filename );
 
116
-    Load_Glyphs( txt, txtlen );
 
117
-    Init_Raster_Areas( txt, txtlen );
 
118
 
 
119
+    Load_Glyphs( wp, txtlen );
 
120
+    Init_Raster_Areas( wp, txtlen );
 
121
     /* Do the real work now */
 
122
+    Render_All_Glyphs( wp, txtlen );
 
123
 
 
124
-    Render_All_Glyphs( txt, txtlen );
 
125
     Dump_Raster_Map( &bit, stdout );
 
126
 
 
127
     /* Clean up */