[config] Don't compile buffer serialize API if HB_NO_BUFFER_SERIALIZE
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
This commit is contained in:
parent
bdbabd110c
commit
be1c0ab218
@ -24,14 +24,16 @@
|
||||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_BUFFER_SERIALIZE
|
||||
|
||||
#include "hb-buffer.hh"
|
||||
|
||||
|
||||
static const char *serialize_formats[] = {
|
||||
#ifndef HB_NO_BUFFER_SERIALIZE
|
||||
"text",
|
||||
"json",
|
||||
#endif
|
||||
nullptr
|
||||
};
|
||||
|
||||
@ -89,10 +91,8 @@ hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format)
|
||||
{
|
||||
switch ((unsigned) format)
|
||||
{
|
||||
#ifndef HB_NO_BUFFER_SERIALIZE
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return serialize_formats[0];
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_JSON: return serialize_formats[1];
|
||||
#endif
|
||||
default:
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return nullptr;
|
||||
}
|
||||
@ -348,10 +348,6 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
|
||||
if (buf_size)
|
||||
*buf = '\0';
|
||||
|
||||
#ifdef HB_NO_BUFFER_SERIALIZE
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
|
||||
buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
|
||||
|
||||
@ -457,10 +453,6 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
|
||||
end_ptr = &end;
|
||||
*end_ptr = buf;
|
||||
|
||||
#ifdef HB_NO_BUFFER_SERIALIZE
|
||||
return false;
|
||||
#endif
|
||||
|
||||
assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
|
||||
buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
|
||||
|
||||
@ -496,3 +488,6 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -37,6 +37,10 @@
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
#ifndef HB_NO_BUFFER_SERIALIZE
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf (stderr, "usage: %s font-file\n", argv[0]);
|
||||
exit (1);
|
||||
@ -59,7 +63,6 @@ main (int argc, char **argv)
|
||||
hb_buffer_t *buf;
|
||||
buf = hb_buffer_create ();
|
||||
|
||||
bool ret = true;
|
||||
char line[BUFSIZ], out[BUFSIZ];
|
||||
while (fgets (line, sizeof(line), stdin) != nullptr)
|
||||
{
|
||||
@ -85,5 +88,7 @@ main (int argc, char **argv)
|
||||
|
||||
hb_font_destroy (font);
|
||||
|
||||
#endif
|
||||
|
||||
return !ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user