diff options
Diffstat (limited to 'cpp/src/sample/chromium/font_subsetter.h')
-rw-r--r-- | cpp/src/sample/chromium/font_subsetter.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/cpp/src/sample/chromium/font_subsetter.h b/cpp/src/sample/chromium/font_subsetter.h index 07b1b5b..c8e65e2 100644 --- a/cpp/src/sample/chromium/font_subsetter.h +++ b/cpp/src/sample/chromium/font_subsetter.h @@ -18,7 +18,7 @@ #ifndef SFNTLY_CPP_SRC_TEST_FONT_SUBSETTER_H_ #define SFNTLY_CPP_SRC_TEST_FONT_SUBSETTER_H_ -#include <cstddef> +#include <stddef.h> class SfntlyWrapper { public: @@ -46,6 +46,30 @@ class SfntlyWrapper { const unsigned int* glyph_ids, size_t glyph_count, unsigned char** output_buffer); + + + // Font subsetting API + // + // Input TTF/TTC/OTF fonts, specify the glyph IDs to subset, and the subset + // font is returned in |output_buffer| (caller to delete[]). Return value is + // the length of output_buffer allocated. + // + // If subsetting fails, a negative value is returned. If none of the glyph + // IDs specified is found, the function will return 0. + // + // |font_name| Font index, ignored for non-TTC files, 0-indexed. + // |original_font| Original font file contents. + // |font_size| Size of |original_font| in bytes. + // |glyph_ids| Glyph IDs to subset. If the specified glyph ID is not + // found in the font file, it will be ignored silently. + // |glyph_count| Number of glyph IDs in |glyph_ids| + // |output_buffer| Generated subset font. Caller to delete[]. + static int SubsetFont(int font_index, + const unsigned char* original_font, + size_t font_size, + const unsigned int* glyph_ids, + size_t glyph_count, + unsigned char** output_buffer); }; #endif // SFNTLY_CPP_SRC_TEST_FONT_SUBSETTER_H_ |