ICU-9306 add internal function to include table size, also other changes for harfbuzz

X-SVN-Rev: 32804
This commit is contained in:
Steven R. Loomis 2012-11-13 03:42:48 +00:00
parent 4c7ab0bd2e
commit 1d83357783
2 changed files with 66 additions and 2 deletions

View 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

View 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 */