bashi@chromium.org | 6462c58 | 2014-06-27 06:24:49 +0000 | [diff] [blame] | 1 | // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "cbdt.h" |
| 6 | |
| 7 | // CBDT |
| 8 | // https://color-emoji.googlecode.com/git/specification/v1.html |
| 9 | // We don't support the table, but provide a way not to drop the table. |
| 10 | |
| 11 | namespace ots { |
| 12 | |
| 13 | extern bool g_drop_color_bitmap_tables; |
| 14 | |
| 15 | bool ots_cbdt_parse(OpenTypeFile *file, const uint8_t *data, size_t length) { |
| 16 | if (g_drop_color_bitmap_tables) { |
| 17 | return OTS_FAILURE(); |
| 18 | } |
| 19 | |
| 20 | file->cbdt = new OpenTypeCBDT; |
| 21 | file->cbdt->data = data; |
| 22 | file->cbdt->length = length; |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | bool ots_cbdt_should_serialise(OpenTypeFile *file) { |
| 27 | return file->cbdt != NULL && file->cblc != NULL; |
| 28 | } |
| 29 | |
| 30 | bool ots_cbdt_serialise(OTSStream *out, OpenTypeFile *file) { |
| 31 | if (!out->Write(file->cbdt->data, file->cbdt->length)) { |
| 32 | return OTS_FAILURE(); |
| 33 | } |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | void ots_cbdt_free(OpenTypeFile *file) { |
| 38 | delete file->cbdt; |
| 39 | } |
| 40 | |
| 41 | } // namespace ots |