summaryrefslogtreecommitdiff
path: root/src/sfnt/ttsbit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sfnt/ttsbit.c')
-rw-r--r--src/sfnt/ttsbit.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 98295932d..33b8640bc 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (body). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* Copyright 2013 by Google, Inc. */
@@ -24,6 +24,10 @@
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H
#include FT_BITMAP_H
+
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
#include "ttsbit.h"
#include "sferrors.h"
@@ -444,6 +448,15 @@
metrics->max_advance =
FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem );
+ /* set the scale values (in 16.16 units) so advances */
+ /* from the hmtx and vmtx table are scaled correctly */
+ metrics->x_scale = FT_MulDiv( metrics->x_ppem,
+ 64 * 0x10000,
+ face->header.Units_Per_EM );
+ metrics->y_scale = FT_MulDiv( metrics->y_ppem,
+ 64 * 0x10000,
+ face->header.Units_Per_EM );
+
return error;
}
@@ -994,8 +1007,9 @@
goto Fail;
}
- FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n",
- num_components ));
+ FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d component%s\n",
+ num_components,
+ num_components == 1 ? "" : "s" ));
for ( nn = 0; nn < num_components; nn++ )
{
@@ -1435,10 +1449,17 @@
return FT_THROW( Invalid_Table );
NoBitmap:
+ if ( recurse_count )
+ {
+ FT_TRACE4(( "tt_sbit_decoder_load_image:"
+ " missing subglyph sbit with glyph index %d\n",
+ glyph_index ));
+ return FT_THROW( Invalid_Composite );
+ }
+
FT_TRACE4(( "tt_sbit_decoder_load_image:"
" no sbit found for glyph index %d\n", glyph_index ));
-
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Missing_Bitmap );
}
@@ -1460,6 +1481,9 @@
FT_Byte* p;
FT_UNUSED( map );
+#ifndef FT_CONFIG_OPTION_USE_PNG
+ FT_UNUSED( metrics_only );
+#endif
strike_index = face->sbit_strike_map[strike_index];
@@ -1490,7 +1514,7 @@
FT_FRAME_EXIT();
if ( glyph_start == glyph_end )
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Missing_Bitmap );
if ( glyph_start > glyph_end ||
glyph_end - glyph_start < 8 ||
face->ebdt_size - strike_offset < glyph_end )
@@ -1647,5 +1671,12 @@
return error;
}
+#else /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int _tt_sbit_dummy;
+
+#endif /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
-/* EOF */
+/* END */