1464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com/* 2464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Copyright 2011 Google Inc. All Rights Reserved. 3464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * 4464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Licensed under the Apache License, Version 2.0 (the "License"); 5464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * you may not use this file except in compliance with the License. 6464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * You may obtain a copy of the License at 7464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * 8464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * http://www.apache.org/licenses/LICENSE-2.0 9464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * 10464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Unless required by applicable law or agreed to in writing, software 11464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * distributed under the License is distributed on an "AS IS" BASIS, 12464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * See the License for the specific language governing permissions and 14464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * limitations under the License. 15464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com */ 16464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 175af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#ifndef SFNTLY_CPP_SRC_SFNTLY_TABLE_CORE_HORIZONTAL_HEADER_TABLE_H_ 185af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#define SFNTLY_CPP_SRC_SFNTLY_TABLE_CORE_HORIZONTAL_HEADER_TABLE_H_ 19464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 205af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#include "sfntly/table/table.h" 216b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com#include "sfntly/table/table_based_table_builder.h" 22464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 23464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comnamespace sfntly { 24464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 25b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com// A Horizontal Header table - 'hhea'. 26464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comclass HorizontalHeaderTable : public Table, 27464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public RefCounted<HorizontalHeaderTable> { 28246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com public: 29b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com // Builder for a Horizontal Header table - 'hhea'. 306b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com class Builder : public TableBasedTableBuilder, public RefCounted<Builder> { 31246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com public: 32246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // Constructor scope altered to public because C++ does not allow base 33246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com // class to instantiate derived class with protected constructors. 34b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com Builder(Header* header, WritableFontData* data); 35b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com Builder(Header* header, ReadableFontData* data); 36246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual ~Builder(); 37246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data); 38246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 39b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com static CALLER_ATTACH Builder* CreateBuilder(Header* header, 40b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com WritableFontData* data); 41b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com 42b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t TableVersion(); 43b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com void SetTableVersion(int32_t version); 44246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t Ascender(); 45246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetAscender(int32_t ascender); 46246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t Descender(); 47246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetDescender(int32_t descender); 48246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t LineGap(); 49246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetLineGap(int32_t line_gap); 50246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t AdvanceWidthMax(); 51246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetAdvanceWidthMax(int32_t value); 52246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t MinLeftSideBearing(); 53246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetMinLeftSideBearing(int32_t value); 54246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t MinRightSideBearing(); 55246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetMinRightSideBearing(int32_t value); 56246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t XMaxExtent(); 57246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetXMaxExtent(int32_t value); 58246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t CaretSlopeRise(); 59246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetCaretSlopeRise(int32_t value); 60246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t CaretSlopeRun(); 61246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetCaretSlopeRun(int32_t value); 62246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t CaretOffset(); 63246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetCaretOffset(int32_t value); 64246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t MetricDataFormat(); 65246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetMetricDataFormat(int32_t value); 66246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t NumberOfHMetrics(); 67246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com void SetNumberOfHMetrics(int32_t value); 68246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com }; 69246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 70246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com virtual ~HorizontalHeaderTable(); 71b54cce09c1fc2b09e2adae43d7eb017b47b0cccfarthurhsu@google.com int32_t TableVersion(); 72246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t Ascender(); 73246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t Descender(); 74246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t LineGap(); 75246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t AdvanceWidthMax(); 76246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t MinLeftSideBearing(); 77246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t MinRightSideBearing(); 78246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t XMaxExtent(); 79246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t CaretSlopeRise(); 80246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t CaretSlopeRun(); 81246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t CaretOffset(); 82246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t MetricDataFormat(); 83246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com int32_t NumberOfHMetrics(); 84246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com 85464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com private: 86464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com struct Offset { 8744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com enum { 8844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kVersion = 0, 8944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAscender = 4, 9044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kDescender = 6, 9144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kLineGap = 8, 9244bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kAdvanceWidthMax = 10, 9344bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMinLeftSideBearing = 12, 9444bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMinRightSideBearing = 14, 9544bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kXMaxExtent = 16, 9644bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCaretSlopeRise = 18, 9744bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCaretSlopeRun = 20, 9844bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kCaretOffset = 22, 9944bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kMetricDataFormat = 32, 10044bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com kNumberOfHMetrics = 34, 10144bcb4a1475aeb0c4bce1cba0c30f5ee01eb50d9arthurhsu@google.com }; 102464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com }; 103464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 104464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com HorizontalHeaderTable(Header* header, ReadableFontData* data); 105464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com}; 106464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comtypedef Ptr<HorizontalHeaderTable> HorizontalHeaderTablePtr; 107464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comtypedef Ptr<HorizontalHeaderTable::Builder> HorizontalHeaderTableBuilderPtr; 108464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 109464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com} // namespace sfntly 110464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com 1115af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#endif // SFNTLY_CPP_SRC_SFNTLY_TABLE_CORE_HORIZONTAL_HEADER_TABLE_H_ 112