harfbuzzjs 0.1.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build.yml +45 -0
- package/.gitmodules +3 -0
- package/LICENSE +0 -1
- package/README.md +2 -8
- package/build-subset.sh +22 -0
- package/build.sh +17 -55
- package/{subset/config-override.h → config-override-subset.h} +0 -0
- package/config-override.h +3 -3
- package/examples/Mada.abjad.otf +0 -0
- package/{subset/roboto-black.ttf → examples/Roboto-Black.ttf} +0 -0
- package/{subset/test.js → examples/hb-subset.example.node.js} +6 -5
- package/examples/hbjs.example.html +0 -1
- package/examples/hbjs.example.js +3 -2
- package/examples/hbjs.example.node.js +2 -0
- package/examples/nohbjs.html +0 -1
- package/harfbuzz.ts +0 -1
- package/hb-subset.symbols +28 -0
- package/hb-subset.wasm +0 -0
- package/hb.wasm +0 -0
- package/hbjs.cc +256 -0
- package/hbjs.js +41 -6
- package/hbjs.symbols +36 -0
- package/index.js +0 -1
- package/package.json +1 -1
- package/hbjs.c +0 -284
- package/libc/ctype.h +0 -73
- package/libc/emmalloc.cpp +0 -1202
- package/libc/fprintf.c +0 -65
- package/libc/include/assert.h +0 -14
- package/libc/include/cassert +0 -1
- package/libc/include/cfloat +0 -1
- package/libc/include/climits +0 -1
- package/libc/include/cmath +0 -1
- package/libc/include/cstdarg +0 -1
- package/libc/include/cstddef +0 -1
- package/libc/include/cstdio +0 -1
- package/libc/include/cstdlib +0 -1
- package/libc/include/cstring +0 -1
- package/libc/include/emscripten.h +0 -0
- package/libc/include/float.h +0 -6
- package/libc/include/limits.h +0 -2
- package/libc/include/locale.h +0 -0
- package/libc/include/malloc.h +0 -13
- package/libc/include/math.h +0 -0
- package/libc/include/raqm-version.h +0 -5
- package/libc/include/stdarg.h +0 -0
- package/libc/include/stdbool.h +0 -12
- package/libc/include/stddef.h +0 -0
- package/libc/include/stdint.h +0 -1
- package/libc/include/stdio.h +0 -0
- package/libc/include/stdlib.h +0 -110
- package/libc/include/string.h +0 -26
- package/libc/include/sys/types.h +0 -1
- package/libc/include/unistd.h +0 -14
- package/libc/main.c +0 -7
- package/libc/malloc.cc +0 -29
- package/libc/prf.c +0 -667
- package/libc/sprintf.c +0 -112
- package/libc/strtol.c +0 -79
- package/libc/zephyr-string.c +0 -381
- package/subset/build.sh +0 -48
- package/subset/hb-subset.wasm +0 -0
- package/subset/test.cc +0 -50
package/libc/fprintf.c
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* fprintf.c */
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 1997-2010, 2013-2014 Wind River Systems, Inc.
|
|
5
|
-
*
|
|
6
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#include <stdarg.h>
|
|
10
|
-
#include <stdio.h>
|
|
11
|
-
#define va_list __builtin_va_list
|
|
12
|
-
#define va_start __builtin_va_start
|
|
13
|
-
#define va_end __builtin_va_end
|
|
14
|
-
#define va_arg __builtin_va_arg
|
|
15
|
-
typedef __SIZE_TYPE__ size_t;
|
|
16
|
-
#define stderr 0
|
|
17
|
-
#define _MLIBC_RESTRICT
|
|
18
|
-
|
|
19
|
-
#define DESC(d) ((void *)d)
|
|
20
|
-
|
|
21
|
-
extern int _prf(int (*func)(), void *dest,
|
|
22
|
-
const char *format, va_list vargs);
|
|
23
|
-
|
|
24
|
-
int fprintf(FILE *_MLIBC_RESTRICT F, const char *_MLIBC_RESTRICT format, ...)
|
|
25
|
-
{
|
|
26
|
-
va_list vargs;
|
|
27
|
-
int r;
|
|
28
|
-
|
|
29
|
-
va_start(vargs, format);
|
|
30
|
-
r = _prf(fputc, DESC(F), format, vargs);
|
|
31
|
-
va_end(vargs);
|
|
32
|
-
|
|
33
|
-
return r;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
int vfprintf(FILE *_MLIBC_RESTRICT F, const char *_MLIBC_RESTRICT format,
|
|
37
|
-
va_list vargs)
|
|
38
|
-
{
|
|
39
|
-
int r;
|
|
40
|
-
|
|
41
|
-
r = _prf(fputc, DESC(F), format, vargs);
|
|
42
|
-
|
|
43
|
-
return r;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
int printf(const char *_MLIBC_RESTRICT format, ...)
|
|
47
|
-
{
|
|
48
|
-
va_list vargs;
|
|
49
|
-
int r;
|
|
50
|
-
|
|
51
|
-
va_start(vargs, format);
|
|
52
|
-
r = _prf(fputc, DESC(stdout), format, vargs);
|
|
53
|
-
va_end(vargs);
|
|
54
|
-
|
|
55
|
-
return r;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
int vprintf(const char *_MLIBC_RESTRICT format, va_list vargs)
|
|
59
|
-
{
|
|
60
|
-
int r;
|
|
61
|
-
|
|
62
|
-
r = _prf(fputc, DESC(stdout), format, vargs);
|
|
63
|
-
|
|
64
|
-
return r;
|
|
65
|
-
}
|
package/libc/include/assert.h
DELETED
package/libc/include/cassert
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <assert.h>
|
package/libc/include/cfloat
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <float.h>
|
package/libc/include/climits
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <limits.h>
|
package/libc/include/cmath
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <math.h>
|
package/libc/include/cstdarg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <stdarg.h>
|
package/libc/include/cstddef
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <stddef.h>
|
package/libc/include/cstdio
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <stdio.h>
|
package/libc/include/cstdlib
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <stdlib.h>
|
package/libc/include/cstring
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <string.h>
|
|
File without changes
|
package/libc/include/float.h
DELETED
package/libc/include/limits.h
DELETED
package/libc/include/locale.h
DELETED
|
File without changes
|
package/libc/include/malloc.h
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
struct mallinfo
|
|
2
|
-
{
|
|
3
|
-
int arena; /* non-mmapped space allocated from system */
|
|
4
|
-
int ordblks; /* number of free chunks */
|
|
5
|
-
int smblks; /* number of fastbin blocks */
|
|
6
|
-
int hblks; /* number of mmapped regions */
|
|
7
|
-
int hblkhd; /* space in mmapped regions */
|
|
8
|
-
int usmblks; /* always 0, preserved for backwards compatibility */
|
|
9
|
-
int fsmblks; /* space available in freed fastbin blocks */
|
|
10
|
-
int uordblks; /* total allocated space */
|
|
11
|
-
int fordblks; /* total free space */
|
|
12
|
-
int keepcost; /* top-most, releasable (via malloc_trim) space */
|
|
13
|
-
};
|
package/libc/include/math.h
DELETED
|
File without changes
|
package/libc/include/stdarg.h
DELETED
|
File without changes
|
package/libc/include/stdbool.h
DELETED
package/libc/include/stddef.h
DELETED
|
File without changes
|
package/libc/include/stdint.h
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#include <stdlib.h>
|
package/libc/include/stdio.h
DELETED
|
File without changes
|
package/libc/include/stdlib.h
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#ifndef STDLIB_H
|
|
2
|
-
#define STDLIB_H
|
|
3
|
-
|
|
4
|
-
#include <stdio.h>
|
|
5
|
-
|
|
6
|
-
#ifdef __cplusplus
|
|
7
|
-
extern "C" {
|
|
8
|
-
#endif
|
|
9
|
-
|
|
10
|
-
#define NULL ((void*) 0)
|
|
11
|
-
|
|
12
|
-
typedef __SIZE_TYPE__ size_t;
|
|
13
|
-
typedef __UINT8_TYPE__ uint8_t;
|
|
14
|
-
typedef __UINT16_TYPE__ uint16_t;
|
|
15
|
-
typedef __UINT32_TYPE__ uint32_t;
|
|
16
|
-
typedef __UINT64_TYPE__ uint64_t;
|
|
17
|
-
typedef __INT8_TYPE__ int8_t;
|
|
18
|
-
typedef __INT16_TYPE__ int16_t;
|
|
19
|
-
typedef __INT32_TYPE__ int32_t;
|
|
20
|
-
typedef __INT64_TYPE__ int64_t;
|
|
21
|
-
typedef __INTPTR_TYPE__ intptr_t;
|
|
22
|
-
typedef __UINTPTR_TYPE__ uintptr_t;
|
|
23
|
-
|
|
24
|
-
typedef struct FILE FILE;
|
|
25
|
-
#define EOF -1
|
|
26
|
-
#ifndef stdin
|
|
27
|
-
#define stdin (FILE *) 0
|
|
28
|
-
#endif
|
|
29
|
-
#ifndef stdout
|
|
30
|
-
#define stdout (FILE *) 1
|
|
31
|
-
#endif
|
|
32
|
-
#ifndef stderr
|
|
33
|
-
#define stderr (FILE *) 2
|
|
34
|
-
#endif
|
|
35
|
-
|
|
36
|
-
void* malloc(size_t n);
|
|
37
|
-
void free(void* ptr);
|
|
38
|
-
void* calloc(size_t n, size_t size);
|
|
39
|
-
void* realloc(void* ptr, size_t size);
|
|
40
|
-
#define va_list __builtin_va_list
|
|
41
|
-
#define va_start __builtin_va_start
|
|
42
|
-
#define va_end __builtin_va_end
|
|
43
|
-
#define va_arg __builtin_va_arg
|
|
44
|
-
inline char *getenv(const char *name);
|
|
45
|
-
inline char *getenv(const char *name) { return 0; }
|
|
46
|
-
inline int sscanf(const char *str, const char *format, ...);
|
|
47
|
-
inline int sscanf(const char *str, const char *format, ...) { return 0; }
|
|
48
|
-
inline int fprintf(FILE *stream, const char *format, ...);
|
|
49
|
-
inline int fprintf(FILE *stream, const char *format, ...) { return 0; }
|
|
50
|
-
inline int sprintf(char *str, const char *format, ...);
|
|
51
|
-
#ifdef NO_SPRINTF
|
|
52
|
-
inline int sprintf(char *str, const char *format, ...) { return 0; }
|
|
53
|
-
#endif
|
|
54
|
-
inline int snprintf(char *str, size_t n, const char *format, ...);
|
|
55
|
-
inline int vsnprintf(char *str, size_t n, const char * format, va_list va);
|
|
56
|
-
#define vfprintf(format, ...)
|
|
57
|
-
#define offsetof __builtin_offsetof
|
|
58
|
-
|
|
59
|
-
#define ceilf __builtin_ceilf
|
|
60
|
-
#define floorf __builtin_floorf
|
|
61
|
-
#define abs __builtin_abs
|
|
62
|
-
#define fabs __builtin_fabs
|
|
63
|
-
#define pow __builtin_pow
|
|
64
|
-
#define sqrt __builtin_sqrt
|
|
65
|
-
|
|
66
|
-
#define uint_least8_t uint8_t
|
|
67
|
-
#define uint_least16_t uint16_t
|
|
68
|
-
#define uint_fast8_t uint8_t
|
|
69
|
-
#define uint_fast16_t uint16_t
|
|
70
|
-
#define int_fast16_t int16_t
|
|
71
|
-
|
|
72
|
-
#define DBL_MIN __DBL_MIN__
|
|
73
|
-
#define DBL_MAX __DBL_MAX__
|
|
74
|
-
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
|
75
|
-
unsigned long strtoul(const char *nptr, char **endptr, int base);
|
|
76
|
-
long strtol(const char *nptr, char **endptr, int base);
|
|
77
|
-
double strtod(const char *nptr, char **endptr);
|
|
78
|
-
|
|
79
|
-
#define LLONG_MAX __LONG_LONG_MAX__
|
|
80
|
-
#define LLONG_MIN (-__LONG_LONG_MAX__-1LL)
|
|
81
|
-
#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
|
|
82
|
-
|
|
83
|
-
#define SCHAR_MAX __SCHAR_MAX__
|
|
84
|
-
#define SHRT_MAX __SHRT_MAX__
|
|
85
|
-
#define INT_MAX __INT_MAX__
|
|
86
|
-
#define LONG_MAX __LONG_MAX__
|
|
87
|
-
|
|
88
|
-
#define SCHAR_MIN (-__SCHAR_MAX__-1)
|
|
89
|
-
#define SHRT_MIN (-__SHRT_MAX__ -1)
|
|
90
|
-
#define INT_MIN (-__INT_MAX__ -1)
|
|
91
|
-
#define LONG_MIN (-__LONG_MAX__ -1L)
|
|
92
|
-
|
|
93
|
-
#define UCHAR_MAX (__SCHAR_MAX__*2 +1)
|
|
94
|
-
#define USHRT_MAX (__SHRT_MAX__ *2 +1)
|
|
95
|
-
#define UINT_MAX (__INT_MAX__ *2U +1U)
|
|
96
|
-
#define ULONG_MAX (__LONG_MAX__ *2UL+1UL)
|
|
97
|
-
|
|
98
|
-
#ifdef __CHAR_UNSIGNED__ /* -funsigned-char */
|
|
99
|
-
#define CHAR_MIN 0
|
|
100
|
-
#define CHAR_MAX UCHAR_MAX
|
|
101
|
-
#else
|
|
102
|
-
#define CHAR_MIN SCHAR_MIN
|
|
103
|
-
#define CHAR_MAX __SCHAR_MAX__
|
|
104
|
-
#endif
|
|
105
|
-
|
|
106
|
-
#ifdef __cplusplus
|
|
107
|
-
}
|
|
108
|
-
#endif
|
|
109
|
-
|
|
110
|
-
#endif /* STDLIB_H */
|
package/libc/include/string.h
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#ifndef STRING_H
|
|
2
|
-
#define STRING_H
|
|
3
|
-
|
|
4
|
-
#ifdef __cplusplus
|
|
5
|
-
extern "C" {
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
typedef __SIZE_TYPE__ size_t;
|
|
9
|
-
|
|
10
|
-
size_t strlen(const char *s);
|
|
11
|
-
void *memset(void *buf, int c, size_t n);
|
|
12
|
-
void *memcpy(void *__restrict d, const void *__restrict s, size_t n);
|
|
13
|
-
void *memmove(void *d, const void *s, size_t n);
|
|
14
|
-
int strncmp(const char *s1, const char *s2, size_t n);
|
|
15
|
-
int strcmp(const char *s1, const char *s2);
|
|
16
|
-
int memcmp(const void *m1, const void *m2, size_t n);
|
|
17
|
-
char *strchr(const char *s, int c);
|
|
18
|
-
char *strncpy(char *__restrict d, const char *__restrict s, size_t n);
|
|
19
|
-
char *strstr(const char *s, const char *find);
|
|
20
|
-
char *strcpy(char * d, const char * s);
|
|
21
|
-
|
|
22
|
-
#ifdef __cplusplus
|
|
23
|
-
}
|
|
24
|
-
#endif
|
|
25
|
-
|
|
26
|
-
#endif /* STRING_H */
|
package/libc/include/sys/types.h
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
typedef __SIZE_TYPE__ size_t;
|
package/libc/include/unistd.h
DELETED
package/libc/main.c
DELETED
package/libc/malloc.cc
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#include <unistd.h>
|
|
2
|
-
|
|
3
|
-
/* https://dassur.ma/things/c-to-webassembly/ */
|
|
4
|
-
extern unsigned char __heap_base;
|
|
5
|
-
typedef __UINTPTR_TYPE__ uintptr_t;
|
|
6
|
-
uintptr_t bump_pointer = (uintptr_t) &__heap_base;
|
|
7
|
-
|
|
8
|
-
extern "C" void *sbrk(unsigned int inc) {
|
|
9
|
-
uintptr_t addr = bump_pointer;
|
|
10
|
-
bump_pointer += inc;
|
|
11
|
-
return (void *) addr;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
#ifdef USE_ZERO_FREE_ALLOC
|
|
15
|
-
typedef __SIZE_TYPE__ size_t;
|
|
16
|
-
extern "C" void *malloc(size_t size) { return sbrk(((size - 1) | 3) + 1); }
|
|
17
|
-
extern "C" void *calloc(size_t nmemb, size_t size) { return malloc(nmemb * size); }
|
|
18
|
-
extern "C" void *realloc(void* ptr, size_t size) {
|
|
19
|
-
void *addr = malloc(size);
|
|
20
|
-
__builtin_memcpy(addr, ptr, size); // roughly
|
|
21
|
-
return addr;
|
|
22
|
-
}
|
|
23
|
-
extern "C" void free(void* ptr) { /* lol */ }
|
|
24
|
-
#else
|
|
25
|
-
#include "emmalloc.cpp"
|
|
26
|
-
#endif
|
|
27
|
-
|
|
28
|
-
// Hack to use it in hb_blob_create callback
|
|
29
|
-
extern "C" void *free_ptr() { return (void *) free; }
|