Anurag Thakur pushed to branch gsoc-anurag-2022-final at FreeType / FreeType
Commits:
-
b37b8d2a
by Loïc Yhuel at 2022-11-14T14:43:04+01:00
[meson] Fix generated ftmodule.h
The sdf module wasn't recognized, so the generated ftmodule.h had "None_renderer_class".
* builds/meson/parse_modules_cfg.py: Handle sdf in RASTER_MODULES.
-
63ccaef0
by Loïc Yhuel at 2022-11-14T14:43:04+01:00
[meson] Use generated ftmodule.h
ftmodule.h is generated at the root of the build directory, but FT_CONFIG_MODULES_H
(freetype/config/ftmodule.h) is used instead.
This makes the build fail when disabling modules in modules.cfg.
* meson.build (harfbuzz_dep): Add '-DFT_CONFIG_MODULES_H=<ftmodule.h>'.
-
e6fda039
by Werner Lemberg at 2022-11-14T19:18:19+01:00
* src/truetype/ttgxvar.c (tt_hvadvance_adjust): Integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50462
-
47e61d02
by Alexei Podtelezhnikov at 2022-11-14T22:53:14-05:00
* src/pcf/pcfutil.c ({Two,Four}ByteSwap): Use builtins or shifts.
We trust glibc which uses shifts or builtins to swap bytes. This
must be more efficient.
-
0f43a0e7
by Johan Matsson at 2022-11-16T07:54:39+01:00
* src/autofit/afloader.c (af_loader_load_glyph): Fix dereference.
This must happen after the NULL check.
Taken from
https://github.com/freetype/freetype/pull/2
-
10f72058
by Anurag Thakur at 2022-11-18T13:18:54+05:30
[dense] Add files for new 'dense' module
Breakdown of what the files will contain
* src/dense/ftdenserend.c, src/dense/ftdenserend.h: The 'dense' renderer.
* src/dense/ftdense.c, src/dense/ftdense.h: The rasterizer for the
'dense' renderer.
* src/dense/ftdenseerrs.h: Common error defines.
* src/dense/dense.c: For building a single object of the entire module.
11 changed files:
Changes:
builds/meson/parse_modules_cfg.py
... |
... |
@@ -84,14 +84,16 @@ def generate_ftmodule(lists): |
84
|
84
|
)
|
85
|
85
|
|
86
|
86
|
for module in lists["RASTER_MODULES"]:
|
87
|
|
- name = {
|
88
|
|
- "raster": "ft_raster1",
|
89
|
|
- "smooth": "ft_smooth",
|
90
|
|
- "svg": "ft_svg",
|
|
87
|
+ names = {
|
|
88
|
+ "raster": ("ft_raster1",),
|
|
89
|
+ "smooth": ("ft_smooth",),
|
|
90
|
+ "svg": ("ft_svg",),
|
|
91
|
+ "sdf": ("ft_sdf", "ft_bitmap_sdf"),
|
91
|
92
|
}.get(module)
|
92
|
|
- result += (
|
93
|
|
- "FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name
|
94
|
|
- )
|
|
93
|
+ for name in names:
|
|
94
|
+ result += (
|
|
95
|
+ "FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name
|
|
96
|
+ )
|
95
|
97
|
|
96
|
98
|
for module in lists["AUX_MODULES"]:
|
97
|
99
|
if module in ("psaux", "psnames", "otvalid", "gxvalid"):
|
meson.build
... |
... |
@@ -52,6 +52,8 @@ ft2_includes = include_directories('include') |
52
|
52
|
|
53
|
53
|
freetype_includedir = join_paths(get_option('includedir'), 'freetype2')
|
54
|
54
|
|
|
55
|
+ft2_defines = []
|
|
56
|
+
|
55
|
57
|
# Generate a custom `ftmodule.h` version based on the content of
|
56
|
58
|
# `modules.cfg`.
|
57
|
59
|
|
... |
... |
@@ -64,6 +66,7 @@ ftmodule_h = custom_target('ftmodule.h', |
64
|
66
|
install_dir: join_paths(freetype_includedir, 'freetype/config'),
|
65
|
67
|
)
|
66
|
68
|
ft2_sources = [ftmodule_h]
|
|
69
|
+ft2_defines += ['-DFT_CONFIG_MODULES_H=<ftmodule.h>']
|
67
|
70
|
|
68
|
71
|
|
69
|
72
|
# FreeType 2 modules.
|
... |
... |
@@ -187,7 +190,7 @@ ft2_config_headers = files([ |
187
|
190
|
'include/freetype/config/public-macros.h',
|
188
|
191
|
])
|
189
|
192
|
|
190
|
|
-ft2_defines = ['-DFT2_BUILD_LIBRARY=1']
|
|
193
|
+ft2_defines += ['-DFT2_BUILD_LIBRARY=1']
|
191
|
194
|
|
192
|
195
|
|
193
|
196
|
# System support file.
|
src/autofit/afloader.c
... |
... |
@@ -216,7 +216,7 @@ |
216
|
216
|
FT_Error error;
|
217
|
217
|
|
218
|
218
|
FT_Size size = face->size;
|
219
|
|
- FT_Size_Internal size_internal = size->internal;
|
|
219
|
+ FT_Size_Internal size_internal = NULL;
|
220
|
220
|
FT_GlyphSlot slot = face->glyph;
|
221
|
221
|
FT_Slot_Internal slot_internal = slot->internal;
|
222
|
222
|
FT_GlyphLoader gloader = slot_internal->loader;
|
... |
... |
@@ -232,6 +232,8 @@ |
232
|
232
|
if ( !size )
|
233
|
233
|
return FT_THROW( Invalid_Size_Handle );
|
234
|
234
|
|
|
235
|
+ size_internal = size->internal;
|
|
236
|
+
|
235
|
237
|
FT_ZERO( &scaler );
|
236
|
238
|
|
237
|
239
|
if ( !size_internal->autohint_metrics.x_scale ||
|
src/dense/dense.c
|
1
|
+/** For building a single object of the entire module */
|
|
2
|
+
|
|
3
|
+/* END */ |
|
|
\ No newline at end of file |
src/dense/ftdense.c
|
1
|
+/** The rasterizer for the 'dense' renderer */
|
|
2
|
+
|
|
3
|
+/* END */ |
|
|
\ No newline at end of file |
src/dense/ftdense.h
|
1
|
+
|
|
2
|
+#ifndef FTDENSE_H_
|
|
3
|
+#define FTDENSE_H_
|
|
4
|
+
|
|
5
|
+#endif /* FTDENSE_H_ */
|
|
6
|
+
|
|
7
|
+/* END */ |
src/dense/ftdenseerrs.h
|
1
|
+/** Common error defines */
|
|
2
|
+
|
|
3
|
+#ifndef FTDENSEERRS_H_
|
|
4
|
+#define FTDENSEERRS_H_
|
|
5
|
+
|
|
6
|
+#endif /* FTDENSEERRS_H_ */
|
|
7
|
+
|
|
8
|
+/* END */ |
src/dense/ftdenserend.c
|
1
|
+/** The 'dense' renderer */
|
|
2
|
+
|
|
3
|
+/* END */ |
|
|
\ No newline at end of file |
src/dense/ftdenserend.h
|
1
|
+
|
|
2
|
+#ifndef FTDENSEREND_H_
|
|
3
|
+#define FTDENSEREND_H_
|
|
4
|
+
|
|
5
|
+#endif /* FTDENSEREND_H_ */
|
|
6
|
+
|
|
7
|
+/* END */ |
src/pcf/pcfutil.c
... |
... |
@@ -57,6 +57,33 @@ in this Software without prior written authorization from The Open Group. |
57
|
57
|
}
|
58
|
58
|
|
59
|
59
|
|
|
60
|
+#if defined( __clang__ ) || ( defined( __GNUC__ ) && \
|
|
61
|
+ ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 8 ) ) )
|
|
62
|
+
|
|
63
|
+#define BSWAP16( x ) __builtin_bswap16( x )
|
|
64
|
+#define BSWAP32( x ) __builtin_bswap32( x )
|
|
65
|
+
|
|
66
|
+#elif defined( _MSC_VER ) && _MSC_VER >= 1300
|
|
67
|
+
|
|
68
|
+#pragma intrinsic( _byteswap_ushort )
|
|
69
|
+#pragma intrinsic( _byteswap_ulong )
|
|
70
|
+
|
|
71
|
+#define BSWAP16( x ) _byteswap_ushort( x )
|
|
72
|
+#define BSWAP32( x ) _byteswap_ulong( x )
|
|
73
|
+
|
|
74
|
+#else
|
|
75
|
+
|
|
76
|
+#define BSWAP16( x ) \
|
|
77
|
+ (FT_UInt16)( ( ( ( x ) >> 8 ) & 0xff ) | \
|
|
78
|
+ ( ( ( x ) & 0xff ) << 8 ) )
|
|
79
|
+#define BSWAP32( x ) \
|
|
80
|
+ (FT_UInt32)( ( ( ( x ) & 0xff000000u ) >> 24 ) | \
|
|
81
|
+ ( ( ( x ) & 0x00ff0000u ) >> 8 ) | \
|
|
82
|
+ ( ( ( x ) & 0x0000ff00u ) << 8 ) | \
|
|
83
|
+ ( ( ( x ) & 0x000000ffu ) << 24 ) )
|
|
84
|
+
|
|
85
|
+#endif
|
|
86
|
+
|
60
|
87
|
/*
|
61
|
88
|
* Invert byte order within each 16-bits of an array.
|
62
|
89
|
*/
|
... |
... |
@@ -65,15 +92,11 @@ in this Software without prior written authorization from The Open Group. |
65
|
92
|
TwoByteSwap( unsigned char* buf,
|
66
|
93
|
size_t nbytes )
|
67
|
94
|
{
|
68
|
|
- for ( ; nbytes >= 2; nbytes -= 2, buf += 2 )
|
69
|
|
- {
|
70
|
|
- unsigned char c;
|
|
95
|
+ FT_UInt16* b = (FT_UInt16*)buf;
|
71
|
96
|
|
72
|
97
|
|
73
|
|
- c = buf[0];
|
74
|
|
- buf[0] = buf[1];
|
75
|
|
- buf[1] = c;
|
76
|
|
- }
|
|
98
|
+ for ( ; nbytes >= 2; nbytes -= 2, b++ )
|
|
99
|
+ *b = BSWAP16( *b );
|
77
|
100
|
}
|
78
|
101
|
|
79
|
102
|
/*
|
... |
... |
@@ -84,19 +107,11 @@ in this Software without prior written authorization from The Open Group. |
84
|
107
|
FourByteSwap( unsigned char* buf,
|
85
|
108
|
size_t nbytes )
|
86
|
109
|
{
|
87
|
|
- for ( ; nbytes >= 4; nbytes -= 4, buf += 4 )
|
88
|
|
- {
|
89
|
|
- unsigned char c;
|
90
|
|
-
|
|
110
|
+ FT_UInt32* b = (FT_UInt32*)buf;
|
91
|
111
|
|
92
|
|
- c = buf[0];
|
93
|
|
- buf[0] = buf[3];
|
94
|
|
- buf[3] = c;
|
95
|
112
|
|
96
|
|
- c = buf[1];
|
97
|
|
- buf[1] = buf[2];
|
98
|
|
- buf[2] = c;
|
99
|
|
- }
|
|
113
|
+ for ( ; nbytes >= 4; nbytes -= 4, b++ )
|
|
114
|
+ *b = BSWAP32( *b );
|
100
|
115
|
}
|
101
|
116
|
|
102
|
117
|
|
src/truetype/ttgxvar.c
... |
... |
@@ -42,6 +42,7 @@ |
42
|
42
|
#include <ft2build.h>
|
43
|
43
|
#include <freetype/internal/ftdebug.h>
|
44
|
44
|
#include FT_CONFIG_CONFIG_H
|
|
45
|
+#include <freetype/internal/ftcalc.h>
|
45
|
46
|
#include <freetype/internal/ftstream.h>
|
46
|
47
|
#include <freetype/internal/sfnt.h>
|
47
|
48
|
#include <freetype/tttags.h>
|
... |
... |
@@ -1207,7 +1208,7 @@ |
1207
|
1208
|
delta == 1 ? "" : "s",
|
1208
|
1209
|
vertical ? "VVAR" : "HVAR" ));
|
1209
|
1210
|
|
1210
|
|
- *avalue += delta;
|
|
1211
|
+ *avalue = ADD_INT( *avalue, delta );
|
1211
|
1212
|
}
|
1212
|
1213
|
|
1213
|
1214
|
Exit:
|
|