Merge pull request #754 from googlefonts/master
Fix build for subsetting code.
This commit is contained in:
commit
fc1e82a5ae
|
@ -14,7 +14,7 @@ EXTRA_DIST += CMakeLists.txt
|
||||||
|
|
||||||
if HAVE_GLIB
|
if HAVE_GLIB
|
||||||
AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS)
|
AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS)
|
||||||
LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS)
|
LDADD = $(top_builddir)/src/libharfbuzz.la $(top_builddir)/src/libharfbuzz-subset.la $(GLIB_LIBS)
|
||||||
|
|
||||||
EXTRA_DIST += hb-test.h
|
EXTRA_DIST += hb-test.h
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,7 @@ endif # HAVE_FREETYPE
|
||||||
hb_shape_SOURCES = $(HB_SHAPE_sources)
|
hb_shape_SOURCES = $(HB_SHAPE_sources)
|
||||||
bin_PROGRAMS += hb-shape
|
bin_PROGRAMS += hb-shape
|
||||||
|
|
||||||
hb_subset_SOURCES = $(HB_SUBSET_sources)
|
hb_subset_SOURCES = $(HB_SUBSET_CLI_sources)
|
||||||
hb_subset_SOURCES = $(HB_SUBSET_sources)
|
|
||||||
hb_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
|
hb_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
|
||||||
bin_PROGRAMS += hb-subset
|
bin_PROGRAMS += hb-subset
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ HB_OT_SHAPE_CLOSURE_sources = \
|
||||||
main-font-text.hh \
|
main-font-text.hh \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
HB_SUBSET_sources = \
|
HB_SUBSET_CLI_sources = \
|
||||||
hb-subset.cc \
|
hb-subset.cc \
|
||||||
options.cc \
|
options.cc \
|
||||||
options.hh \
|
options.hh \
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* Google Author(s): Garret Rieger, Rod Sheeter
|
* Google Author(s): Garret Rieger, Rod Sheeter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "main-font-text.hh"
|
#include "main-font-text.hh"
|
||||||
#include "hb-subset.h"
|
#include "hb-subset.h"
|
||||||
|
@ -57,12 +57,13 @@ struct subset_consumer_t
|
||||||
unsigned int data_length;
|
unsigned int data_length;
|
||||||
const char* data = hb_blob_get_data (blob, &data_length);
|
const char* data = hb_blob_get_data (blob, &data_length);
|
||||||
|
|
||||||
int fd_out = open(output_file, O_CREAT | O_WRONLY, S_IRWXU);
|
FILE *fp_out = fopen(output_file, "w");
|
||||||
if (fd_out == -1) {
|
if (fp_out == nullptr) {
|
||||||
fprintf(stderr, "Unable to open output file");
|
fprintf(stderr, "Unable to open output file\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ssize_t bytes_written = write(fd_out, data, data_length);
|
size_t bytes_written = fwrite(data, 1, data_length, fp_out);
|
||||||
|
|
||||||
if (bytes_written == -1) {
|
if (bytes_written == -1) {
|
||||||
fprintf(stderr, "Unable to write output file\n");
|
fprintf(stderr, "Unable to write output file\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue