* docs/CHANGES: Updated. Improve support for WGL4 encoded fonts. * src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): New macro. (ft_wgl_extra_unicodes, ft_wgl_extra_glyph_names, ft_wgl_extra_glyph_name_offsets): New arrays. (ps_check_wgl_name, ps_check_wgl_unicode): New functions. (ps_unicodes_init): Use them to add additional Unicode mappings.
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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
diff --git a/ChangeLog b/ChangeLog
index f6c7c03..0892bd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-05-16 Werner Lemberg <wl@gnu.org>
+
+ * docs/CHANGES: Updated.
+
+2008-05-16 Sergey Tolstov <stolstov@esri.com>
+
+ Improve support for WGL4 encoded fonts.
+
+ * src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): New macro.
+ (ft_wgl_extra_unicodes, ft_wgl_extra_glyph_names,
+ ft_wgl_extra_glyph_name_offsets): New arrays.
+ (ps_check_wgl_name, ps_check_wgl_unicode): New functions.
+ (ps_unicodes_init): Use them to add additional Unicode mappings.
+
2008-05-15 Werner Lemberg <wl@gnu.org>
* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
diff --git a/docs/CHANGES b/docs/CHANGES
index 9c0b25f..938c719 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -42,6 +42,8 @@ CHANGES BETWEEN 2.3.6 and 2.3.5
- Build support for symbian has been contributed.
+ - Better WGL4 glyph name support, contributed by Sergey Tolstov.
+
======================================================================
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index bdcb3f6..7f5a103 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
/* */
/* PSNames module implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -180,6 +180,94 @@
}
+ /* support for old WGL4 fonts */
+
+#define WGL_EXTRA_LIST_SIZE 8
+
+ const FT_UInt32 ft_wgl_extra_unicodes[WGL_EXTRA_LIST_SIZE] =
+ {
+ 0x0394,
+ 0x03A9,
+ 0x2215,
+ 0x00AD,
+ 0x02C9,
+ 0x03BC,
+ 0x2219,
+ 0x00A0
+ };
+
+ const char ft_wgl_extra_glyph_names[] =
+ {
+ 'D','e','l','t','a',0,
+ 'O','m','e','g','a',0,
+ 'f','r','a','c','t','i','o','n',0,
+ 'h','y','p','h','e','n',0,
+ 'm','a','c','r','o','n',0,
+ 'm','u',0,
+ 'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
+ 's','p','a','c','e',0
+ };
+
+ const FT_Int ft_wgl_extra_glyph_name_offsets[WGL_EXTRA_LIST_SIZE] =
+ {
+ 0,
+ 6,
+ 12,
+ 21,
+ 28,
+ 35,
+ 38,
+ 53
+ };
+
+
+ void
+ ps_check_wgl_name( const char* gname,
+ FT_UInt glyph,
+ FT_UInt* wgl_glyphs,
+ FT_UInt *states )
+ {
+ FT_UInt n;
+
+
+ for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ {
+ if ( ft_strcmp( ft_wgl_extra_glyph_names +
+ ft_wgl_extra_glyph_name_offsets[n], gname ) == 0 )
+ {
+ if ( states[n] == 0 )
+ {
+ /* mark this WGL extra glyph as a candidate for the cmap */
+ states[n] = 1;
+ wgl_glyphs[n] = glyph;
+ }
+
+ return;
+ }
+ }
+ }
+
+
+ void
+ ps_check_wgl_unicode( FT_UInt32 uni_char,
+ FT_UInt *states )
+ {
+ FT_UInt n;
+
+
+ for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ {
+ if ( uni_char == ft_wgl_extra_unicodes[n] )
+ {
+ /* disable this WGL extra glyph from being added to the cmap */
+ states[n] = 2;
+
+ return;
+ }
+ }
+ }
+
+
/* Build a table that maps Unicode values to glyph indices. */
static FT_Error
ps_unicodes_init( FT_Memory memory,
@@ -191,12 +279,15 @@
{
FT_Error error;
+ FT_UInt wgl_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ FT_UInt wgl_glyphs[WGL_EXTRA_LIST_SIZE];
+
/* we first allocate the table */
table->num_maps = 0;
table->maps = 0;
- if ( !FT_NEW_ARRAY( table->maps, num_glyphs ) )
+ if ( !FT_NEW_ARRAY( table->maps, num_glyphs + WGL_EXTRA_LIST_SIZE ) )
{
FT_UInt n;
FT_UInt count;
@@ -213,10 +304,12 @@
if ( gname )
{
+ ps_check_wgl_name( gname, n, wgl_glyphs, wgl_list_states );
uni_char = ps_unicode_value( gname );
if ( BASE_GLYPH( uni_char ) != 0 )
{
+ ps_check_wgl_unicode( uni_char, wgl_list_states );
map->unicode = uni_char;
map->glyph_index = n;
map++;
@@ -227,6 +320,19 @@
}
}
+ for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
+ {
+ if ( wgl_list_states[n] == 1 )
+ {
+ /* This glyph name has an additional WGL4 representation. */
+ /* Add it to the cmap. */
+
+ map->unicode = ft_wgl_extra_unicodes[n];
+ map->glyph_index = wgl_glyphs[n];
+ map++;
+ }
+ }
+
/* now compress the table a bit */
count = (FT_UInt)( map - table->maps );
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 7e4c6d4..801559f 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -699,8 +699,9 @@
error = tt_size_run_prep( size );
if ( !error )
- size->cvt_ready = 1;
+ size->cvt_ready = 1;
}
+
Exit:
return error;
}