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/core/maximum_profile_table.h" 18 19namespace sfntly { 20/****************************************************************************** 21 * MaximumProfileTable class 22 ******************************************************************************/ 23MaximumProfileTable::~MaximumProfileTable() {} 24 25int32_t MaximumProfileTable::TableVersion() { 26 return data_->ReadFixed(Offset::kVersion); 27} 28 29int32_t MaximumProfileTable::NumGlyphs() { 30 return data_->ReadUShort(Offset::kNumGlyphs); 31} 32 33int32_t MaximumProfileTable::MaxPoints() { 34 return data_->ReadUShort(Offset::kMaxPoints); 35} 36 37int32_t MaximumProfileTable::MaxContours() { 38 return data_->ReadUShort(Offset::kMaxContours); 39} 40 41int32_t MaximumProfileTable::MaxCompositePoints() { 42 return data_->ReadUShort(Offset::kMaxCompositePoints); 43} 44 45int32_t MaximumProfileTable::MaxCompositeContours() { 46 return data_->ReadUShort(Offset::kMaxCompositeContours); 47} 48 49int32_t MaximumProfileTable::MaxZones() { 50 return data_->ReadUShort(Offset::kMaxZones); 51} 52 53int32_t MaximumProfileTable::MaxTwilightPoints() { 54 return data_->ReadUShort(Offset::kMaxTwilightPoints); 55} 56 57int32_t MaximumProfileTable::MaxStorage() { 58 return data_->ReadUShort(Offset::kMaxStorage); 59} 60 61int32_t MaximumProfileTable::MaxFunctionDefs() { 62 return data_->ReadUShort(Offset::kMaxFunctionDefs); 63} 64 65int32_t MaximumProfileTable::MaxStackElements() { 66 return data_->ReadUShort(Offset::kMaxStackElements); 67} 68 69int32_t MaximumProfileTable::MaxSizeOfInstructions() { 70 return data_->ReadUShort(Offset::kMaxSizeOfInstructions); 71} 72 73int32_t MaximumProfileTable::MaxComponentElements() { 74 return data_->ReadUShort(Offset::kMaxComponentElements); 75} 76 77int32_t MaximumProfileTable::MaxComponentDepth() { 78 return data_->ReadUShort(Offset::kMaxComponentDepth); 79} 80 81MaximumProfileTable::MaximumProfileTable(Header* header, 82 ReadableFontData* data) 83 : Table(header, data) { 84} 85 86/****************************************************************************** 87 * MaximumProfileTable::Builder class 88 ******************************************************************************/ 89MaximumProfileTable::Builder::Builder(Header* header, WritableFontData* data) 90 : TableBasedTableBuilder(header, data) { 91} 92 93MaximumProfileTable::Builder::Builder(Header* header, ReadableFontData* data) 94 : TableBasedTableBuilder(header, data) { 95} 96 97MaximumProfileTable::Builder::~Builder() {} 98 99CALLER_ATTACH FontDataTable* 100 MaximumProfileTable::Builder::SubBuildTable(ReadableFontData* data) { 101 FontDataTablePtr table = new MaximumProfileTable(header(), data); 102 return table.Detach(); 103} 104 105CALLER_ATTACH MaximumProfileTable::Builder* 106 MaximumProfileTable::Builder::CreateBuilder(Header* header, 107 WritableFontData* data) { 108 Ptr<MaximumProfileTable::Builder> builder; 109 builder = new MaximumProfileTable::Builder(header, data); 110 return builder.Detach(); 111} 112 113int32_t MaximumProfileTable::Builder::TableVersion() { 114 return InternalReadData()->ReadUShort(Offset::kVersion); 115} 116 117void MaximumProfileTable::Builder::SetTableVersion(int32_t version) { 118 InternalWriteData()->WriteUShort(Offset::kVersion, version); 119} 120 121int32_t MaximumProfileTable::Builder::NumGlyphs() { 122 return InternalReadData()->ReadUShort(Offset::kNumGlyphs); 123} 124 125void MaximumProfileTable::Builder::SetNumGlyphs(int32_t num_glyphs) { 126 InternalWriteData()->WriteUShort(Offset::kNumGlyphs, num_glyphs); 127} 128 129int32_t MaximumProfileTable::Builder::MaxPoints() { 130 return InternalReadData()->ReadUShort(Offset::kMaxPoints); 131} 132 133void MaximumProfileTable::Builder::SetMaxPoints(int32_t max_points) { 134 InternalWriteData()->WriteUShort(Offset::kMaxPoints, max_points); 135} 136 137int32_t MaximumProfileTable::Builder::MaxContours() { 138 return InternalReadData()->ReadUShort(Offset::kMaxContours); 139} 140 141void MaximumProfileTable::Builder::SetMaxContours(int32_t max_contours) { 142 InternalWriteData()->WriteUShort(Offset::kMaxContours, max_contours); 143} 144 145int32_t MaximumProfileTable::Builder::MaxCompositePoints() { 146 return InternalReadData()->ReadUShort(Offset::kMaxCompositePoints); 147} 148 149void MaximumProfileTable::Builder::SetMaxCompositePoints( 150 int32_t max_composite_points) { 151 InternalWriteData()->WriteUShort(Offset::kMaxCompositePoints, 152 max_composite_points); 153} 154 155int32_t MaximumProfileTable::Builder::MaxCompositeContours() { 156 return InternalReadData()->ReadUShort(Offset::kMaxCompositeContours); 157} 158 159void MaximumProfileTable::Builder::SetMaxCompositeContours( 160 int32_t max_composite_contours) { 161 InternalWriteData()->WriteUShort(Offset::kMaxCompositeContours, 162 max_composite_contours); 163} 164 165int32_t MaximumProfileTable::Builder::MaxZones() { 166 return InternalReadData()->ReadUShort(Offset::kMaxZones); 167} 168 169void MaximumProfileTable::Builder::SetMaxZones(int32_t max_zones) { 170 InternalWriteData()->WriteUShort(Offset::kMaxZones, max_zones); 171} 172 173int32_t MaximumProfileTable::Builder::MaxTwilightPoints() { 174 return InternalReadData()->ReadUShort(Offset::kMaxTwilightPoints); 175} 176 177void MaximumProfileTable::Builder::SetMaxTwilightPoints( 178 int32_t max_twilight_points) { 179 InternalWriteData()->WriteUShort(Offset::kMaxTwilightPoints, 180 max_twilight_points); 181} 182 183int32_t MaximumProfileTable::Builder::MaxStorage() { 184 return InternalReadData()->ReadUShort(Offset::kMaxStorage); 185} 186 187void MaximumProfileTable::Builder::SetMaxStorage(int32_t max_storage) { 188 InternalWriteData()->WriteUShort(Offset::kMaxStorage, max_storage); 189} 190 191int32_t MaximumProfileTable::Builder::MaxFunctionDefs() { 192 return InternalReadData()->ReadUShort(Offset::kMaxFunctionDefs); 193} 194 195void MaximumProfileTable::Builder::SetMaxFunctionDefs( 196 int32_t max_function_defs) { 197 InternalWriteData()->WriteUShort(Offset::kMaxFunctionDefs, max_function_defs); 198} 199 200int32_t MaximumProfileTable::Builder::MaxStackElements() { 201 return InternalReadData()->ReadUShort(Offset::kMaxStackElements); 202} 203 204void MaximumProfileTable::Builder::SetMaxStackElements( 205 int32_t max_stack_elements) { 206 InternalWriteData()->WriteUShort(Offset::kMaxStackElements, 207 max_stack_elements); 208} 209 210int32_t MaximumProfileTable::Builder::MaxSizeOfInstructions() { 211 return InternalReadData()->ReadUShort(Offset::kMaxSizeOfInstructions); 212} 213 214void MaximumProfileTable::Builder::SetMaxSizeOfInstructions( 215 int32_t max_size_of_instructions) { 216 InternalWriteData()->WriteUShort(Offset::kMaxSizeOfInstructions, 217 max_size_of_instructions); 218} 219 220int32_t MaximumProfileTable::Builder::MaxComponentElements() { 221 return InternalReadData()->ReadUShort(Offset::kMaxComponentElements); 222} 223 224void MaximumProfileTable::Builder::SetMaxComponentElements( 225 int32_t max_component_elements) { 226 InternalWriteData()->WriteUShort(Offset::kMaxComponentElements, 227 max_component_elements); 228} 229 230int32_t MaximumProfileTable::Builder::MaxComponentDepth() { 231 return InternalReadData()->ReadUShort(Offset::kMaxComponentDepth); 232} 233 234void MaximumProfileTable::Builder::SetMaxComponentDepth( 235 int32_t max_component_depth) { 236 InternalWriteData()->WriteUShort(Offset::kMaxComponentDepth, 237 max_component_depth); 238} 239 240} // namespace sfntly 241