blob: 19cfd7d81d6dbef3914194fbc584b6ccd7871971 [file] [log] [blame]
bashi@chromium.org6462c582014-06-27 06:24:49 +00001// 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 "cblc.h"
6
7// CBLC
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
11namespace ots {
12
13extern bool g_drop_color_bitmap_tables;
14
15bool ots_cblc_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->cblc = new OpenTypeCBLC;
21 file->cblc->data = data;
22 file->cblc->length = length;
23 return true;
24}
25
26bool ots_cblc_should_serialise(OpenTypeFile *file) {
27 return file->cblc != NULL && file->cbdt != NULL;
28}
29
30bool ots_cblc_serialise(OTSStream *out, OpenTypeFile *file) {
31 if (!out->Write(file->cblc->data, file->cblc->length)) {
32 return OTS_FAILURE();
33 }
34 return true;
35}
36
37void ots_cblc_free(OpenTypeFile *file) {
38 delete file->cblc;
39}
40
41} // namespace ots