Skip to content

Commit 70a6c2d

Browse files
jasonleenayloraror92
authored andcommitted
Update graphite library to 1.3.13 (also fixes LT-21731)
1 parent a63b41a commit 70a6c2d

74 files changed

Lines changed: 2142 additions & 2235 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Lib/src/graphite2/README

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
This directory contains the Graphite2 library from http://hg.palaso.org/graphitedev
2-
Current version derived from upstream changeset 0f9edca71849
1+
This directory contains the Graphite2 library from https://github.com/silnrsi/graphite
2+
Current version derived from upstream a7096fa Allow labels to return None from graphite
33
See update.sh for update procedure.
4-
5-
For more recent graphite code, see https://github.com/silnrsi/graphite

Lib/src/graphite2/include/graphite2/Font.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#define GR2_VERSION_MAJOR 1
3232
#define GR2_VERSION_MINOR 3
33-
#define GR2_VERSION_BUGFIX 2
33+
#define GR2_VERSION_BUGFIX 13
3434

3535
#ifdef __cplusplus
3636
extern "C"
@@ -51,12 +51,12 @@ GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix);
5151
* The Face Options allow the application to require that certain tables are
5252
* read during face construction. This may be of concern if the appFaceHandle
5353
* used in the gr_get_table_fn may change.
54-
* The values can be combined
54+
* The values can be combined
5555
*/
5656
enum gr_face_options {
5757
/** No preload, no cmap caching, fail if the graphite tables are invalid */
5858
gr_face_default = 0,
59-
/** Dumb rendering will be enabled if the graphite tables are invalid */
59+
/** Dumb rendering will be enabled if the graphite tables are invalid. @deprecated Since 1.311 */
6060
gr_face_dumbRendering = 1,
6161
/** preload glyphs at construction time */
6262
gr_face_preloadGlyphs = 2,
@@ -113,7 +113,7 @@ struct gr_face_ops
113113
gr_get_table_fn get_table;
114114
/** is a pointer to a function to notify the client the a table can be released.
115115
* This can be NULL to signify that the client does not wish to do any release handling. */
116-
gr_release_table_fn release_table;
116+
gr_release_table_fn release_table;
117117
};
118118
typedef struct gr_face_ops gr_face_ops;
119119

@@ -130,8 +130,8 @@ typedef struct gr_face_ops gr_face_ops;
130130
*/
131131
GR2_API gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *face_ops, unsigned int faceOptions);
132132

133-
/** Create a gr_face object given application information and a getTable function. This function is deprecated as of v1.2.0 in
134-
* favour of gr_make_face_with_ops.
133+
/** @deprecated Since v1.2.0 in favour of gr_make_face_with_ops.
134+
* Create a gr_face object given application information and a getTable function.
135135
*
136136
* @return gr_face or NULL if the font fails to load for some reason.
137137
* @param appFaceHandle This is application specific information that is passed
@@ -140,22 +140,25 @@ GR2_API gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, co
140140
* @param getTable Callback function to get table data.
141141
* @param faceOptions Bitfield describing various options. See enum gr_face_options for details.
142142
*/
143-
GR2_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
143+
GR2_DEPRECATED_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
144144

145-
//#ifndef GRAPHITE2_NSEGCACHE
146-
/** Create a gr_face object given application information, with subsegmental caching support
145+
/** @deprecated Since 1.3.7 this function is now an alias for gr_make_face_with_ops().
146+
*
147+
* Create a gr_face object given application information, with subsegmental caching support
147148
*
148149
* @return gr_face or NULL if the font fails to load.
149150
* @param appFaceHandle is a pointer to application specific information that is passed to getTable.
150151
* This may not be NULL and must stay alive as long as the gr_face is alive.
151152
* @param face_ops Pointer to face specific callback structure for table management. Must stay
152153
* alive for the duration of the call only.
153-
* @param segCacheMaxSize How large the segment cache is.
154+
* @param segCacheMaxSize Unused.
154155
* @param faceOptions Bitfield of values from enum gr_face_options
155156
*/
156-
GR2_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle, const gr_face_ops *face_ops, unsigned int segCacheMaxSize, unsigned int faceOptions);
157+
GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle, const gr_face_ops *face_ops, unsigned int segCacheMaxSize, unsigned int faceOptions);
157158

158-
/** Create a gr_face object given application information, with subsegmental caching support.
159+
/** @deprecated Since 1.3.7 this function is now an alias for gr_make_face().
160+
*
161+
* Create a gr_face object given application information, with subsegmental caching support.
159162
* This function is deprecated as of v1.2.0 in favour of gr_make_face_with_seg_cache_and_ops.
160163
*
161164
* @return gr_face or NULL if the font fails to load.
@@ -165,8 +168,7 @@ GR2_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle,
165168
* @param segCacheMaxSize How large the segment cache is.
166169
* @param faceOptions Bitfield of values from enum gr_face_options
167170
*/
168-
GR2_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
169-
//#endif
171+
GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
170172

171173
/** Convert a tag in a string into a gr_uint32
172174
*
@@ -243,16 +245,16 @@ GR2_API int gr_face_is_char_supported(const gr_face *pFace, gr_uint32 usv, gr_ui
243245
*/
244246
GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
245247

