aboutsummaryrefslogtreecommitdiff
path: root/cpp/src/sfntly/data/readable_font_data.h
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-06-06 03:26:08 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-06-06 03:26:08 +0000
commite070d6c91d084990bc4c4103090a251557ca7c2b (patch)
treea1d53259acad0538184ab273ccb7c8ff663a57b9 /cpp/src/sfntly/data/readable_font_data.h
parent84e59f094e3a5d8eec0739b6a38d3943f2c45c62 (diff)
parent959c8f344711d56c218e843bbbbdb2a6c1c2ef60 (diff)
downloadsfntly-e070d6c91d084990bc4c4103090a251557ca7c2b.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into master am: d7c3ad1d95 am: fd76129cde am: 3d3aab44bf am: ad302cbfd8 am: 31db13c42a am: 47b38c7df8 am: 1f8dca48cb
am: 959c8f3447 Change-Id: Iff9062b9589d8d33021e630d46a945f6bad3aa77
Diffstat (limited to 'cpp/src/sfntly/data/readable_font_data.h')
-rw-r--r--cpp/src/sfntly/data/readable_font_data.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/cpp/src/sfntly/data/readable_font_data.h b/cpp/src/sfntly/data/readable_font_data.h
index b43c626..37a0918 100644
--- a/cpp/src/sfntly/data/readable_font_data.h
+++ b/cpp/src/sfntly/data/readable_font_data.h
@@ -22,8 +22,8 @@
namespace sfntly {
-class WritableFontData;
class OutputStream;
+class WritableFontData;
// Writable font data wrapper. Supports reading of data primitives in the
// TrueType / OpenType spec.
@@ -51,6 +51,12 @@ class ReadableFontData : public FontData,
explicit ReadableFontData(ByteArray* array);
virtual ~ReadableFontData();
+ static const int32_t kInvalidByte = 128;
+ static const int32_t kInvalidShort = 32768;
+ static const int32_t kInvalidLong = 0xffffffff;
+ static const int32_t kInvalidUnsigned = -1;
+ static const int64_t kInvalidLongDateTime = -1;
+
static CALLER_ATTACH ReadableFontData* CreateReadableFontData(ByteVector* b);
// Gets a computed checksum for the data. This checksum uses the OpenType spec
@@ -76,7 +82,7 @@ class ReadableFontData : public FontData,
// Read the BYTE at the given index.
// @param index index into the font data
- // @return the BYTE
+ // @return the BYTE; |kInvalidByte| if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int32_t ReadByte(int32_t index);
@@ -94,31 +100,31 @@ class ReadableFontData : public FontData,
// Read the CHAR at the given index.
// @param index index into the font data
- // @return the CHAR
+ // @return the CHAR; -1 if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int32_t ReadChar(int32_t index);
// Read the USHORT at the given index.
// @param index index into the font data
- // @return the USHORT
+ // @return the USHORT; -1 if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int32_t ReadUShort(int32_t index);
// Read the SHORT at the given index.
// @param index index into the font data
- // @return the SHORT
+ // @return the SHORT; |kInvalidShort| if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int32_t ReadShort(int32_t index);
// Read the UINT24 at the given index.
// @param index index into the font data
- // @return the UINT24
+ // @return the UINT24; -1 if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int32_t ReadUInt24(int32_t index);
// Read the ULONG at the given index.
// @param index index into the font data
- // @return the ULONG
+ // @return the ULONG; kInvalidUnsigned if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int64_t ReadULong(int32_t index);
@@ -136,7 +142,7 @@ class ReadableFontData : public FontData,
// Read the LONG at the given index.
// @param index index into the font data
- // @return the LONG
+ // @return the LONG; kInvalidLong if outside the bounds of the font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int32_t ReadLong(int32_t index);
@@ -148,7 +154,8 @@ class ReadableFontData : public FontData,
// Read the LONGDATETIME at the given index.
// @param index index into the font data
- // @return the LONGDATETIME
+ // @return the LONGDATETIME; kInvalidLongDateTime if outside the bounds of the
+ // font data
// @throws IndexOutOfBoundsException if index is outside the FontData's range
virtual int64_t ReadDateTimeAsLong(int32_t index);