... |
... |
@@ -30,11 +30,14 @@ |
30
|
30
|
#include <freetype/internal/ftcalc.h>
|
31
|
31
|
#include <freetype/internal/ftdebug.h>
|
32
|
32
|
#include <freetype/internal/ftstream.h>
|
33
|
|
-#include <freetype/internal/services/svmm.h>
|
34
|
33
|
#include <freetype/tttags.h>
|
35
|
34
|
#include <freetype/ftcolor.h>
|
36
|
35
|
#include <freetype/config/integer-types.h>
|
37
|
36
|
|
|
37
|
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
38
|
+#include <freetype/internal/services/svmm.h>
|
|
39
|
+#endif
|
|
40
|
+
|
38
|
41
|
/* the next two code lines are a temporary hack, to be removed together */
|
39
|
42
|
/* with `VARIABLE_COLRV1_ENABLED` and related code as soon as variable */
|
40
|
43
|
/* 'COLR' support is complete and tested */
|
... |
... |
@@ -131,9 +134,11 @@ |
131
|
134
|
*/
|
132
|
135
|
FT_Byte* paints_start_v1;
|
133
|
136
|
|
|
137
|
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
134
|
138
|
/* Item Variation Store for variable 'COLR' v1. */
|
135
|
139
|
GX_ItemVarStoreRec var_store;
|
136
|
140
|
GX_DeltaSetIdxMapRec delta_set_idx_map;
|
|
141
|
+#endif
|
137
|
142
|
|
138
|
143
|
/* The memory that backs up the `COLR' table. */
|
139
|
144
|
void* table;
|
... |
... |
@@ -169,10 +174,10 @@ |
169
|
174
|
FT_ULong base_glyph_offset, layer_offset;
|
170
|
175
|
FT_ULong base_glyphs_offset_v1, num_base_glyphs_v1;
|
171
|
176
|
FT_ULong layer_offset_v1, num_layers_v1, clip_list_offset;
|
172
|
|
- FT_ULong var_idx_map_offset, var_store_offset;
|
173
|
177
|
FT_ULong table_size;
|
|
178
|
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
174
|
179
|
FT_ULong colr_offset_in_stream;
|
175
|
|
-
|
|
180
|
+#endif
|
176
|
181
|
|
177
|
182
|
/* `COLR' always needs `CPAL' */
|
178
|
183
|
if ( !face->cpal )
|
... |
... |
@@ -182,7 +187,9 @@ |
182
|
187
|
if ( error )
|
183
|
188
|
goto NoColr;
|
184
|
189
|
|
|
190
|
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
185
|
191
|
colr_offset_in_stream = FT_STREAM_POS();
|
|
192
|
+#endif
|
186
|
193
|
|
187
|
194
|
if ( table_size < COLR_HEADER_SIZE )
|
188
|
195
|
goto InvalidTable;
|
... |
... |
@@ -275,6 +282,7 @@ |
275
|
282
|
else
|
276
|
283
|
colr->clip_list = 0;
|
277
|
284
|
|
|
285
|
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
278
|
286
|
colr->var_store.dataCount = 0;
|
279
|
287
|
colr->var_store.varData = NULL;
|
280
|
288
|
colr->var_store.axisCount = 0;
|
... |
... |
@@ -285,11 +293,12 @@ |
285
|
293
|
colr->delta_set_idx_map.outerIndex = NULL;
|
286
|
294
|
colr->delta_set_idx_map.innerIndex = NULL;
|
287
|
295
|
|
288
|
|
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
289
|
296
|
if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR &&
|
290
|
297
|
VARIABLE_COLRV1_ENABLED )
|
291
|
298
|
{
|
292
|
|
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
|
299
|
+ FT_ULong var_idx_map_offset, var_store_offset;
|
|
300
|
+
|
|
301
|
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
293
|
302
|
|
294
|
303
|
|
295
|
304
|
var_idx_map_offset = FT_NEXT_ULONG( p );
|
... |
... |
@@ -557,8 +566,6 @@ |
557
|
566
|
FT_UInt num_deltas,
|
558
|
567
|
FT_ItemVarDelta* deltas )
|
559
|
568
|
{
|
560
|
|
- FT_Error error = FT_Err_Ok;
|
561
|
|
-
|
562
|
569
|
FT_UInt outer_index = 0;
|
563
|
570
|
FT_UInt inner_index = 0;
|
564
|
571
|
FT_ULong loop_var_index = var_index_base;
|
... |
... |
@@ -597,8 +604,7 @@ |
597
|
604
|
{
|
598
|
605
|
/* TODO: Direct lookup case not implemented or tested yet. */
|
599
|
606
|
FT_ASSERT( 0 );
|
600
|
|
- error = FT_THROW( Unimplemented_Feature );
|
601
|
|
- return error;
|
|
607
|
+ return 0;
|
602
|
608
|
}
|
603
|
609
|
|
604
|
610
|
deltas[i] = mm->get_item_delta( FT_FACE( face ), &colr->var_store,
|
... |
... |
@@ -617,12 +623,17 @@ |
617
|
623
|
FT_Byte* p,
|
618
|
624
|
FT_COLR_Paint* apaint )
|
619
|
625
|
{
|
620
|
|
- FT_Byte* paint_base = p;
|
621
|
|
- FT_Byte* child_table_p = NULL;
|
622
|
|
- FT_Bool do_read_var = FALSE;
|
623
|
|
- FT_ULong var_index_base = 0;
|
|
626
|
+ FT_Byte* paint_base = p;
|
|
627
|
+ FT_Byte* child_table_p = NULL;
|
|
628
|
+ FT_Bool do_read_var = FALSE;
|
|
629
|
+
|
|
630
|
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
631
|
+ FT_ULong var_index_base = 0;
|
624
|
632
|
/* Longest varIndexBase offset is 5 in the spec. */
|
625
|
|
- FT_ItemVarDelta item_deltas[6] = { 0, 0, 0, 0, 0, 0 };
|
|
633
|
+ FT_ItemVarDelta item_deltas[6] = { 0, 0, 0, 0, 0, 0 };
|
|
634
|
+#else
|
|
635
|
+ FT_UNUSED( face );
|
|
636
|
+#endif
|
626
|
637
|
|
627
|
638
|
|
628
|
639
|
if ( !p || !colr || !colr->table )
|
... |
... |
@@ -1062,9 +1073,6 @@ |
1062
|
1073
|
(FT_PaintFormat_Internal)apaint->format ==
|
1063
|
1074
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER )
|
1064
|
1075
|
{
|
1065
|
|
- FT_UInt num_deltas = 0;
|
1066
|
|
-
|
1067
|
|
-
|
1068
|
1076
|
apaint->u.rotate.paint.p = child_table_p;
|
1069
|
1077
|
apaint->u.rotate.paint.insert_root_transform = 0;
|
1070
|
1078
|
|
... |
... |
@@ -1091,6 +1099,9 @@ |
1091
|
1099
|
FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) &&
|
1092
|
1100
|
VARIABLE_COLRV1_ENABLED )
|
1093
|
1101
|
{
|
|
1102
|
+ FT_UInt num_deltas = 0;
|
|
1103
|
+
|
|
1104
|
+
|
1094
|
1105
|
var_index_base = FT_NEXT_ULONG( p );
|
1095
|
1106
|
|
1096
|
1107
|
if ( (FT_PaintFormat_Internal)apaint->format ==
|
... |
... |
@@ -1517,8 +1528,7 @@ |
1517
|
1528
|
Colr* colr = (Colr*)face->colr;
|
1518
|
1529
|
|
1519
|
1530
|
FT_Byte* p;
|
1520
|
|
- FT_Long var_index_base;
|
1521
|
|
- FT_Int item_deltas[2];
|
|
1531
|
+ FT_ULong var_index_base;
|
1522
|
1532
|
|
1523
|
1533
|
|
1524
|
1534
|
if ( !colr || !colr->table )
|
... |
... |
@@ -1552,6 +1562,9 @@ |
1552
|
1562
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
1553
|
1563
|
if ( VARIABLE_COLRV1_ENABLED )
|
1554
|
1564
|
{
|
|
1565
|
+ FT_Int item_deltas[2];
|
|
1566
|
+
|
|
1567
|
+
|
1555
|
1568
|
if ( !get_deltas_for_var_index_base( face, colr,
|
1556
|
1569
|
var_index_base,
|
1557
|
1570
|
2,
|
... |
... |
@@ -1561,6 +1574,8 @@ |
1561
|
1574
|
color_stop->stop_offset += (FT_Fixed)item_deltas[0] << 2;
|
1562
|
1575
|
color_stop->color.alpha += item_deltas[1];
|
1563
|
1576
|
}
|
|
1577
|
+#else
|
|
1578
|
+ FT_UNUSED( var_index_base );
|
1564
|
1579
|
#endif
|
1565
|
1580
|
}
|
1566
|
1581
|
|