]> granicus.if.org Git - icu/commitdiff
ICU-9306 add internal function to include table size, also other changes for harfbuzz
authorSteven R. Loomis <srl@icu-project.org>
Tue, 13 Nov 2012 03:42:48 +0000 (03:42 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Tue, 13 Nov 2012 03:42:48 +0000 (03:42 +0000)
X-SVN-Rev: 32804

icu4c/source/layout/LEFontInstance.h
icu4c/source/layout/LETypes.h

index 6747acbd0a9ab7b3a6c979d9b02a200904a37bb3..d84a652625fd12c21b45681a765a6f3723090c62 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  *
- * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2012 - All Rights Reserved
  *
  */
 
@@ -165,6 +165,25 @@ public:
      */
     virtual const void *getFontTable(LETag tableTag) const = 0;
 
+    /**
+     * This method reads a table from the font. Note that in general,
+     * it only makes sense to call this method on an <code>LEFontInstance</code>
+     * which represents a physical font - i.e. one which has been returned by
+     * <code>getSubFont()</code>. This is because each subfont in a composite font
+     * will have different tables, and there's no way to know which subfont to access.
+     *
+     * Subclasses which represent composite fonts should always return <code>NULL</code>.
+     * 
+     * This version sets a length, for range checking.
+     *
+     * @param tableTag - the four byte table tag. (e.g. 'cmap') 
+     * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown.
+     * @return the address of the table in memory, or <code>NULL</code>
+     *         if the table doesn't exist.
+     * @internal
+     */
+    virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }  /* -1 = unknown length */
+
     /**
      * This method is used to determine if the font can
      * render the given character. This can usually be done
index 0540493bd26e581f9013d5f222fe1b4200432726..56c8d21f39fc2992f295b223ee24123bd6b947ce 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2012 - All Rights Reserved
  *
  */
 
@@ -309,6 +309,51 @@ typedef struct LEPoint LEPoint;
  * @internal
  */
 #define LE_DELETE_ARRAY(array) uprv_free((void *) (array))
+#else
+
+/* Not using ICU memory - use C std lib versions */
+
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * A convenience macro to get the length of an array.
+ *
+ * @internal
+ */
+#define LE_ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+/**
+ * A convenience macro for copying an array.
+ *
+ * @internal
+ */
+#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])
+
+/**
+ * Allocate an array of basic types. This is used to isolate the rest of
+ * the LayoutEngine code from cmemory.h.
+ *
+ * @internal
+ */
+#define LE_NEW_ARRAY(type, count) (type *) malloc((count) * sizeof(type))
+
+/**
+ * Re-allocate an array of basic types. This is used to isolate the rest of
+ * the LayoutEngine code from cmemory.h.
+ *
+ * @internal
+ */
+#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0])
+
+ /**
+ * Free an array of basic types. This is used to isolate the rest of
+ * the LayoutEngine code from cmemory.h.
+ *
+ * @internal
+ */
+#define LE_DELETE_ARRAY(array) free((void *) (array))
+
 #endif
 #endif  /* U_HIDE_INTERNAL_API */