1/* 2 * Copyright 2011 Google Inc. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "sfntly/table/table_based_table_builder.h" 18 19namespace sfntly { 20 21/****************************************************************************** 22 * TableBasedTableBuilder class 23 ******************************************************************************/ 24TableBasedTableBuilder::~TableBasedTableBuilder() {} 25 26int32_t TableBasedTableBuilder::SubSerialize(WritableFontData* data) { 27 UNREFERENCED_PARAMETER(data); 28 return 0; 29} 30 31bool TableBasedTableBuilder::SubReadyToSerialize() { 32 return false; 33} 34 35int32_t TableBasedTableBuilder::SubDataSizeToSerialize() { 36 return 0; 37} 38 39void TableBasedTableBuilder::SubDataSet() { 40 table_ = NULL; 41} 42 43CALLER_ATTACH FontDataTable* TableBasedTableBuilder::Build() { 44 FontDataTablePtr table = static_cast<FontDataTable*>(GetTable()); 45 return table.Detach(); 46} 47 48TableBasedTableBuilder::TableBasedTableBuilder(Header* header, 49 WritableFontData* data) 50 : Table::Builder(header, data) { 51} 52 53TableBasedTableBuilder::TableBasedTableBuilder(Header* header, 54 ReadableFontData* data) 55 : Table::Builder(header, data) { 56} 57 58TableBasedTableBuilder::TableBasedTableBuilder(Header* header) 59 : Table::Builder(header) { 60} 61 62Table* TableBasedTableBuilder::GetTable() { 63 if (!table_) { 64 ReadableFontData* data = InternalReadData(); 65 if (data) 66 table_.Attach(down_cast<Table*>(SubBuildTable(data))); 67 } 68 return table_; 69} 70 71} // namespace sfntly 72