Fix compilation if `TT_CONFIG_OPTION_GX_VAR_SUPPORT` is not set. * src/sfnt/ttcolr.c: Protect relevant code with `TT_CONFIG_OPTION_GX_VAR_SUPPORT`.
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
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 1c3dfc1..3dfd0c1 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -30,11 +30,14 @@
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
-#include <freetype/internal/services/svmm.h>
#include <freetype/tttags.h>
#include <freetype/ftcolor.h>
#include <freetype/config/integer-types.h>
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+#include <freetype/internal/services/svmm.h>
+#endif
+
/* the next two code lines are a temporary hack, to be removed together */
/* with `VARIABLE_COLRV1_ENABLED` and related code as soon as variable */
/* 'COLR' support is complete and tested */
@@ -131,9 +134,11 @@
*/
FT_Byte* paints_start_v1;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* Item Variation Store for variable 'COLR' v1. */
GX_ItemVarStoreRec var_store;
GX_DeltaSetIdxMapRec delta_set_idx_map;
+#endif
/* The memory that backs up the `COLR' table. */
void* table;
@@ -169,10 +174,10 @@
FT_ULong base_glyph_offset, layer_offset;
FT_ULong base_glyphs_offset_v1, num_base_glyphs_v1;
FT_ULong layer_offset_v1, num_layers_v1, clip_list_offset;
- FT_ULong var_idx_map_offset, var_store_offset;
FT_ULong table_size;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_ULong colr_offset_in_stream;
-
+#endif
/* `COLR' always needs `CPAL' */
if ( !face->cpal )
@@ -182,7 +187,9 @@
if ( error )
goto NoColr;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
colr_offset_in_stream = FT_STREAM_POS();
+#endif
if ( table_size < COLR_HEADER_SIZE )
goto InvalidTable;
@@ -275,6 +282,7 @@
else
colr->clip_list = 0;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
colr->var_store.dataCount = 0;
colr->var_store.varData = NULL;
colr->var_store.axisCount = 0;
@@ -285,11 +293,12 @@
colr->delta_set_idx_map.outerIndex = NULL;
colr->delta_set_idx_map.innerIndex = NULL;
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR &&
VARIABLE_COLRV1_ENABLED )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ FT_ULong var_idx_map_offset, var_store_offset;
+
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
var_idx_map_offset = FT_NEXT_ULONG( p );
@@ -614,12 +623,17 @@
FT_Byte* p,
FT_COLR_Paint* apaint )
{
- FT_Byte* paint_base = p;
- FT_Byte* child_table_p = NULL;
- FT_Bool do_read_var = FALSE;
- FT_ULong var_index_base = 0;
+ FT_Byte* paint_base = p;
+ FT_Byte* child_table_p = NULL;
+ FT_Bool do_read_var = FALSE;
+
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ FT_ULong var_index_base = 0;
/* Longest varIndexBase offset is 5 in the spec. */
- FT_ItemVarDelta item_deltas[6] = { 0, 0, 0, 0, 0, 0 };
+ FT_ItemVarDelta item_deltas[6] = { 0, 0, 0, 0, 0, 0 };
+#else
+ FT_UNUSED( face );
+#endif
if ( !p || !colr || !colr->table )
@@ -1059,9 +1073,6 @@
(FT_PaintFormat_Internal)apaint->format ==
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER )
{
- FT_UInt num_deltas = 0;
-
-
apaint->u.rotate.paint.p = child_table_p;
apaint->u.rotate.paint.insert_root_transform = 0;
@@ -1088,6 +1099,9 @@
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) &&
VARIABLE_COLRV1_ENABLED )
{
+ FT_UInt num_deltas = 0;
+
+
var_index_base = FT_NEXT_ULONG( p );
if ( (FT_PaintFormat_Internal)apaint->format ==
@@ -1515,7 +1529,6 @@
FT_Byte* p;
FT_ULong var_index_base;
- FT_Int item_deltas[2];
if ( !colr || !colr->table )
@@ -1549,6 +1562,9 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
if ( VARIABLE_COLRV1_ENABLED )
{
+ FT_Int item_deltas[2];
+
+
if ( !get_deltas_for_var_index_base( face, colr,
var_index_base,
2,
@@ -1558,6 +1574,8 @@
color_stop->stop_offset += (FT_Fixed)item_deltas[0] << 2;
color_stop->color.alpha += item_deltas[1];
}
+#else
+ FT_UNUSED( var_index_base );
#endif
}