removed TT_MAX_SUBGLYPHS macro, there is no static limit on the number of subglyphs in a TrueType font.. changed the default number of gray levels used by the smooth renderer to 256 (instead of 128). Of course, the human eye can't tell a difference ;-)
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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
diff --git a/CHANGES b/CHANGES
index f1d4389..665c6a8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,14 @@
-LATEST CHANGES -
+LATEST_CHANGES
+
+ - changed the default number of gray levels of the smooth renderer to
+ 256 (instead of the previous 128). Of course, the human eye can't
+ see any difference ;-)
+
+ - removed TT_MAX_SUBGLYPHS, there is no static limit on the number of
+ subglyphs in a TrueType font now..
+
+=============================================================================
+OLD CHANGES 16 May 2000
- tagged "BETA-6" in the CVS tree. This one is a serious release candidate
even though it doesn't incorporate the auto-hinter yet..
diff --git a/demos/graph/grobjs.c b/demos/graph/grobjs.c
index ae106dd..df8512f 100644
--- a/demos/graph/grobjs.c
+++ b/demos/graph/grobjs.c
@@ -98,8 +98,8 @@
pixel_mode >= gr_pixel_mode_max )
goto Fail;
- if ( pixel_mode != gr_pixel_mode_gray ||
- ( num_grays >= 2 && num_grays < 256 ) )
+ if ( pixel_mode != gr_pixel_mode_gray ||
+ ( num_grays >= 2 && num_grays <= 256 ) )
return 0;
Fail:
diff --git a/demos/src/ftstring.c b/demos/src/ftstring.c
index c0c1349..502d527 100644
--- a/demos/src/ftstring.c
+++ b/demos/src/ftstring.c
@@ -57,7 +57,7 @@
static int res = 72; /* default resolution in dpi */
- static grColor fore_color = { 127 };
+ static grColor fore_color = { 255 };
static int graph_init = 0;
static int render_mode = 1;
@@ -158,7 +158,7 @@
bit.mode = gr_pixel_mode_gray;
bit.width = DIM_X;
bit.rows = DIM_Y;
- bit.grays = 128;
+ bit.grays = 256;
surface = grNewSurface( 0, &bit );
if (!surface)
@@ -254,7 +254,7 @@
if( !hinted )
load_flags |= FT_LOAD_NO_HINTING;
- num_grays = 128;
+ num_grays = 256;
if (!antialias)
num_grays = 0;
diff --git a/demos/src/ftview.c b/demos/src/ftview.c
index dca3a69..c3613ca 100644
--- a/demos/src/ftview.c
+++ b/demos/src/ftview.c
@@ -66,7 +66,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
int res = 72;
- static grColor fore_color = { 127 };
+ static grColor fore_color = { 255 };
int Fail;
unsigned char autorun;
@@ -127,7 +127,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
bit.mode = gr_pixel_mode_gray;
bit.width = DIM_X;
bit.rows = DIM_Y;
- bit.grays = 128;
+ bit.grays = 256;
surface = grNewSurface( 0, &bit );
if (!surface)
@@ -185,7 +185,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
bit3.pitch = bit2.pitch;
bit3.mode = antialias ? bit.mode : gr_pixel_mode_mono;
bit3.buffer = bit_buffer;
- bit3.grays = 128;
+ bit3.grays = 256;
FT_Outline_Translate( &glyph->outline, -left, -bottom );
memset( bit_buffer, 0, size );
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 45e2cd0..579254c 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -349,8 +349,6 @@
/* */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
- /* The maximum number of sub-glyphs in a TrueType composite glyph */
-#define TT_MAX_SUBGLYPHS 96
/*************************************************************************/
/*************************************************************************/
diff --git a/src/base/ftgrays.c b/src/base/ftgrays.c
index 95550ce..14535b7 100644
--- a/src/base/ftgrays.c
+++ b/src/base/ftgrays.c
@@ -1016,13 +1016,13 @@ int check_sort( PCell cells, int count )
{
if (spans->coverage)
#if 1
- memset( p + spans->x, (spans->coverage+1) >> 1, spans->len );
+ memset( p + spans->x, (unsigned char)spans->coverage, spans->len );
#else
{
q = p + spans->x;
limit = q + spans->len;
for ( ; q < limit; q++ )
- q[0] = (spans->coverage+1) >> 1;
+ q[0] = (unsigned char)spans->coverage;
}
#endif
}
diff --git a/src/base/ftraster.c b/src/base/ftraster.c
index 26a9a2b..3cbba41 100644
--- a/src/base/ftraster.c
+++ b/src/base/ftraster.c
@@ -2866,7 +2866,7 @@ Scan_DropOuts :
/* set default 5-levels gray palette */
for ( n = 0; n < 5; n++ )
- raster->grays[n] = (n*127/4);
+ raster->grays[n] = (n*255/4);
raster->gray_width = RASTER_GRAY_LINES/2;
}
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 2413066..c388a6c 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -467,7 +467,6 @@
TT_Error error;
TT_Face face = loader->face;
TT_ULong offset;
- FT_SubGlyph subglyphs[ TT_MAX_SUBGLYPHS ];
TT_Int num_subglyphs = 0, contours_count;
TT_UInt index, num_points, num_contours, count;
TT_Fixed x_scale, y_scale;
@@ -632,7 +631,8 @@
else /* otherwise, load a composite !! */
{
/* for each subglyph, read composite header */
- FT_SubGlyph* subglyph = subglyphs;
+ TT_GlyphSlot glyph = loader->glyph;
+ FT_SubGlyph* subglyph = glyph->subglyphs + glyph->num_subglyphs;
if (ACCESS_Frame(count)) goto Fail;
@@ -640,6 +640,25 @@
do
{
TT_Fixed xx, xy, yy, yx;
+ FT_UInt total_subglyphs;
+
+ /* grow the 'glyph->subglyphs' table if necessary */
+ total_subglyphs = glyph->num_subglyphs + num_subglyphs;
+ if ( total_subglyphs >= glyph->max_subglyphs )
+ {
+ FT_UInt new_max = glyph->max_subglyphs;
+ FT_Memory memory = loader->face->root.memory;
+
+ while (new_max <= total_subglyphs)
+ new_max += 4;
+
+ if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
+ new_max, FT_SubGlyph ) )
+ goto Fail;
+
+ glyph->max_subglyphs = new_max;
+ subglyph = glyph->subglyphs + glyph->num_subglyphs + num_subglyphs;
+ }
subglyph->arg1 = subglyph->arg2 = 0;
@@ -687,8 +706,6 @@
subglyph++;
num_subglyphs++;
- if (num_subglyphs >= TT_MAX_SUBGLYPHS)
- break;
}
while (subglyph[-1].flags & MORE_COMPONENTS);
@@ -707,27 +724,9 @@
/* responsible for interpreting this data..) */
if ( loader->load_flags & FT_LOAD_NO_RECURSE )
{
- FT_GlyphSlot glyph = loader->glyph;
-
- /* reallocate subglyph array if necessary */
- if (glyph->max_subglyphs < num_subglyphs)
- {
- FT_Memory memory = loader->face->root.memory;
-
- if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
- num_subglyphs, FT_SubGlyph ) )
- goto Fail;
-
- glyph->max_subglyphs = num_subglyphs;
- }
-
- /* copy subglyph array */
- MEM_Copy( glyph->subglyphs, subglyphs,
- num_subglyphs*sizeof(FT_SubGlyph));
-
/* set up remaining glyph fields */
- glyph->num_subglyphs = num_subglyphs;
- glyph->format = ft_glyph_format_composite;
+ glyph->num_subglyphs += num_subglyphs;
+ glyph->format = ft_glyph_format_composite;
goto Load_End;
}
@@ -741,7 +740,9 @@
{
TT_Int n, num_base_points, num_new_points;
- subglyph = subglyphs;
+ subglyph = glyph->subglyphs + glyph->num_subglyphs;
+ glyph->num_subglyphs += num_subglyphs;
+
for ( n = 0; n < num_subglyphs; n++, subglyph++ )
{
TT_Vector pp1, pp2;
@@ -753,6 +754,8 @@
num_base_points = loader->base.n_points;
error = load_truetype_glyph( loader, subglyph->index );
+ if (error) goto Fail;
+
if ( subglyph->flags & USE_MY_METRICS )
{
pp1 = loader->pp1;
@@ -935,8 +938,8 @@
loader->pp2 = pp1[1];
}
#endif
-
}
+ /* end of composite loading */
}
/*************************************************************************/
@@ -1326,7 +1329,8 @@
#endif
/* Main loading loop */
- glyph->format = ft_glyph_format_outline;
+ glyph->format = ft_glyph_format_outline;
+ glyph->num_subglyphs = 0;
error = load_truetype_glyph( &loader, glyph_index );
if (!error)
compute_glyph_metrics( &loader, glyph_index );