246-
//#ifndef GRAPHITE2_NSEGCACHE
247-
/** Create gr_face from a font file, with subsegment caching support.
248+
/** @deprecated Since 1.3.7. This function is now an alias for gr_make_file_face().
249+
*
250+
* Create gr_face from a font file, with subsegment caching support.
248251
*
249252
* @return gr_face that accesses a font file directly. Returns NULL on failure.
250253
* @param filename Full path and filename to font file
251254
* @param segCacheMaxSize Specifies how big to make the cache in segments.
252255
* @param faceOptions Bitfield from enum gr_face_options to control face options.
253256
*/
254-
GR2_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
255-
//#endif
257+
GR2_DEPRECATED_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
256258
#endif // !GRAPHITE2_NFILEFACE
257259

258260
/** Create a font from a face
@@ -347,7 +349,7 @@ GR2_API gr_uint16 gr_fref_n_values(const gr_feature_ref* pfeatureref);
347349
* @param pfeatureref gr_feature_ref of the feature of interest
348350
* @param settingno Index up to the return value of gr_fref_n_values() of the value
349351
*/
350-
GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
352+
GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
351353

352354
/** Returns a string of the UI name of a feature
353355
*
@@ -385,4 +387,3 @@ GR2_API void gr_featureval_destroy(gr_feature_val *pfeatures);
385387
#ifdef __cplusplus
386388
}
387389
#endif
388-

Lib/src/graphite2/include/graphite2/Log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef enum {
4242
GRLOG_SEGMENT = 0x02,
4343
GRLOG_PASS = 0x04,
4444
GRLOG_CACHE = 0x08,
45-
45+
4646
GRLOG_OPCODE = 0x80,
4747
GRLOG_ALL = 0xFF
4848
} GrLogMask;

Lib/src/graphite2/include/graphite2/Segment.h

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -62,63 +62,63 @@ enum gr_justFlags {
6262
/** Used for looking up slot attributes. Most are already available in other functions **/
6363
enum gr_attrCode {
6464
/// adjusted glyph advance in x direction in design units
65-
gr_slatAdvX = 0,
65+
gr_slatAdvX = 0,
6666
/// adjusted glyph advance in y direction (usually 0) in design units
67-
gr_slatAdvY,
67+
gr_slatAdvY,
6868
/// returns 0. Deprecated.
69-
gr_slatAttTo,
69+
gr_slatAttTo,
7070
/// This slot attaches to its parent at the given design units in the x direction
71-
gr_slatAttX,
71+
gr_slatAttX,
7272
/// This slot attaches to its parent at the given design units in the y direction
73-
gr_slatAttY,
73+
gr_slatAttY,
7474
/// This slot attaches to its parent at the given glyph point (not implemented)
75-
gr_slatAttGpt,
75+
gr_slatAttGpt,
7676
/// x-direction adjustment from the given glyph point (not implemented)
77-
gr_slatAttXOff,
77+
gr_slatAttXOff,
7878
/// y-direction adjustment from the given glyph point (not implemented)
79-
gr_slatAttYOff,
79+
gr_slatAttYOff,
8080
/// Where on this glyph should align with the attachment point on the parent glyph in the x-direction.
81-
gr_slatAttWithX,
81+
gr_slatAttWithX,
8282
/// Where on this glyph should align with the attachment point on the parent glyph in the y-direction
83-
gr_slatAttWithY,
83+
gr_slatAttWithY,
8484
/// Which glyph point on this glyph should align with the attachment point on the parent glyph (not implemented).
85-
gr_slatWithGpt,
85+
gr_slatWithGpt,
8686
/// Adjustment to gr_slatWithGpt in x-direction (not implemented)
87-
gr_slatAttWithXOff,
87+
gr_slatAttWithXOff,
8888
/// Adjustment to gr_slatWithGpt in y-direction (not implemented)
89-
gr_slatAttWithYOff,
89+
gr_slatAttWithYOff,
9090
/// Attach at given nesting level (not implemented)
91-
gr_slatAttLevel,
91+
gr_slatAttLevel,
9292
/// Line break breakweight for this glyph
93-
gr_slatBreak,
93+
gr_slatBreak,
9494
/// Ligature component reference (not implemented)
95-
gr_slatCompRef,
95+
gr_slatCompRef,
9696
/// bidi directionality of this glyph (not implemented)
97-
gr_slatDir,
97+
gr_slatDir,
9898
/// Whether insertion is allowed before this glyph
9999
gr_slatInsert,
100100
/// Final positioned position of this glyph relative to its parent in x-direction in pixels
101-
gr_slatPosX,
101+
gr_slatPosX,
102102
/// Final positioned position of this glyph relative to its parent in y-direction in pixels
103-
gr_slatPosY,
103+
gr_slatPosY,
104104
/// Amount to shift glyph by in x-direction design units
105-
gr_slatShiftX,
105+
gr_slatShiftX,
106106
/// Amount to shift glyph by in y-direction design units
107-
gr_slatShiftY,
107+
gr_slatShiftY,
108108
/// attribute user1
109-
gr_slatUserDefnV1,
109+
gr_slatUserDefnV1,
110110
/// not implemented
111-
gr_slatMeasureSol,
111+
gr_slatMeasureSol,
112112
/// not implemented
113-
gr_slatMeasureEol,
113+
gr_slatMeasureEol,
114114
/// Amount this slot can stretch (not implemented)
115-
gr_slatJStretch,
115+
gr_slatJStretch,
116116
/// Amount this slot can shrink (not implemented)
117-
gr_slatJShrink,
117+
gr_slatJShrink,
118118
/// Granularity by which this slot can stretch or shrink (not implemented)
119-
gr_slatJStep,
119+
gr_slatJStep,
120120
/// Justification weight for this glyph (not implemented)
121-
gr_slatJWeight,
121+
gr_slatJWeight,
122122
/// Amount this slot mush shrink or stretch in design units
123123
gr_slatJWidth = 29,
124124
/// SubSegment split point
@@ -159,11 +159,11 @@ enum gr_attrCode {
159159
gr_slatSeqBelowWt,
160160
gr_slatSeqValignHt,
161161
gr_slatSeqValignWt,
162-
162+
163163
/// not implemented
164-
gr_slatMax,
164+
gr_slatMax,
165165
/// not implemented
166-
gr_slatNoEffect = gr_slatMax + 1
166+
gr_slatNoEffect = gr_slatMax + 1
167167
};
168168

169169
enum gr_bidirtl {
@@ -182,13 +182,13 @@ typedef struct gr_segment gr_segment;
182182
typedef struct gr_slot gr_slot;
183183

184184
/** Returns Unicode character for a charinfo.
185-
*
185+
*
186186
* @param p Pointer to charinfo to return information on.
187187
*/
188188
GR2_API unsigned int gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/);
189189

190190
/** Returns breakweight for a charinfo.
191-
*
191+
*
192192
* @return Breakweight is a number between -50 and 50 indicating the cost of a
193193
* break before or after this character. If the value < 0, the absolute value
194194
* is this character's contribution to the overall breakweight before it. If the value

Lib/src/graphite2/include/graphite2/Types.h

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,40 @@ enum gr_encform {
4040
gr_utf8 = 1/*sizeof(uint8)*/, gr_utf16 = 2/*sizeof(uint16)*/, gr_utf32 = 4/*sizeof(uint32)*/
4141
};
4242

