Werner Lemberg pushed to branch master at FreeType / FreeType
Commits:
-
5f19f49c
by Dominik Röttsches at 2022-05-19T06:09:17+02:00
-
a4c4566b
by Dominik Röttsches at 2022-05-19T07:14:05+02:00
7 changed files:
- + include/freetype/internal/ftmmtypes.h
- include/freetype/internal/services/svmm.h
- src/cff/cffdrivr.c
- src/truetype/ttdriver.c
- src/truetype/ttgxvar.c
- src/truetype/ttgxvar.h
- src/type1/t1driver.c
Changes:
1 | +/****************************************************************************
|
|
2 | + *
|
|
3 | + * ftmmtypes.h
|
|
4 | + *
|
|
5 | + * OpenType Variations type definitions for internal use
|
|
6 | + * with the multi-masters service (specification).
|
|
7 | + *
|
|
8 | + * Copyright (C) 2022 by
|
|
9 | + * David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and
|
|
10 | + * Dominik Röttsches.
|
|
11 | + *
|
|
12 | + * This file is part of the FreeType project, and may only be used,
|
|
13 | + * modified, and distributed under the terms of the FreeType project
|
|
14 | + * license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
15 | + * this file you indicate that you have read the license and
|
|
16 | + * understand and accept it fully.
|
|
17 | + *
|
|
18 | + */
|
|
19 | + |
|
20 | + |
|
21 | +#ifndef FTMMTYPES_H_
|
|
22 | +#define FTMMTYPES_H_
|
|
23 | + |
|
24 | +FT_BEGIN_HEADER
|
|
25 | + |
|
26 | + |
|
27 | + typedef struct GX_ItemVarDataRec_
|
|
28 | + {
|
|
29 | + FT_UInt itemCount; /* number of delta sets per item */
|
|
30 | + FT_UInt regionIdxCount; /* number of region indices in this data */
|
|
31 | + FT_UInt* regionIndices; /* array of `regionCount' indices; */
|
|
32 | + /* these index `varRegionList' */
|
|
33 | + FT_Short* deltaSet; /* array of `itemCount' deltas */
|
|
34 | + /* use `innerIndex' for this array */
|
|
35 | + |
|
36 | + } GX_ItemVarDataRec, *GX_ItemVarData;
|
|
37 | + |
|
38 | + |
|
39 | + /* contribution of one axis to a region */
|
|
40 | + typedef struct GX_AxisCoordsRec_
|
|
41 | + {
|
|
42 | + FT_Fixed startCoord;
|
|
43 | + FT_Fixed peakCoord; /* zero means no effect (factor = 1) */
|
|
44 | + FT_Fixed endCoord;
|
|
45 | + |
|
46 | + } GX_AxisCoordsRec, *GX_AxisCoords;
|
|
47 | + |
|
48 | + |
|
49 | + typedef struct GX_VarRegionRec_
|
|
50 | + {
|
|
51 | + GX_AxisCoords axisList; /* array of axisCount records */
|
|
52 | + |
|
53 | + } GX_VarRegionRec, *GX_VarRegion;
|
|
54 | + |
|
55 | + |
|
56 | + /* item variation store */
|
|
57 | + typedef struct GX_ItemVarStoreRec_
|
|
58 | + {
|
|
59 | + FT_UInt dataCount;
|
|
60 | + GX_ItemVarData varData; /* array of dataCount records; */
|
|
61 | + /* use `outerIndex' for this array */
|
|
62 | + FT_UShort axisCount;
|
|
63 | + FT_UInt regionCount; /* total number of regions defined */
|
|
64 | + GX_VarRegion varRegionList;
|
|
65 | + |
|
66 | + } GX_ItemVarStoreRec, *GX_ItemVarStore;
|
|
67 | + |
|
68 | + |
|
69 | + typedef struct GX_DeltaSetIdxMapRec_
|
|
70 | + {
|
|
71 | + FT_ULong mapCount;
|
|
72 | + FT_UInt* outerIndex; /* indices to item var data */
|
|
73 | + FT_UInt* innerIndex; /* indices to delta set */
|
|
74 | + |
|
75 | + } GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap;
|
|
76 | + |
|
77 | + |
|
78 | +FT_END_HEADER
|
|
79 | + |
|
80 | +#endif /* FTMMTYPES_H_ */
|
|
81 | + |
|
82 | + |
|
83 | +/* END */ |
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | * The FreeType Multiple Masters and GX var services (specification).
|
6 | 6 | *
|
7 | 7 | * Copyright (C) 2003-2022 by
|
8 | - * David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
8 | + * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
|
|
9 | 9 | *
|
10 | 10 | * This file is part of the FreeType project, and may only be used,
|
11 | 11 | * modified, and distributed under the terms of the FreeType project
|
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #define SVMM_H_
|
21 | 21 | |
22 | 22 | #include <freetype/internal/ftserv.h>
|
23 | +#include <freetype/internal/ftmmtypes.h>
|
|
23 | 24 | |
24 | 25 | |
25 | 26 | FT_BEGIN_HEADER
|
... | ... | @@ -96,53 +97,94 @@ FT_BEGIN_HEADER |
96 | 97 | FT_UInt* len,
|
97 | 98 | FT_Fixed* weight_vector );
|
98 | 99 | |
100 | + typedef FT_Error
|
|
101 | + (*FT_Var_Load_Delta_Set_Idx_Map_Func)( FT_Face face,
|
|
102 | + FT_ULong offset,
|
|
103 | + GX_DeltaSetIdxMap map,
|
|
104 | + GX_ItemVarStore itemStore,
|
|
105 | + FT_ULong table_len );
|
|
106 | + |
|
107 | + typedef FT_Error
|
|
108 | + (*FT_Var_Load_Item_Var_Store_Func)( FT_Face face,
|
|
109 | + FT_ULong offset,
|
|
110 | + GX_ItemVarStore itemStore );
|
|
111 | + |
|
112 | + typedef FT_Int
|
|
113 | + (*FT_Var_Get_Item_Delta_Func)( FT_Face face,
|
|
114 | + GX_ItemVarStore itemStore,
|
|
115 | + FT_UInt outerIndex,
|
|
116 | + FT_UInt innerIndex );
|
|
117 | + |
|
118 | + typedef void
|
|
119 | + (*FT_Var_Done_Item_Var_Store_Func)( FT_Face face,
|
|
120 | + GX_ItemVarStore itemStore );
|
|
121 | + |
|
122 | + typedef void
|
|
123 | + (*FT_Var_Done_Delta_Set_Idx_Map_Func)( FT_Face face,
|
|
124 | + GX_DeltaSetIdxMap deltaSetIdxMap );
|
|
125 | + |
|
99 | 126 | |
100 | 127 | FT_DEFINE_SERVICE( MultiMasters )
|
101 | 128 | {
|
102 | - FT_Get_MM_Func get_mm;
|
|
103 | - FT_Set_MM_Design_Func set_mm_design;
|
|
104 | - FT_Set_MM_Blend_Func set_mm_blend;
|
|
105 | - FT_Get_MM_Blend_Func get_mm_blend;
|
|
106 | - FT_Get_MM_Var_Func get_mm_var;
|
|
107 | - FT_Set_Var_Design_Func set_var_design;
|
|
108 | - FT_Get_Var_Design_Func get_var_design;
|
|
109 | - FT_Set_Instance_Func set_instance;
|
|
110 | - FT_Set_MM_WeightVector_Func set_mm_weightvector;
|
|
111 | - FT_Get_MM_WeightVector_Func get_mm_weightvector;
|
|
129 | + FT_Get_MM_Func get_mm;
|
|
130 | + FT_Set_MM_Design_Func set_mm_design;
|
|
131 | + FT_Set_MM_Blend_Func set_mm_blend;
|
|
132 | + FT_Get_MM_Blend_Func get_mm_blend;
|
|
133 | + FT_Get_MM_Var_Func get_mm_var;
|
|
134 | + FT_Set_Var_Design_Func set_var_design;
|
|
135 | + FT_Get_Var_Design_Func get_var_design;
|
|
136 | + FT_Set_Instance_Func set_instance;
|
|
137 | + FT_Set_MM_WeightVector_Func set_mm_weightvector;
|
|
138 | + FT_Get_MM_WeightVector_Func get_mm_weightvector;
|
|
112 | 139 | |
113 | 140 | /* for internal use; only needed for code sharing between modules */
|
114 | - FT_Get_Var_Blend_Func get_var_blend;
|
|
115 | - FT_Done_Blend_Func done_blend;
|
|
141 | + FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map;
|
|
142 | + FT_Var_Load_Item_Var_Store_Func load_item_var_store;
|
|
143 | + FT_Var_Get_Item_Delta_Func get_item_delta;
|
|
144 | + FT_Var_Done_Item_Var_Store_Func done_item_var_store;
|
|
145 | + FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_idx_map;
|
|
146 | + FT_Get_Var_Blend_Func get_var_blend;
|
|
147 | + FT_Done_Blend_Func done_blend;
|
|
116 | 148 | };
|
117 | 149 | |
118 | 150 | |
119 | -#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
|
|
120 | - get_mm_, \
|
|
121 | - set_mm_design_, \
|
|
122 | - set_mm_blend_, \
|
|
123 | - get_mm_blend_, \
|
|
124 | - get_mm_var_, \
|
|
125 | - set_var_design_, \
|
|
126 | - get_var_design_, \
|
|
127 | - set_instance_, \
|
|
128 | - set_weightvector_, \
|
|
129 | - get_weightvector_, \
|
|
130 | - get_var_blend_, \
|
|
131 | - done_blend_ ) \
|
|
132 | - static const FT_Service_MultiMastersRec class_ = \
|
|
133 | - { \
|
|
134 | - get_mm_, \
|
|
135 | - set_mm_design_, \
|
|
136 | - set_mm_blend_, \
|
|
137 | - get_mm_blend_, \
|
|
138 | - get_mm_var_, \
|
|
139 | - set_var_design_, \
|
|
140 | - get_var_design_, \
|
|
141 | - set_instance_, \
|
|
142 | - set_weightvector_, \
|
|
143 | - get_weightvector_, \
|
|
144 | - get_var_blend_, \
|
|
145 | - done_blend_ \
|
|
151 | +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
|
|
152 | + get_mm_, \
|
|
153 | + set_mm_design_, \
|
|
154 | + set_mm_blend_, \
|
|
155 | + get_mm_blend_, \
|
|
156 | + get_mm_var_, \
|
|
157 | + set_var_design_, \
|
|
158 | + get_var_design_, \
|
|
159 | + set_instance_, \
|
|
160 | + set_weightvector_, \
|
|
161 | + get_weightvector_, \
|
|
162 | + load_delta_set_idx_map_, \
|
|
163 | + load_item_var_store_, \
|
|
164 | + get_item_delta_, \
|
|
165 | + done_item_var_store_, \
|
|
166 | + done_delta_set_idx_map_, \
|
|
167 | + get_var_blend_, \
|
|
168 | + done_blend_ ) \
|
|
169 | + static const FT_Service_MultiMastersRec class_ = \
|
|
170 | + { \
|
|
171 | + get_mm_, \
|
|
172 | + set_mm_design_, \
|
|
173 | + set_mm_blend_, \
|
|
174 | + get_mm_blend_, \
|
|
175 | + get_mm_var_, \
|
|
176 | + set_var_design_, \
|
|
177 | + get_var_design_, \
|
|
178 | + set_instance_, \
|
|
179 | + set_weightvector_, \
|
|
180 | + get_weightvector_, \
|
|
181 | + load_delta_set_idx_map_, \
|
|
182 | + load_item_var_store_, \
|
|
183 | + get_item_delta_, \
|
|
184 | + done_item_var_store_, \
|
|
185 | + done_delta_set_idx_map_, \
|
|
186 | + get_var_blend_, \
|
|
187 | + done_blend_ \
|
|
146 | 188 | };
|
147 | 189 | |
148 | 190 | /* */
|
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | * OpenType font driver implementation (body).
|
6 | 6 | *
|
7 | 7 | * Copyright (C) 1996-2022 by
|
8 | - * David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
8 | + * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
|
|
9 | 9 | *
|
10 | 10 | * This file is part of the FreeType project, and may only be used,
|
11 | 11 | * modified, and distributed under the terms of the FreeType project
|
... | ... | @@ -936,22 +936,103 @@ |
936 | 936 | }
|
937 | 937 | |
938 | 938 | |
939 | + static FT_Error
|
|
940 | + cff_load_item_variation_store( CFF_Face face,
|
|
941 | + FT_ULong offset,
|
|
942 | + GX_ItemVarStore itemStore )
|
|
943 | + {
|
|
944 | + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
|
945 | + |
|
946 | + |
|
947 | + return mm->load_item_var_store( FT_FACE(face), offset, itemStore );
|
|
948 | + }
|
|
949 | + |
|
950 | + |
|
951 | + static FT_Error
|
|
952 | + cff_load_delta_set_index_mapping( CFF_Face face,
|
|
953 | + FT_ULong offset,
|
|
954 | + GX_DeltaSetIdxMap map,
|
|
955 | + GX_ItemVarStore itemStore,
|
|
956 | + FT_ULong table_len )
|
|
957 | + {
|
|
958 | + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
|
959 | + |
|
960 | + |
|
961 | + return mm->load_delta_set_idx_map( FT_FACE( face ), offset, map,
|
|
962 | + itemStore, table_len );
|
|
963 | + }
|
|
964 | + |
|
965 | + |
|
966 | + static FT_Int
|
|
967 | + cff_get_item_delta( CFF_Face face,
|
|
968 | + GX_ItemVarStore itemStore,
|
|
969 | + FT_UInt outerIndex,
|
|
970 | + FT_UInt innerIndex )
|
|
971 | + {
|
|
972 | + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
|
973 | + |
|
974 | + |
|
975 | + return mm->get_item_delta( FT_FACE( face ), itemStore,
|
|
976 | + outerIndex, innerIndex );
|
|
977 | + }
|
|
978 | + |
|
979 | + |
|
980 | + static void
|
|
981 | + cff_done_item_variation_store( CFF_Face face,
|
|
982 | + GX_ItemVarStore itemStore )
|
|
983 | + {
|
|
984 | + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
|
985 | + |
|
986 | + |
|
987 | + mm->done_item_var_store( FT_FACE( face ), itemStore );
|
|
988 | + }
|
|
989 | + |
|
990 | + |
|
991 | + static void
|
|
992 | + cff_done_delta_set_index_map( CFF_Face face,
|
|
993 | + GX_DeltaSetIdxMap deltaSetIdxMap )
|
|
994 | + {
|
|
995 | + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
|
996 | + |
|
997 | + |
|
998 | + mm->done_delta_set_idx_map( FT_FACE ( face ), deltaSetIdxMap );
|
|
999 | + }
|
|
1000 | + |
|
1001 | + |
|
1002 | + |
|
939 | 1003 | FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
940 | 1004 | cff_service_multi_masters,
|
941 | 1005 | |
942 | - (FT_Get_MM_Func) NULL, /* get_mm */
|
|
943 | - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
|
944 | - (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
|
|
945 | - (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
|
|
946 | - (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
|
|
947 | - (FT_Set_Var_Design_Func) cff_set_var_design, /* set_var_design */
|
|
948 | - (FT_Get_Var_Design_Func) cff_get_var_design, /* get_var_design */
|
|
949 | - (FT_Set_Instance_Func) cff_set_instance, /* set_instance */
|
|
950 | - (FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */
|
|
951 | - (FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */
|
|
952 | - |
|
953 | - (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
|
|
954 | - (FT_Done_Blend_Func) cff_done_blend /* done_blend */
|
|
1006 | + (FT_Get_MM_Func) NULL, /* get_mm */
|
|
1007 | + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
|
1008 | + (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
|
|
1009 | + (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
|
|
1010 | + (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
|
|
1011 | + (FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */
|
|
1012 | + (FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */
|
|
1013 | + (FT_Set_Instance_Func) cff_set_instance, /* set_instance */
|
|
1014 | + (FT_Set_MM_WeightVector_Func)
|
|
1015 | + cff_set_mm_weightvector,
|
|
1016 | + /* set_mm_weightvector */
|
|
1017 | + (FT_Get_MM_WeightVector_Func)
|
|
1018 | + cff_get_mm_weightvector,
|
|
1019 | + /* get_mm_weightvector */
|
|
1020 | + (FT_Var_Load_Delta_Set_Idx_Map_Func)
|
|
1021 | + cff_load_delta_set_index_mapping,
|
|
1022 | + /* load_delta_set_idx_map */
|
|
1023 | + (FT_Var_Load_Item_Var_Store_Func)
|
|
1024 | + cff_load_item_variation_store,
|
|
1025 | + /* load_item_variation_store */
|
|
1026 | + (FT_Var_Get_Item_Delta_Func)
|
|
1027 | + cff_get_item_delta, /* get_item_delta */
|
|
1028 | + (FT_Var_Done_Item_Var_Store_Func)
|
|
1029 | + cff_done_item_variation_store,
|
|
1030 | + /* done_item_variation_store */
|
|
1031 | + (FT_Var_Done_Delta_Set_Idx_Map_Func)
|
|
1032 | + cff_done_delta_set_index_map,
|
|
1033 | + /* done_delta_set_index_map */
|
|
1034 | + (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
|
|
1035 | + (FT_Done_Blend_Func) cff_done_blend /* done_blend */
|
|
955 | 1036 | )
|
956 | 1037 | |
957 | 1038 |
... | ... | @@ -507,19 +507,34 @@ |
507 | 507 | FT_DEFINE_SERVICE_MULTIMASTERSREC(
|
508 | 508 | tt_service_gx_multi_masters,
|
509 | 509 | |
510 | - (FT_Get_MM_Func) NULL, /* get_mm */
|
|
511 | - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
|
512 | - (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */
|
|
513 | - (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */
|
|
514 | - (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
|
|
515 | - (FT_Set_Var_Design_Func) TT_Set_Var_Design, /* set_var_design */
|
|
516 | - (FT_Get_Var_Design_Func) TT_Get_Var_Design, /* get_var_design */
|
|
517 | - (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
|
|
518 | - (FT_Set_MM_WeightVector_Func)NULL, /* set_mm_weightvector */
|
|
519 | - (FT_Get_MM_WeightVector_Func)NULL, /* get_mm_weightvector */
|
|
520 | - |
|
521 | - (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
|
|
522 | - (FT_Done_Blend_Func) tt_done_blend /* done_blend */
|
|
510 | + (FT_Get_MM_Func) NULL, /* get_mm */
|
|
511 | + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
|
|
512 | + (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */
|
|
513 | + (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */
|
|
514 | + (FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
|
|
515 | + (FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */
|
|
516 | + (FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */
|
|
517 | + (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
|
|
518 | + (FT_Set_MM_WeightVector_Func)
|
|
519 | + NULL, /* set_mm_weightvector */
|
|
520 | + (FT_Get_MM_WeightVector_Func)
|
|
521 | + NULL, /* get_mm_weightvector */
|
|
522 | + (FT_Var_Load_Delta_Set_Idx_Map_Func)
|
|
523 | + tt_var_load_delta_set_index_mapping,
|
|
524 | + /* load_delta_set_idx_map */
|
|
525 | + (FT_Var_Load_Item_Var_Store_Func)
|
|
526 | + tt_var_load_item_variation_store,
|
|
527 | + /* load_item_variation_store */
|
|
528 | + (FT_Var_Get_Item_Delta_Func)
|
|
529 | + tt_var_get_item_delta, /* get_item_delta */
|
|
530 | + (FT_Var_Done_Item_Var_Store_Func)
|
|
531 | + tt_var_done_item_variation_store,
|
|
532 | + /* done_item_variation_store */
|
|
533 | + (FT_Var_Done_Delta_Set_Idx_Map_Func)
|
|
534 | + tt_var_done_delta_set_index_map,
|
|
535 | + /* done_delta_set_index_map */
|
|
536 | + (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
|
|
537 | + (FT_Done_Blend_Func) tt_done_blend /* done_blend */
|
|
523 | 538 | )
|
524 | 539 | |
525 | 540 | FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
|
... | ... | @@ -438,8 +438,8 @@ |
438 | 438 | }
|
439 | 439 | |
440 | 440 | |
441 | - static FT_Error
|
|
442 | - ft_var_load_item_variation_store( TT_Face face,
|
|
441 | + FT_LOCAL_DEF( FT_Error )
|
|
442 | + tt_var_load_item_variation_store( TT_Face face,
|
|
443 | 443 | FT_ULong offset,
|
444 | 444 | GX_ItemVarStore itemStore )
|
445 | 445 | {
|
... | ... | @@ -465,7 +465,7 @@ |
465 | 465 | |
466 | 466 | if ( format != 1 )
|
467 | 467 | {
|
468 | - FT_TRACE2(( "ft_var_load_item_variation_store: bad store format %d\n",
|
|
468 | + FT_TRACE2(( "tt_var_load_item_variation_store: bad store format %d\n",
|
|
469 | 469 | format ));
|
470 | 470 | error = FT_THROW( Invalid_Table );
|
471 | 471 | goto Exit;
|
... | ... | @@ -479,7 +479,7 @@ |
479 | 479 | /* we need at least one entry in `itemStore->varData' */
|
480 | 480 | if ( !itemStore->dataCount )
|
481 | 481 | {
|
482 | - FT_TRACE2(( "ft_var_load_item_variation_store: missing varData\n" ));
|
|
482 | + FT_TRACE2(( "tt_var_load_item_variation_store: missing varData\n" ));
|
|
483 | 483 | error = FT_THROW( Invalid_Table );
|
484 | 484 | goto Exit;
|
485 | 485 | }
|
... | ... | @@ -515,7 +515,7 @@ |
515 | 515 | |
516 | 516 | if ( itemStore->axisCount != (FT_Long)blend->mmvar->num_axis )
|
517 | 517 | {
|
518 | - FT_TRACE2(( "ft_var_load_item_variation_store:"
|
|
518 | + FT_TRACE2(( "tt_var_load_item_variation_store:"
|
|
519 | 519 | " number of axes in item variation store\n" ));
|
520 | 520 | FT_TRACE2(( " "
|
521 | 521 | " and `fvar' table are different\n" ));
|
... | ... | @@ -526,7 +526,7 @@ |
526 | 526 | /* new constraint in OpenType 1.8.4 */
|
527 | 527 | if ( itemStore->regionCount >= 32768U )
|
528 | 528 | {
|
529 | - FT_TRACE2(( "ft_var_load_item_variation_store:"
|
|
529 | + FT_TRACE2(( "tt_var_load_item_variation_store:"
|
|
530 | 530 | " too many variation region tables\n" ));
|
531 | 531 | error = FT_THROW( Invalid_Table );
|
532 | 532 | goto Exit;
|
... | ... | @@ -680,8 +680,8 @@ |
680 | 680 | }
|
681 | 681 | |
682 | 682 | |
683 | - static FT_Error
|
|
684 | - ft_var_load_delta_set_index_mapping( TT_Face face,
|
|
683 | + FT_LOCAL_DEF( FT_Error )
|
|
684 | + tt_var_load_delta_set_index_mapping( TT_Face face,
|
|
685 | 685 | FT_ULong offset,
|
686 | 686 | GX_DeltaSetIdxMap map,
|
687 | 687 | GX_ItemVarStore itemStore,
|
... | ... | @@ -738,7 +738,7 @@ |
738 | 738 | /* rough sanity check */
|
739 | 739 | if ( map->mapCount * entrySize > table_len )
|
740 | 740 | {
|
741 | - FT_TRACE1(( "ft_var_load_delta_set_index_mapping:"
|
|
741 | + FT_TRACE1(( "tt_var_load_delta_set_index_mapping:"
|
|
742 | 742 | " invalid number of delta-set index mappings\n" ));
|
743 | 743 | error = FT_THROW( Invalid_Table );
|
744 | 744 | goto Exit;
|
... | ... | @@ -907,7 +907,7 @@ |
907 | 907 | table = blend->hvar_table;
|
908 | 908 | }
|
909 | 909 | |
910 | - error = ft_var_load_item_variation_store(
|
|
910 | + error = tt_var_load_item_variation_store(
|
|
911 | 911 | face,
|
912 | 912 | table_offset + store_offset,
|
913 | 913 | &table->itemStore );
|
... | ... | @@ -916,7 +916,7 @@ |
916 | 916 | |
917 | 917 | if ( widthMap_offset )
|
918 | 918 | {
|
919 | - error = ft_var_load_delta_set_index_mapping(
|
|
919 | + error = tt_var_load_delta_set_index_mapping(
|
|
920 | 920 | face,
|
921 | 921 | table_offset + widthMap_offset,
|
922 | 922 | &table->widthMap,
|
... | ... | @@ -958,8 +958,8 @@ |
958 | 958 | }
|
959 | 959 | |
960 | 960 | |
961 | - static FT_Int
|
|
962 | - ft_var_get_item_delta( TT_Face face,
|
|
961 | + FT_LOCAL_DEF( FT_Int )
|
|
962 | + tt_var_get_item_delta( TT_Face face,
|
|
963 | 963 | GX_ItemVarStore itemStore,
|
964 | 964 | FT_UInt outerIndex,
|
965 | 965 | FT_UInt innerIndex )
|
... | ... | @@ -1157,7 +1157,7 @@ |
1157 | 1157 | }
|
1158 | 1158 | else
|
1159 | 1159 | {
|
1160 | - delta = ft_var_get_item_delta( face,
|
|
1160 | + delta = tt_var_get_item_delta( face,
|
|
1161 | 1161 | &table->itemStore,
|
1162 | 1162 | outerIndex,
|
1163 | 1163 | innerIndex );
|
... | ... | @@ -1337,7 +1337,7 @@ |
1337 | 1337 | |
1338 | 1338 | records_offset = FT_STREAM_POS();
|
1339 | 1339 | |
1340 | - error = ft_var_load_item_variation_store(
|
|
1340 | + error = tt_var_load_item_variation_store(
|
|
1341 | 1341 | face,
|
1342 | 1342 | table_offset + store_offset,
|
1343 | 1343 | &blend->mvar_table->itemStore );
|
... | ... | @@ -1466,7 +1466,7 @@ |
1466 | 1466 | continue;
|
1467 | 1467 | }
|
1468 | 1468 | |
1469 | - delta = ft_var_get_item_delta( face,
|
|
1469 | + delta = tt_var_get_item_delta( face,
|
|
1470 | 1470 | &blend->mvar_table->itemStore,
|
1471 | 1471 | value->outerIndex,
|
1472 | 1472 | value->innerIndex );
|
... | ... | @@ -4349,8 +4349,8 @@ |
4349 | 4349 | }
|
4350 | 4350 | |
4351 | 4351 | |
4352 | - static void
|
|
4353 | - ft_var_done_item_variation_store( TT_Face face,
|
|
4352 | + FT_LOCAL_DEF( void )
|
|
4353 | + tt_var_done_item_variation_store( TT_Face face,
|
|
4354 | 4354 | GX_ItemVarStore itemStore )
|
4355 | 4355 | {
|
4356 | 4356 | FT_Memory memory = FT_FACE_MEMORY( face );
|
... | ... | @@ -4378,6 +4378,18 @@ |
4378 | 4378 | }
|
4379 | 4379 | |
4380 | 4380 | |
4381 | + FT_LOCAL_DEF( void )
|
|
4382 | + tt_var_done_delta_set_index_map( TT_Face face,
|
|
4383 | + GX_DeltaSetIdxMap deltaSetIdxMap )
|
|
4384 | + {
|
|
4385 | + FT_Memory memory = FT_FACE_MEMORY( face );
|
|
4386 | + |
|
4387 | + |
|
4388 | + FT_FREE( deltaSetIdxMap->innerIndex );
|
|
4389 | + FT_FREE( deltaSetIdxMap->outerIndex );
|
|
4390 | + }
|
|
4391 | + |
|
4392 | + |
|
4381 | 4393 | /**************************************************************************
|
4382 | 4394 | *
|
4383 | 4395 | * @Function:
|
... | ... | @@ -4415,27 +4427,27 @@ |
4415 | 4427 | |
4416 | 4428 | if ( blend->hvar_table )
|
4417 | 4429 | {
|
4418 | - ft_var_done_item_variation_store( face,
|
|
4430 | + tt_var_done_item_variation_store( face,
|
|
4419 | 4431 | &blend->hvar_table->itemStore );
|
4420 | 4432 | |
4421 | - FT_FREE( blend->hvar_table->widthMap.innerIndex );
|
|
4422 | - FT_FREE( blend->hvar_table->widthMap.outerIndex );
|
|
4433 | + tt_var_done_delta_set_index_map( face,
|
|
4434 | + &blend->hvar_table->widthMap );
|
|
4423 | 4435 | FT_FREE( blend->hvar_table );
|
4424 | 4436 | }
|
4425 | 4437 | |
4426 | 4438 | if ( blend->vvar_table )
|
4427 | 4439 | {
|
4428 | - ft_var_done_item_variation_store( face,
|
|
4440 | + tt_var_done_item_variation_store( face,
|
|
4429 | 4441 | &blend->vvar_table->itemStore );
|
4430 | 4442 | |
4431 | - FT_FREE( blend->vvar_table->widthMap.innerIndex );
|
|
4432 | - FT_FREE( blend->vvar_table->widthMap.outerIndex );
|
|
4443 | + tt_var_done_delta_set_index_map( face,
|
|
4444 | + &blend->vvar_table->widthMap );
|
|
4433 | 4445 | FT_FREE( blend->vvar_table );
|
4434 | 4446 | }
|
4435 | 4447 | |
4436 | 4448 | if ( blend->mvar_table )
|
4437 | 4449 | {
|
4438 | - ft_var_done_item_variation_store( face,
|
|
4450 | + tt_var_done_item_variation_store( face,
|
|
4439 | 4451 | &blend->mvar_table->itemStore );
|
4440 | 4452 | |
4441 | 4453 | FT_FREE( blend->mvar_table->values );
|
... | ... | @@ -62,57 +62,6 @@ FT_BEGIN_HEADER |
62 | 62 | } GX_AVarSegmentRec, *GX_AVarSegment;
|
63 | 63 | |
64 | 64 | |
65 | - typedef struct GX_ItemVarDataRec_
|
|
66 | - {
|
|
67 | - FT_UInt itemCount; /* number of delta sets per item */
|
|
68 | - FT_UInt regionIdxCount; /* number of region indices in this data */
|
|
69 | - FT_UInt* regionIndices; /* array of `regionCount' indices; */
|
|
70 | - /* these index `varRegionList' */
|
|
71 | - FT_Short* deltaSet; /* array of `itemCount' deltas */
|
|
72 | - /* use `innerIndex' for this array */
|
|
73 | - |
|
74 | - } GX_ItemVarDataRec, *GX_ItemVarData;
|
|
75 | - |
|
76 | - |
|
77 | - /* contribution of one axis to a region */
|
|
78 | - typedef struct GX_AxisCoordsRec_
|
|
79 | - {
|
|
80 | - FT_Fixed startCoord;
|
|
81 | - FT_Fixed peakCoord; /* zero means no effect (factor = 1) */
|
|
82 | - FT_Fixed endCoord;
|
|
83 | - |
|
84 | - } GX_AxisCoordsRec, *GX_AxisCoords;
|
|
85 | - |
|
86 | - |
|
87 | - typedef struct GX_VarRegionRec_
|
|
88 | - {
|
|
89 | - GX_AxisCoords axisList; /* array of axisCount records */
|
|
90 | - |
|
91 | - } GX_VarRegionRec, *GX_VarRegion;
|
|
92 | - |
|
93 | - |
|
94 | - /* item variation store */
|
|
95 | - typedef struct GX_ItemVarStoreRec_
|
|
96 | - {
|
|
97 | - FT_UInt dataCount;
|
|
98 | - GX_ItemVarData varData; /* array of dataCount records; */
|
|
99 | - /* use `outerIndex' for this array */
|
|
100 | - FT_UShort axisCount;
|
|
101 | - FT_UInt regionCount; /* total number of regions defined */
|
|
102 | - GX_VarRegion varRegionList;
|
|
103 | - |
|
104 | - } GX_ItemVarStoreRec, *GX_ItemVarStore;
|
|
105 | - |
|
106 | - |
|
107 | - typedef struct GX_DeltaSetIdxMapRec_
|
|
108 | - {
|
|
109 | - FT_ULong mapCount;
|
|
110 | - FT_UInt* outerIndex; /* indices to item var data */
|
|
111 | - FT_UInt* innerIndex; /* indices to delta set */
|
|
112 | - |
|
113 | - } GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap;
|
|
114 | - |
|
115 | - |
|
116 | 65 | /**************************************************************************
|
117 | 66 | *
|
118 | 67 | * @Struct:
|
... | ... | @@ -431,6 +380,34 @@ FT_BEGIN_HEADER |
431 | 380 | FT_LOCAL( void )
|
432 | 381 | tt_apply_mvar( TT_Face face );
|
433 | 382 | |
383 | + |
|
384 | + FT_LOCAL( FT_Error )
|
|
385 | + tt_var_load_item_variation_store( TT_Face face,
|
|
386 | + FT_ULong offset,
|
|
387 | + GX_ItemVarStore itemStore );
|
|
388 | + |
|
389 | + FT_LOCAL( FT_Error )
|
|
390 | + tt_var_load_delta_set_index_mapping( TT_Face face,
|
|
391 | + FT_ULong offset,
|
|
392 | + GX_DeltaSetIdxMap map,
|
|
393 | + GX_ItemVarStore itemStore,
|
|
394 | + FT_ULong table_len );
|
|
395 | + |
|
396 | + FT_LOCAL( FT_Int )
|
|
397 | + tt_var_get_item_delta( TT_Face face,
|
|
398 | + GX_ItemVarStore itemStore,
|
|
399 | + FT_UInt outerIndex,
|
|
400 | + FT_UInt innerIndex );
|
|
401 | + |
|
402 | + FT_LOCAL( void )
|
|
403 | + tt_var_done_item_variation_store( TT_Face face,
|
|
404 | + GX_ItemVarStore itemStore );
|
|
405 | + |
|
406 | + FT_LOCAL( void )
|
|
407 | + tt_var_done_delta_set_index_map( TT_Face face,
|
|
408 | + GX_DeltaSetIdxMap deltaSetIdxMap );
|
|
409 | + |
|
410 | + |
|
434 | 411 | FT_LOCAL( FT_Error )
|
435 | 412 | tt_get_var_blend( TT_Face face,
|
436 | 413 | FT_UInt *num_coords,
|
... | ... | @@ -121,19 +121,30 @@ |
121 | 121 | #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
|
122 | 122 | static const FT_Service_MultiMastersRec t1_service_multi_masters =
|
123 | 123 | {
|
124 | - (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */
|
|
125 | - (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */
|
|
126 | - (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */
|
|
127 | - (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */
|
|
128 | - (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */
|
|
129 | - (FT_Set_Var_Design_Func) T1_Set_Var_Design, /* set_var_design */
|
|
130 | - (FT_Get_Var_Design_Func) T1_Get_Var_Design, /* get_var_design */
|
|
131 | - (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */
|
|
132 | - (FT_Set_MM_WeightVector_Func)T1_Set_MM_WeightVector, /* set_mm_weightvector */
|
|
133 | - (FT_Get_MM_WeightVector_Func)T1_Get_MM_WeightVector, /* get_mm_weightvector */
|
|
134 | - |
|
135 | - (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */
|
|
136 | - (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */
|
|
124 | + (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */
|
|
125 | + (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */
|
|
126 | + (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */
|
|
127 | + (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */
|
|
128 | + (FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */
|
|
129 | + (FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */
|
|
130 | + (FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */
|
|
131 | + (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */
|
|
132 | + (FT_Set_MM_WeightVector_Func)
|
|
133 | + T1_Set_MM_WeightVector, /* set_mm_weightvector */
|
|
134 | + (FT_Get_MM_WeightVector_Func)
|
|
135 | + T1_Get_MM_WeightVector, /* get_mm_weightvector */
|
|
136 | + (FT_Var_Load_Delta_Set_Idx_Map_Func)
|
|
137 | + NULL, /* load_delta_set_idx_map */
|
|
138 | + (FT_Var_Load_Item_Var_Store_Func)
|
|
139 | + NULL, /* load_item_variation_store */
|
|
140 | + (FT_Var_Get_Item_Delta_Func)
|
|
141 | + NULL, /* get_item_delta */
|
|
142 | + (FT_Var_Done_Item_Var_Store_Func)
|
|
143 | + NULL, /* done_item_variation_store */
|
|
144 | + (FT_Var_Done_Delta_Set_Idx_Map_Func)
|
|
145 | + NULL, /* done_delta_set_index_map */
|
|
146 | + (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */
|
|
147 | + (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */
|
|
137 | 148 | };
|
138 | 149 | #endif
|
139 | 150 |