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_DATA_WRITABLE_FONT_DATA_H_
185af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#define SFNTLY_CPP_SRC_SFNTLY_DATA_WRITABLE_FONT_DATA_H_
19464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
20464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com#include "sfntly/data/readable_font_data.h"
21464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
22464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comnamespace sfntly {
23464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
2432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com// Writable font data wrapper. Supports writing of data primitives in the
2532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com// TrueType / OpenType spec.
26464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comclass WritableFontData : public ReadableFontData {
27464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com public:
28464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  explicit WritableFontData(ByteArray* ba);
29464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  virtual ~WritableFontData();
30464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
3133e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // Constructs a writable font data object. If the length is specified as
3233e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // positive then a fixed size font data object will be created. If the length
3333e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // is zero or less then a growable font data object will be created and the
3433e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // size will be used as an estimate to help in allocating the original space.
3533e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // @param length if length > 0 create a fixed length font data; otherwise
3633e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  //        create a growable font data
3733e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // @return a new writable font data
3833e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  static CALLER_ATTACH WritableFontData* CreateWritableFontData(int32_t length);
3933e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com
4033e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // Constructs a writable font data object. The new font data object will wrap
4133e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // the bytes passed in to the factory and it will take make a copy of those
4233e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // bytes.
4333e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // @param b the byte vector to wrap
4433e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  // @return a new writable font data
4533e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com  static CALLER_ATTACH WritableFontData* CreateWritableFontData(ByteVector* b);
4633e4b13b001b82d8b26a2066ba77fe04bbd6f9a8dfilimon@google.com
4732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write a byte at the given index.
4832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
4932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param b the byte to write
5032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes written
51246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteByte(int32_t index, byte_t b);
5232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
5332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the bytes from the array.
5432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
5532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param b the source for the bytes to be written
5632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param offset offset in the byte array
5732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param length the length of the bytes to be written
5832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written; -1 if the index is outside
5932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  //         the FontData's range
6032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  virtual int32_t WriteBytes(int32_t index,
6132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com                             byte_t* b,
6232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com                             int32_t offset,
63464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com                             int32_t length);
6432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
6532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the bytes from the array.
6632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
6732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param b the source for the bytes to be written
6832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written; -1 if the index is outside
6932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  //         the FontData's range
70246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteBytes(int32_t index, ByteVector* b);
7132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
726b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // Write the bytes from the array and pad if necessary.
736b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // Write to the length given using the byte array provided and if there are
746b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // not enough bytes in the array then pad to the requested length using the
756b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // pad byte specified.
766b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // @param index index into the font data
776b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // @param b the source for the bytes to be written
786b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // @param offset offset in the byte array
796b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // @param length the length of the bytes to be written
806b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // @param pad the padding byte to be used if necessary
816b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  // @return the number of bytes actually written
826b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com  virtual int32_t WriteBytesPad(int32_t index,
836b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com                                ByteVector* b,
846b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com                                int32_t offset,
856b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com                                int32_t length,
866b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com                                byte_t pad);
876b8e073e978eed96605da6f92d6db740a39864baarthurhsu@google.com
8853847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // Writes padding to the FontData. The padding byte written is 0x00.
8953847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // @param index index into the font data
9053847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // @param count the number of pad bytes to write
91333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com  // @return the number of pad bytes written
92333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com  virtual int32_t WritePadding(int32_t index, int32_t count);
93333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com
9453847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // Writes padding to the FontData.
9553847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // @param index index into the font data
9653847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // @param count the number of pad bytes to write
9753847b66af7e0c1af9928e4da2e978ed3b7c2a25arthurhsu@google.com  // @param pad the byte value to use as padding
98333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com  // @return the number of pad bytes written
99333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com  virtual int32_t WritePadding(int32_t index, int32_t count, byte_t pad);
100333edd91cb32d6acfd0307ba2ae8f60baed75ff4arthurhsu@google.com
10132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the CHAR at the given index.
10232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
10332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param c the CHAR
10432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
10532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
106246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteChar(int32_t index, byte_t c);
10732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
10832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the USHORT at the given index.
10932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
11032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param us the USHORT
11132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
11232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
113246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteUShort(int32_t index, int32_t us);
11432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
11532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the USHORT at the given index in little endian format.
11632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
11732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param us the USHORT
11832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
11932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
120246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteUShortLE(int32_t index, int32_t us);
12132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
12232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the SHORT at the given index.
12332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
12432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param s the SHORT
12532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
12632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
127246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteShort(int32_t index, int32_t s);
12832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
12932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the UINT24 at the given index.
13032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
13132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param ui the UINT24
13232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
13332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
134246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteUInt24(int32_t index, int32_t ui);
13532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
13632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the ULONG at the given index.
13732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
13832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param ul the ULONG
13932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
14032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
141246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteULong(int32_t index, int64_t ul);
14232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
14332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the ULONG at the given index in little endian format.
14432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
14532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param ul the ULONG
14632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
14732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
148246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteULongLE(int32_t index, int64_t ul);
14932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
15032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the LONG at the given index.
15132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
15232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param l the LONG
15332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
15432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
155246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteLong(int32_t index, int64_t l);
15632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
15732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the Fixed at the given index.
15832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
15932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param f the Fixed
16032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
16132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
16232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  virtual int32_t WriteFixed(int32_t index, int32_t f);
16332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
16432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Write the LONGDATETIME at the given index.
16532a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param index index into the font data
16632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param date the LONGDATETIME
16732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @return the number of bytes actually written
16832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IndexOutOfBoundsException if index is outside the FontData's range
169246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual int32_t WriteDateTime(int32_t index, int64_t date);
170464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
17132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Copy from the InputStream into this FontData.
17232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param is the source
17332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param length the number of bytes to copy
17432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IOException
175c10c3d53cd1401f158e89697b7fe019b6828fa00arthurhsu@google.com  virtual void CopyFrom(InputStream* is, int32_t length);
17632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
17732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Copy everything from the InputStream into this FontData.
17832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param is the source
17932a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @throws IOException
180c10c3d53cd1401f158e89697b7fe019b6828fa00arthurhsu@google.com  virtual void CopyFrom(InputStream* is);
181c10c3d53cd1401f158e89697b7fe019b6828fa00arthurhsu@google.com
182464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // Makes a slice of this FontData. The returned slice will share the data with
183464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // the original FontData.
184464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // @param offset the start of the slice
185464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // @param length the number of bytes in the slice
186464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // @return a slice of the original FontData
187246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual CALLER_ATTACH FontData* Slice(int32_t offset, int32_t length);
188464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
189464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // Makes a bottom bound only slice of this array. The returned slice will
190464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // share the data with the original FontData.
191464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // @param offset the start of the slice
192464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com  // @return a slice of the original FontData
193246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  virtual CALLER_ATTACH FontData* Slice(int32_t offset);
194246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com
195246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com private:
19632a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Constructor with a lower bound.
19732a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param data other WritableFontData object to share data with
19832a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param offset offset from the other WritableFontData's data
199246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  WritableFontData(WritableFontData* data, int32_t offset);
20032a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com
20132a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // Constructor with lower bound and a length bound.
20232a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param data other WritableFontData object to share data with
20332a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param offset offset from the other WritableFontData's data
20432a01c7c6e7be46dda9bfc78de9ce32d99e4c8b7arthurhsu@google.com  // @param length length of other WritableFontData's data to use
205246300f7fab1f2539c3207ce5ec28cc355465be8arthurhsu@google.com  WritableFontData(WritableFontData* data, int32_t offset, int32_t length);
206464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com};
207464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comtypedef Ptr<WritableFontData> WritableFontDataPtr;
208464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
209464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com}  // namespace sfntly
210464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
2115af34fd773f8cfee82321393504f558ddf67c628arthurhsu@google.com#endif  // SFNTLY_CPP_SRC_SFNTLY_DATA_WRITABLE_FONT_DATA_H_
212