Conditionally compile environment support. * include/freetype/internal/ftobjs.h, src/autofit/afmodule.c, src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c: Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where necessary.
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
diff --git a/ChangeLog b/ChangeLog
index 1a1b4a5..63d48ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2016-07-11 Werner Lemberg <wl@gnu.org>
+ Conditionally compile environment support.
+
+ * include/freetype/internal/ftobjs.h, src/autofit/afmodule.c,
+ src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c:
+ Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where
+ necessary.
+
+2016-07-11 Werner Lemberg <wl@gnu.org>
+
Handle properties in `FREETYPE_PROPERTIES' environment variable.
This commit covers the most important one.
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 6b68d91..0a9f2d4 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -532,11 +532,13 @@ FT_BEGIN_HEADER
ft_module_get_service( FT_Module module,
const char* service_id );
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_BASE( FT_Error )
ft_property_string_set( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
FT_String* value );
+#endif
/* */
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 4a6b049..e8f8ff4 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -113,6 +113,10 @@
FT_Error error = FT_Err_Ok;
AF_Module module = (AF_Module)ft_module;
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ FT_UNUSED( value_is_string );
+#endif
+
if ( !ft_strcmp( property_name, "fallback-script" ) )
{
@@ -120,8 +124,10 @@
FT_UInt ss;
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
return FT_THROW( Invalid_Argument );
+#endif
fallback_script = (FT_UInt*)value;
@@ -155,8 +161,10 @@
FT_UInt* default_script;
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
return FT_THROW( Invalid_Argument );
+#endif
default_script = (FT_UInt*)value;
@@ -170,8 +178,10 @@
AF_FaceGlobals globals;
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
return FT_THROW( Invalid_Argument );
+#endif
prop = (FT_Prop_IncreaseXHeight*)value;
@@ -184,6 +194,7 @@
#ifdef AF_CONFIG_OPTION_USE_WARPER
else if ( !ft_strcmp( property_name, "warping" ) )
{
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
@@ -198,6 +209,7 @@
return FT_THROW( Invalid_Argument );
}
else
+#endif
{
FT_Bool* warping = (FT_Bool*)value;
@@ -212,6 +224,8 @@
{
FT_Int* darken_params;
FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_Int dp[8];
@@ -239,6 +253,7 @@
darken_params = dp;
}
else
+#endif
darken_params = (FT_Int*)value;
x1 = darken_params[0];
@@ -269,6 +284,7 @@
}
else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
{
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
@@ -283,6 +299,7 @@
return FT_THROW( Invalid_Argument );
}
else
+#endif
{
FT_Bool* no_stem_darkening = (FT_Bool*)value;
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index c265855..7a78357 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4679,6 +4679,8 @@
}
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+
/* this variant is used for handling the FREETYPE_PROPERTIES */
/* environment variable */
@@ -4696,6 +4698,8 @@
TRUE );
}
+#endif
+
/*************************************************************************/
/*************************************************************************/
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 2e2a437..67bf09d 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -665,11 +665,17 @@
FT_Error error = FT_Err_Ok;
CFF_Driver driver = (CFF_Driver)module;
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ FT_UNUSED( value_is_string );
+#endif
+
if ( !ft_strcmp( property_name, "darkening-parameters" ) )
{
FT_Int* darken_params;
FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_Int dp[8];
@@ -697,6 +703,7 @@
darken_params = dp;
}
else
+#endif
darken_params = (FT_Int*)value;
x1 = darken_params[0];
@@ -727,6 +734,7 @@
}
else if ( !ft_strcmp( property_name, "hinting-engine" ) )
{
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
@@ -742,6 +750,7 @@
return FT_THROW( Invalid_Argument );
}
else
+#endif
{
FT_UInt* hinting_engine = (FT_UInt*)value;
@@ -759,6 +768,7 @@
}
else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
{
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
@@ -773,6 +783,7 @@
return FT_THROW( Invalid_Argument );
}
else
+#endif
{
FT_Bool* no_stem_darkening = (FT_Bool*)value;
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 3debf78..2659b9c 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -67,12 +67,17 @@
FT_Error error = FT_Err_Ok;
TT_Driver driver = (TT_Driver)module;
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ FT_UNUSED( value_is_string );
+#endif
+
if ( !ft_strcmp( property_name, "interpreter-version" ) )
{
FT_UInt interpreter_version;
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
@@ -81,6 +86,7 @@
interpreter_version = (FT_UInt)ft_strtol( s, NULL, 10 );
}
else
+#endif
{
FT_UInt* iv = (FT_UInt*)value;