43-
// Definitions for library publicly exported symbols
43+
44+
// Define API function declspec/attributes and how each supported compiler or OS
45+
// allows us to specify them.
46+
#if defined __GNUC__
47+
#define _gr2_and ,
48+
#define _gr2_tag_fn(a) __attribute__((a))
49+
#define _gr2_deprecated_flag deprecated
50+
#define _gr2_export_flag visibility("default")
51+
#define _gr2_import_flag visibility("default")
52+
#define _gr2_static_flag visibility("hidden")
53+
#endif
54+
4455
#if defined _WIN32 || defined __CYGWIN__
45-
#if defined GRAPHITE2_STATIC
46-
#define GR2_API
47-
#elif defined GRAPHITE2_EXPORTING
48-
#if defined __GNUC__
49-
#define GR2_API __attribute__((dllexport))
50-
#else
51-
#define GR2_API __declspec(dllexport)
52-
#endif
53-
#else
54-
#if defined __GNUC__
55-
#define GR2_API __attribute__((dllimport))
56-
#else
57-
#define GR2_API __declspec(dllimport)
58-
#endif
59-
#endif
60-
#define GR2_LOCAL
61-
#elif __GNUC__ >= 4
62-
#if defined GRAPHITE2_STATIC
63-
#define GR2_API __attribute__ ((visibility("hidden")))
64-
#else
65-
#define GR2_API __attribute__ ((visibility("default")))
56+
#if defined __GNUC__ // These three will be redefined for Windows
57+
#undef _gr2_export_flag
58+
#undef _gr2_import_flag
59+
#undef _gr2_static_flag
60+
#else // How MSVC sepcifies function level attributes adn deprecation
61+
#define _gr2_and
62+
#define _gr2_tag_fn(a) __declspec(a)
63+
#define _gr2_deprecated_flag deprecated
6664
#endif
67-
#define GR2_LOCAL __attribute__ ((visibility("hidden")))
68-
#else
69-
#define GR2_API
70-
#define GR2_LOCAL
65+
#define _gr2_export_flag dllexport
66+
#define _gr2_import_flag dllimport
67+
#define _gr2_static_flag
7168
#endif
7269

70+
#if defined GRAPHITE2_STATIC
71+
#define GR2_API _gr2_tag_fn(_gr2_static_flag)
72+
#define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_static_flag)
73+
#elif defined GRAPHITE2_EXPORTING
74+
#define GR2_API _gr2_tag_fn(_gr2_export_flag)
75+
#define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_export_flag)
76+
#else
77+
#define GR2_API _gr2_tag_fn(_gr2_import_flag)
78+
#define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_import_flag)
79+
#endif

0 commit comments

Comments
 (0)