&& (! strncmp (ext, ".ttf", 4)
|| ! strncmp (ext, ".TTF", 4)
|| ! strncmp (ext, ".otf", 4)
- || ! strncmp (ext, ".OTF", 4)));
+ || ! strncmp (ext, ".OTF", 4)
+ || ! strncmp (ext, ".PFA", 4)
+ || ! strncmp (ext, ".pfa", 4)
+ || ! strncmp (ext, ".PFB", 4)
+ || ! strncmp (ext, ".pfb", 4)));
}
int
for (j = 0; j < face->num_charmaps; j++)
{
if (face->charmaps[j]->encoding == ft_encoding_symbol)
- printf (" symbol,");
+ printf (" symbol");
else if (face->charmaps[j]->encoding == ft_encoding_unicode)
- printf (" unicode,");
+ printf (" unicode");
else if (face->charmaps[j]->encoding == ft_encoding_latin_1)
- printf (" latin_1,");
+ printf (" latin_1");
else if (face->charmaps[j]->encoding == ft_encoding_latin_2)
- printf (" latin_2,");
+ printf (" latin_2");
else if (face->charmaps[j]->encoding == ft_encoding_sjis)
- printf (" sjis,");
+ printf (" sjis");
else if (face->charmaps[j]->encoding == ft_encoding_gb2312)
- printf (" gb2312,");
+ printf (" gb2312");
else if (face->charmaps[j]->encoding == ft_encoding_big5)
- printf (" big5,");
+ printf (" big5");
else if (face->charmaps[j]->encoding == ft_encoding_wansung)
- printf (" wansung,");
+ printf (" wansung");
else if (face->charmaps[j]->encoding == ft_encoding_johab)
- printf (" johab,");
+ printf (" johab");
else if (face->charmaps[j]->encoding == ft_encoding_adobe_standard)
- printf (" adobe_standard,");
+ printf (" adobe_standard");
else if (face->charmaps[j]->encoding == ft_encoding_adobe_expert)
- printf (" adobe_expert,");
+ printf (" adobe_expert");
else if (face->charmaps[j]->encoding == ft_encoding_adobe_custom)
- printf (" adobe_custom,");
+ printf (" adobe_custom");
else if (face->charmaps[j]->encoding == ft_encoding_apple_roman)
- printf (" apple_roman,");
+ printf (" apple_roman");
else if (face->charmaps[j]->encoding == ft_encoding_none)
- printf (" none,");
+ printf (" none");
else
- printf (" 0x%X,", (unsigned) face->charmaps[j]->encoding);
+ printf (" 0x%X", (unsigned) face->charmaps[j]->encoding);
+ printf ("(%d-%d),", face->charmaps[j]->platform_id,
+ face->charmaps[j]->encoding_id);
}
printf ("\n");
}
(1-10) "GPOS" table
(1-11) Structure for OTF
- (2) APIs for reading OTF
+ (2) API for reading OTF
(2-1) OTF_open()
(2-2) OTF_close()
(2-3) OTF_get_table()
+ (2-4) OTF_check_table()
- (3) APIs for driving OTF
+ (3) API for driving OTF
(3-1) Structure for glyph string
(3-2) OTF_drive_cmap()
(3-3) OTF_drive_gdef()
(3-5) OTF_drive_gpos()
(3-6) OTF_drive_tables()
- (4) APIs for error handling
+ (4) API for error handling
(4-1) Error codes
(4-2) OTF_perror()
- (5) APIs miscellaneous
+ (5) API miscellaneous
*/
} OTF;
\f
-/*** (2) APIs for reading OTF */
+/*** (2) API for reading OTF */
/*** (2-1) otf_open () */
/***
Close OpenType font
- The OTF_close() function closes the OpenType font pointed by $OTF
- which must be what the OTF_open() returned.
+ The OTF_close() function closes the OpenType font $OTF which must
+ be what the OTF_open() function returned.
See also OTF_open(). */
/***
Get OpenType font table
- The OTF_get_table() function setups one of the OTF tables
- specified by $NAME in the structure pointed by $OTF.
+ The OTF_get_table() function setups one of the OTF table specified
+ by $NAME in the OpenType font $OTF.
$NAME must be one of "head", "name", "cmap", "GDEF", "GSUB", and
"GPOS", and a member of the same name is setup.
extern int OTF_get_table (OTF *otf, char *name);
+/*** (2-4) OTF_check_table () */
-/*** (3) APIs for driving OTF */
+/***
+ Check the existence of OpenType font table
+
+ The OTF_check_table() function checks if the the OTF table
+ specified by $NAME exists in OpenType font $OTF.
+
+ If the table exists, return 0, else return -1.
+
+ See also OTF_open(). */
+
+extern int OTF_check_table (OTF *otf, char *name);
+
+
+/*** (3) API for driving OTF */
/*** (3-1) Structure for glyph string */
char *gsub_features, char *gpos_features);
-/*** (4) APIs for error handling ***/
+/*** (4) API for error handling ***/
/*** (4-1) Error codes ***/
extern void OTF_perror (char *prefix);
-/*** (5) APIs miscellaneous ***/
+/*** (5) API miscellaneous ***/
/***
Return OTF tag of a specified name string.
\f
-/* APIs */
+/* API */
int
OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring)
(2-1) OTF_open()
(2-2) OTF_close()
(2-3) OTF_get_table()
+ (2-4) OTF_check_table()
(5) API miscellaneous
*/
return 0;
}
+static OTF_TableInfo *
+get_table_info (OTF *otf, char *name)
+{
+ char *errfmt = "OTF Table Read%s";
+ OTF_TableInfo *errret = NULL;
+ OTF_InternalData *internal_data = otf->internal_data;
+ OTF_TableInfo *table_info;
+ OTF_Tag tag = OTF_tag (name);
+
+ if (! tag)
+ OTF_ERROR (OTF_ERROR_TABLE, " (invalid table name)");
+
+ if (tag == OTF_tag ("head"))
+ table_info = internal_data->table_info + OTF_TABLE_TYPE_HEAD;
+ else if (tag == OTF_tag ("name"))
+ table_info = internal_data->table_info + OTF_TABLE_TYPE_NAME;
+ else if (tag == OTF_tag ("cmap"))
+ table_info = internal_data->table_info + OTF_TABLE_TYPE_CMAP;
+ else if (tag == OTF_tag ("GDEF"))
+ table_info = internal_data->table_info + OTF_TABLE_TYPE_GDEF;
+ else if (tag == OTF_tag ("GSUB"))
+ table_info = internal_data->table_info + OTF_TABLE_TYPE_GSUB;
+ else if (tag == OTF_tag ("GPOS"))
+ table_info = internal_data->table_info + OTF_TABLE_TYPE_GPOS;
+ else
+ OTF_ERROR (OTF_ERROR_TABLE, " (not yet supported table name)");
+
+ if (*table_info->address)
+ /* Already read. */
+ return table_info;
+ if (! table_info->stream)
+ OTF_ERROR (OTF_ERROR_TABLE, " (table not found)");
+ if (! table_info->reader)
+ OTF_ERROR (OTF_ERROR_TABLE, " (invalid contents)");
+ return table_info;
+}
+
+
\f
/*** (2) API for reading OTF */
int
OTF_get_table (OTF *otf, char *name)
{
- char *errfmt = "OTF Table Read%s";
- int errret = -1;
- OTF_InternalData *internal_data = otf->internal_data;
- OTF_TableInfo *table_info;
- OTF_Tag tag = OTF_tag (name);
-
- if (! tag)
- OTF_ERROR (OTF_ERROR_TABLE, " (invalid table name)");
-
- if (tag == OTF_tag ("head"))
- table_info = internal_data->table_info + OTF_TABLE_TYPE_HEAD;
- else if (tag == OTF_tag ("name"))
- table_info = internal_data->table_info + OTF_TABLE_TYPE_NAME;
- else if (tag == OTF_tag ("cmap"))
- table_info = internal_data->table_info + OTF_TABLE_TYPE_CMAP;
- else if (tag == OTF_tag ("GDEF"))
- table_info = internal_data->table_info + OTF_TABLE_TYPE_GDEF;
- else if (tag == OTF_tag ("GSUB"))
- table_info = internal_data->table_info + OTF_TABLE_TYPE_GSUB;
- else if (tag == OTF_tag ("GPOS"))
- table_info = internal_data->table_info + OTF_TABLE_TYPE_GPOS;
- else
- OTF_ERROR (OTF_ERROR_TABLE, " (not yet supported table name)");
+ OTF_TableInfo *table_info = get_table_info (otf, name);
- if (*table_info->address)
- /* Already read. */
- return 0;
- if (! table_info->stream)
- OTF_ERROR (OTF_ERROR_TABLE, " (table not found)");
- if (! table_info->reader)
- OTF_ERROR (OTF_ERROR_TABLE, " (invalid contents)");
+ if (! table_info)
+ return -1;
*table_info->address = (*table_info->reader) (otf, table_info->stream);
free_stream (table_info->stream);
if (! *table_info->address)
{
table_info->reader = NULL;
- return errret;
+ return -1;
}
-
return 0;
}
+/*** (2-4) OTF_check_table() */
+
+int
+OTF_check_table (OTF *otf, char *name)
+{
+ return (get_table_info (otf, name) ? 0 : -1);
+}
+
+
+
\f
/*** (5) API miscellaneous ***/