Selim Gurun | 30d4e1f | 2013-08-15 12:46:15 -0700 | [diff] [blame] | 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 | |
| 19 | namespace sfntly { |
| 20 | |
| 21 | /****************************************************************************** |
| 22 | * TableBasedTableBuilder class |
| 23 | ******************************************************************************/ |
| 24 | TableBasedTableBuilder::~TableBasedTableBuilder() {} |
| 25 | |
| 26 | int32_t TableBasedTableBuilder::SubSerialize(WritableFontData* data) { |
| 27 | UNREFERENCED_PARAMETER(data); |
| 28 | return 0; |
| 29 | } |
| 30 | |
| 31 | bool TableBasedTableBuilder::SubReadyToSerialize() { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | int32_t TableBasedTableBuilder::SubDataSizeToSerialize() { |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | void TableBasedTableBuilder::SubDataSet() { |
| 40 | table_ = NULL; |
| 41 | } |
| 42 | |
| 43 | CALLER_ATTACH FontDataTable* TableBasedTableBuilder::Build() { |
| 44 | FontDataTablePtr table = static_cast<FontDataTable*>(GetTable()); |
| 45 | return table.Detach(); |
| 46 | } |
| 47 | |
| 48 | TableBasedTableBuilder::TableBasedTableBuilder(Header* header, |
| 49 | WritableFontData* data) |
| 50 | : Table::Builder(header, data) { |
| 51 | } |
| 52 | |
| 53 | TableBasedTableBuilder::TableBasedTableBuilder(Header* header, |
| 54 | ReadableFontData* data) |
| 55 | : Table::Builder(header, data) { |
| 56 | } |
| 57 | |
| 58 | TableBasedTableBuilder::TableBasedTableBuilder(Header* header) |
| 59 | : Table::Builder(header) { |
| 60 | } |
| 61 | |
| 62 | Table* TableBasedTableBuilder::GetTable() { |
Colin Cross | 13a8243 | 2017-04-07 10:50:33 -0700 | [diff] [blame] | 63 | if (!table_) { |
| 64 | ReadableFontData* data = InternalReadData(); |
| 65 | if (data) |
| 66 | table_.Attach(down_cast<Table*>(SubBuildTable(data))); |
Selim Gurun | 30d4e1f | 2013-08-15 12:46:15 -0700 | [diff] [blame] | 67 | } |
| 68 | return table_; |
| 69 | } |
| 70 | |
| 71 | } // namespace sfntly |