aboutsummaryrefslogtreecommitdiff
path: root/cpp/src/sfntly/data/readable_font_data.h
diff options
context:
space:
mode:
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);