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/bitmap/ebsc_table.h"
18
19namespace sfntly {
20/******************************************************************************
21 * EbscTable class
22 ******************************************************************************/
23EbscTable::~EbscTable() {
24}
25
26int32_t EbscTable::Version() {
27  return data_->ReadFixed(Offset::kVersion);
28}
29
30int32_t EbscTable::NumSizes() {
31  return data_->ReadULongAsInt(Offset::kNumSizes);
32}
33
34EbscTable::EbscTable(Header* header, ReadableFontData* data)
35    : Table(header, data) {
36}
37
38/******************************************************************************
39 * EbscTable::BitmapScaleTable class
40 ******************************************************************************/
41EbscTable::BitmapScaleTable::~BitmapScaleTable() {
42}
43
44EbscTable::BitmapScaleTable::BitmapScaleTable(ReadableFontData* data)
45    : SubTable(data) {
46}
47
48int32_t EbscTable::BitmapScaleTable::PpemX() {
49  return data_->ReadByte(Offset::kBitmapScaleTable_ppemX);
50}
51
52int32_t EbscTable::BitmapScaleTable::PpemY() {
53  return data_->ReadByte(Offset::kBitmapScaleTable_ppemY);
54}
55
56int32_t EbscTable::BitmapScaleTable::SubstitutePpemX() {
57  return data_->ReadByte(Offset::kBitmapScaleTable_substitutePpemX);
58}
59
60int32_t EbscTable::BitmapScaleTable::SubstitutePpemY() {
61  return data_->ReadByte(Offset::kBitmapScaleTable_substitutePpemY);
62}
63
64/******************************************************************************
65 * EbscTable::Builder class
66 ******************************************************************************/
67EbscTable::Builder::~Builder() {
68}
69
70CALLER_ATTACH EbscTable::Builder* EbscTable::Builder::CreateBuilder(
71    Header* header, WritableFontData* data) {
72  EbscTableBuilderPtr builder = new EbscTable::Builder(header, data);
73  return builder.Detach();
74}
75
76EbscTable::Builder::Builder(Header* header, WritableFontData* data)
77    : Table::Builder(header, data) {
78}
79
80EbscTable::Builder::Builder(Header* header, ReadableFontData* data)
81    : Table::Builder(header, data) {
82}
83
84CALLER_ATTACH
85FontDataTable* EbscTable::Builder::SubBuildTable(ReadableFontData* data) {
86  EbscTablePtr output = new EbscTable(header(), data);
87  return output.Detach();
88}
89
90void EbscTable::Builder::SubDataSet() {
91  // NOP
92}
93
94int32_t EbscTable::Builder::SubDataSizeToSerialize() {
95  return 0;
96}
97
98bool EbscTable::Builder::SubReadyToSerialize() {
99  return false;
100}
101
102int32_t EbscTable::Builder::SubSerialize(WritableFontData* new_data) {
103  UNREFERENCED_PARAMETER(new_data);
104  return 0;
105}
106
107}  // namespace sfntly
108