From: handa Date: Tue, 17 Dec 2002 13:12:59 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: REL-0-9-1~114 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95ee30a14e701742713683a7ea34fd1fb3fabfcd;p=m17n%2Flibotf.git *** empty log message *** --- diff --git a/example/otfdraw.c b/example/otfdraw.c index 9f5040a..0218d01 100644 --- a/example/otfdraw.c +++ b/example/otfdraw.c @@ -76,10 +76,10 @@ main (int argc, char **argv) exit (1); } - otf = otf_open (argv[1]); + otf = OTF_open (argv[1]); if (! otf) { - otf_perror ("otfdraw"); + OTF_perror ("otfdraw"); exit (1); } gstring.size = 10; @@ -103,16 +103,16 @@ main (int argc, char **argv) gstring.glyphs[gstring.used++].c = 0x947; gstring.glyphs[gstring.used++].c = 0x915; #endif - otf_drive_cmap (otf, &gstring); - otf_drive_gdef (otf, &gstring); + OTF_drive_cmap (otf, &gstring); + OTF_drive_gdef (otf, &gstring); otf_dump_gstring (&gstring); - if (otf_drive_gsub (otf, &gstring, "deva", NULL, NULL) < 0) + if (OTF_drive_gsub (otf, &gstring, "deva", NULL, NULL) < 0) printf ("otf_gsub error\n"); else printf ("RESULT of GSUB\n"); otf_dump_gstring (&gstring); - if (otf_drive_gpos (otf, &gstring, "deva", NULL, NULL) < 0) + if (OTF_drive_gpos (otf, &gstring, "deva", NULL, NULL) < 0) printf ("otf_gsub error\n"); else printf ("RESULT of GPOS\n"); @@ -171,6 +171,6 @@ main (int argc, char **argv) } - otf_close (otf); + OTF_close (otf); exit (0); } diff --git a/example/otfdump.c b/example/otfdump.c index 0d692ab..65f5a97 100644 --- a/example/otfdump.c +++ b/example/otfdump.c @@ -1004,23 +1004,23 @@ main (int argc, char **argv) exit (1); } - otf = otf_open (argv[1]); + otf = OTF_open (argv[1]); if (! otf) { - otf_perror ("otfdump"); + OTF_perror ("otfdump"); exit (1); } - otf_get_table (otf, "head"); - otf_get_table (otf, "name"); - otf_get_table (otf, "cmap"); - otf_get_table (otf, "GDEF"); - otf_get_table (otf, "GSUB"); - otf_get_table (otf, "GPOS"); + OTF_get_table (otf, "head"); + OTF_get_table (otf, "name"); + OTF_get_table (otf, "cmap"); + OTF_get_table (otf, "GDEF"); + OTF_get_table (otf, "GSUB"); + OTF_get_table (otf, "GPOS"); #if 0 - otf_get_table (otf, "BASE"); - otf_get_table (otf, "JSTF"); + OTF_get_table (otf, "BASE"); + OTF_get_table (otf, "JSTF"); #endif otf_dump (otf); - otf_close (otf); + OTF_close (otf); exit (0); } diff --git a/example/otfview.c b/example/otfview.c index 2b021da..0a4dabe 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -122,10 +122,10 @@ main (int argc, char **argv) exit (1); } - otf = otf_open (argv[1]); + otf = OTF_open (argv[1]); if (! otf) { - otf_perror ("otfview"); + OTF_perror ("otfview"); exit (1); } @@ -309,6 +309,6 @@ main (int argc, char **argv) update_mask = 0; } - otf_close (otf); + OTF_close (otf); exit (0); } diff --git a/src/otf.h b/src/otf.h index d52b39b..56d1a8f 100644 --- a/src/otf.h +++ b/src/otf.h @@ -40,21 +40,21 @@ Boston, MA 02111-1307, USA. */ (1-9) Structure for OTF (2) APIs for reading OTF - (2-1) otf_open() - (2-2) otf_close() - (2-3) otf_get_table() + (2-1) OTF_open() + (2-2) OTF_close() + (2-3) OTF_get_table() (3) APIs for driving OTF (3-1) Structure for glyph string - (3-2) otf_drive_cmap() - (3-3) otf_drive_gdef() - (3-4) otf_drive_gsub() - (3-5) otf_drive_gpos() - (3-6) otf_drive_tables() + (3-2) OTF_drive_cmap() + (3-3) OTF_drive_gdef() + (3-4) OTF_drive_gsub() + (3-5) OTF_drive_gpos() + (3-6) OTF_drive_tables() (4) APIs for error handling (4-1) Error codes - (4-2) otf_perror() + (4-2) OTF_perror() (5) APIs miscellaneous @@ -977,55 +977,55 @@ typedef struct /*** Open OpenType font - The otf_open() function reads the OpenType font file whose name is + The OTF_open() function reads the OpenType font file whose name is $NAME, and return a pointer to the structure of type OTF. It setups these member of the structure OTF: filename, offset_table, table_dirs If the file can't be read or the file contains invalid data, NULL - is returned, and the variable otf_error is set to one of the + is returned, and the variable OTF_error is set to one of the following values. OTF_ERROR_MEMORY OTF_ERROR_FILE OTF_ERROR_TABLE - See also otf_get_table() and otf_close(). */ + See also OTF_get_table() and OTF_close(). */ -extern OTF *otf_open (char *name); +extern OTF *OTF_open (char *name); -/*** (2-2) otf_close () */ +/*** (2-2) OTF_close () */ /*** 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 pointed by $OTF + which must be what the OTF_open() returned. - See also otf_open(). */ + See also OTF_open(). */ -extern void otf_close (OTF *otf); +extern void OTF_close (OTF *otf); -/*** (2-3) otf_get_table () */ +/*** (2-3) OTF_get_table () */ /*** Get OpenType font table - The otf_get_table() function setups one of the OTF tables + The OTF_get_table() function setups one of the OTF tables specified by $NAME in the structure pointed by $OTF. $NAME must be one of "head", "name", "cmap", "GDEF", "GSUB", and "GPOS", and a member of the same name is setup. If the table is successfully setup, return 0. Otherwise, return - -1, and set the variable otf_error to OTF_ERROR_TABLE. + -1, and set the variable OTF_error to OTF_ERROR_TABLE. - See also otf_open(). */ + See also OTF_open(). */ -extern int otf_get_table (OTF *otf, char *name); +extern int OTF_get_table (OTF *otf, char *name); /*** (3) APIs for driving OTF */ @@ -1040,7 +1040,7 @@ typedef struct { /* Character code of the glyph. This is the only member that a client has to set before calling the function - otf_drive_XXX(). */ + OTF_drive_XXX(). */ int c; /* Glyph ID of the glyph. */ @@ -1106,67 +1106,67 @@ typedef struct } OTF_GlyphString; -/*** (3-2) otf_drive_cmap() */ +/*** (3-2) OTF_drive_cmap() */ /*** Process glyph string by cmap table. - The otf_drive_cmap() function looks up the cmap table of OpenType + The OTF_drive_cmap() function looks up the cmap table of OpenType font $OTF, and setup the member of all glhphs in the glyph string $GSTRING. */ -extern int otf_drive_cmap (OTF *otf, OTF_GlyphString *gstring); +extern int OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring); -/*** (3-3) otf_drive_gdef() */ +/*** (3-3) OTF_drive_gdef() */ /*** Process glyph string by GDEF table. - The otf_drive_gdef() function looks up the GDEF table of OpenType + The OTF_drive_gdef() function looks up the GDEF table of OpenType font $OTF, and setup members and of all glhphs in the glyph string $GSTRING. */ -extern int otf_drive_gdef (OTF *otf, OTF_GlyphString *gstring); +extern int OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring); -/*** (3-4) otf_drive_gsub() */ +/*** (3-4) OTF_drive_gsub() */ /*** Process glyph string by GSUB table. - The otf_drive_gsub() function looks up the GSUB table of OpenType + The OTF_drive_gsub() function looks up the GSUB table of OpenType font $OTF, and by using features the font has for script $SCRIPT and language system $LANGSYS, update member of the glyph string $GSTRING. It may substitute, delete, insert glyphs in that array. */ -extern int otf_drive_gsub (OTF *otf, OTF_GlyphString *gstring, +extern int OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring, char *script, char *language, char *features); -/*** (3-5) otf_drive_gpos() */ +/*** (3-5) OTF_drive_gpos() */ /*** Process glyph string by GPOS table. - The otf_drive_gdef() function looks up the GPOS table of $OTF of + The OTF_drive_gdef() function looks up the GPOS table of $OTF of OpenType font $OTF, and by using features the font has for script $SCRIPT and language system $LANGSYS, setup members and of all glhphs in the glyph string $GSTRING. */ -extern int otf_drive_gpos (OTF *otf, OTF_GlyphString *gstring, +extern int OTF_drive_gpos (OTF *otf, OTF_GlyphString *gstring, char *script, char *language, char *features); -/*** (3-6) otf_drive_tables() */ +/*** (3-6) OTF_drive_tables() */ /*** Process glyph string by cmap, GDEF, GSUB, and GPOS tables. - The otf_drive_tables() function calls otf_drive_cmap(), - otf_drive_gdef(), otf_drive_gsub(), and otf_drive_gpos() in this + The OTF_drive_tables() function calls OTF_drive_cmap(), + OTF_drive_gdef(), OTF_drive_gsub(), and OTF_drive_gpos() in this order, and update the glyphs string GSTRING. */ -extern int otf_drive_tables (OTF *otf, OTF_GlyphString *gstring, +extern int OTF_drive_tables (OTF *otf, OTF_GlyphString *gstring, char *script, char *language, char *gsub_features, char *gpos_features); @@ -1178,9 +1178,9 @@ extern int otf_drive_tables (OTF *otf, OTF_GlyphString *gstring, /*** Global variable holding an error code. - The variable otf_error is set to one of OTF_ERROR_XXX macros when + The variable OTF_error is set to one of OTF_ERROR_XXX macros when an error is detected in the OTF library. */ -extern int otf_error; +extern int OTF_error; /*** Memory allocation error @@ -1211,34 +1211,34 @@ extern int otf_error; /*** GDEF driving error - See the function otf_drive_gdef() for more detail. */ + See the function OTF_drive_gdef() for more detail. */ #define OTF_ERROR_GDEF_DRIVE 5 /*** GSUB driving error - See the function otf_drive_gsub() for more detail. */ + See the function OTF_drive_gsub() for more detail. */ #define OTF_ERROR_GSUB_DRIVE 6 /*** GPOS driving error - See the function otf_drive_gpos() for more detail. */ + See the function OTF_drive_gpos() for more detail. */ #define OTF_ERROR_GPOS_DRIVE 7 -/*** (4-2) otf_perror() */ +/*** (4-2) OTF_perror() */ /*** Print an OTF error message - The otf_perror() function produces a message on the standard error + The OTF_perror() function produces a message on the standard error output, describing the last error encountered during a call to the OTF library function. If $PREFIX is not NULL, is is printed first, followed by a colon and a blank. Then the message and a newline. */ -extern void otf_perror (char *prefix); +extern void OTF_perror (char *prefix); /*** (5) APIs miscellaneous ***/ @@ -1246,20 +1246,20 @@ extern void otf_perror (char *prefix); /*** Return OTF tag of a specified name string. - The otf_tag() function returns OTF tag of name $NAME. If $NAME is + The OTF_tag() function returns OTF tag of name $NAME. If $NAME is NULL, return 0. Otherwise, $NAME must be at least 4-byte length. Only the first 4 characters are took into an account. */ -extern OTF_Tag otf_tag (char *name); +extern OTF_Tag OTF_tag (char *name); /*** Convert OTF tag to name string. - The otf_tag_name() function converts OTF tag $TAG to a 5-byte + The OTF_tag_name() function converts OTF tag $TAG to a 5-byte name string (including the terminating NUL), and store it in $NAME. At least 5-byte space must be at $NAME. */ -extern void otf_tag_name (OTF_Tag tag, char *name); +extern void OTF_tag_name (OTF_Tag tag, char *name); #endif /* not _OTF_H_ */ diff --git a/src/otfdrive.c b/src/otfdrive.c index 8cbfce5..7e3ce4b 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -97,8 +97,8 @@ static OTF_LangSys * get_langsys (OTF_ScriptList *script_list, char *script, char *language) { - OTF_Tag script_tag = otf_tag (script); - OTF_Tag langsys_tag = otf_tag (language); + OTF_Tag script_tag = OTF_tag (script); + OTF_Tag langsys_tag = OTF_tag (language); int i, j; for (i = 0; i < script_list->ScriptCount; i++) @@ -136,7 +136,7 @@ get_feature_index (OTF_LangSys *LangSys, OTF_FeatureList *FeatureList, while (len > 0) { int this_len = strlen (p0) + 1; - OTF_Tag tag = otf_tag (p0); + OTF_Tag tag = OTF_tag (p0); if (tag) { @@ -500,13 +500,13 @@ lookup_cmap (OTF_cmap *cmap, int c) /* APIs */ int -otf_drive_cmap (OTF *otf, OTF_GlyphString *gstring) +OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring) { OTF_cmap *cmap; int i; if (! otf->cmap - && otf_get_table (otf, "cmap") < 0) + && OTF_get_table (otf, "cmap") < 0) return -1; cmap = otf->cmap; @@ -518,13 +518,13 @@ otf_drive_cmap (OTF *otf, OTF_GlyphString *gstring) int -otf_drive_gdef (OTF *otf, OTF_GlyphString *gstring) +OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring) { OTF_GDEF *gdef; int i; if (! otf->gdef - && otf_get_table (otf, "GDEF") < 0) + && OTF_get_table (otf, "GDEF") < 0) return -1; gdef = otf->gdef; @@ -545,7 +545,7 @@ otf_drive_gdef (OTF *otf, OTF_GlyphString *gstring) int -otf_drive_gsub (OTF *otf, OTF_GlyphString *gstring, +OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring, char *script, char *language, char *features) { char *errfmt = "GSUB driving%s"; @@ -557,7 +557,7 @@ otf_drive_gsub (OTF *otf, OTF_GlyphString *gstring, int i, j; if (! otf->gsub - && otf_get_table (otf, "GSUB") < 0) + && OTF_get_table (otf, "GSUB") < 0) return -1; gsub = otf->gsub; @@ -592,7 +592,7 @@ otf_drive_gsub (OTF *otf, OTF_GlyphString *gstring, } int -otf_drive_gpos (OTF *otf, OTF_GlyphString *gstring, +OTF_drive_gpos (OTF *otf, OTF_GlyphString *gstring, char *script, char *language, char *features) { char *errfmt = "GPOS driving%s"; @@ -604,7 +604,7 @@ otf_drive_gpos (OTF *otf, OTF_GlyphString *gstring, int i, j; if (! otf->gpos - && otf_get_table (otf, "GPOS") < 0) + && OTF_get_table (otf, "GPOS") < 0) return -1; gpos = otf->gpos; @@ -639,19 +639,19 @@ otf_drive_gpos (OTF *otf, OTF_GlyphString *gstring, } int -otf_drive_tables (OTF *otf, OTF_GlyphString *gstring, +OTF_drive_tables (OTF *otf, OTF_GlyphString *gstring, char *script, char *language, char *gsub_features, char *gpos_features) { - if (otf_drive_cmap (otf, gstring) < 0) + if (OTF_drive_cmap (otf, gstring) < 0) return -1; - if (otf_drive_gdef (otf, gstring) < 0) + if (OTF_drive_gdef (otf, gstring) < 0) return -1; if ((! gsub_features || gsub_features[0]) - && otf_drive_gsub (otf, gstring, script, language, gsub_features) < 0) + && OTF_drive_gsub (otf, gstring, script, language, gsub_features) < 0) return -1; if ((! gpos_features || gpos_features[0]) - && otf_drive_gpos (otf, gstring, script, language, gpos_features) < 0) + && OTF_drive_gpos (otf, gstring, script, language, gpos_features) < 0) return -1; return 0; } diff --git a/src/otferror.c b/src/otferror.c index 9481afc..20db616 100644 --- a/src/otferror.c +++ b/src/otferror.c @@ -5,7 +5,7 @@ #include "otf.h" static char *error_message; -int otf_error; +int OTF_error; static char *error_string[] = { @@ -26,14 +26,14 @@ otf__error (int err, char *fmt, void *arg) error_message = (char *) malloc (256); sprintf (error_message, "OTF-Error (%s): ", error_string[err]); sprintf (error_message + strlen (error_message), fmt, arg); - otf_error = err; + OTF_error = err; return 0; } void -otf_perror (char *prefix) +OTF_perror (char *prefix) { - if (otf_error == 0) + if (OTF_error == 0) error_message = error_string[0]; if (prefix) fprintf (stderr, "%s: %s\n", prefix, error_message); diff --git a/src/otfopen.c b/src/otfopen.c index ad10f47..d59b0ae 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -324,12 +324,12 @@ read_header_part (OTF *otf, FILE *fp) internal_data->table_info[OTF_TABLE_TYPE_GPOS].address = (void *) &otf->gpos; internal_data->table_info[OTF_TABLE_TYPE_GPOS].reader = read_gpos_table; - head_tag = otf_tag ("head"); - name_tag = otf_tag ("name"); - cmap_tag = otf_tag ("cmap"); - gdef_tag = otf_tag ("GDEF"); - gsub_tag = otf_tag ("GSUB"); - gpos_tag = otf_tag ("GPOS"); + head_tag = OTF_tag ("head"); + name_tag = OTF_tag ("name"); + cmap_tag = OTF_tag ("cmap"); + gdef_tag = OTF_tag ("GDEF"); + gsub_tag = OTF_tag ("GSUB"); + gpos_tag = OTF_tag ("GPOS"); stream = make_stream (); if (! stream) @@ -1861,7 +1861,7 @@ read_name_table (OTF *otf, OTF_Stream *stream) /* APIs */ OTF_Tag -otf_tag (char *name) +OTF_tag (char *name) { unsigned char *p = (unsigned char *) name; @@ -1871,7 +1871,7 @@ otf_tag (char *name) } void -otf_tag_name (OTF_Tag tag, char *name) +OTF_tag_name (OTF_Tag tag, char *name) { name[0] = (char) (tag >> 24); name[1] = (char) ((tag >> 16) & 0xFF); @@ -1886,7 +1886,7 @@ otf_tag_name (OTF_Tag tag, char *name) memory previously allocated. */ OTF * -otf_open (char *otf_name) +OTF_open (char *otf_name) { FILE *fp; char *errfmt = "opening otf (%s)"; @@ -1903,7 +1903,7 @@ otf_open (char *otf_name) otf->filename = strdup (otf_name); if (! otf->filename) { - otf_close (otf); + OTF_close (otf); fclose (fp); OTF_ERROR (OTF_ERROR_MEMORY, "filename allocation"); } @@ -1921,7 +1921,7 @@ otf_open (char *otf_name) if (read_header_part (otf, fp) < 0) { - otf_close (otf); + OTF_close (otf); fclose (fp); return NULL; } @@ -1932,7 +1932,7 @@ otf_open (char *otf_name) void -otf_close (OTF *otf) +OTF_close (OTF *otf) { OTF_InternalData *internal_data = otf->internal_data; int i; @@ -1964,28 +1964,28 @@ otf_close (OTF *otf) int -otf_get_table (OTF *otf, char *name) +OTF_get_table (OTF *otf, char *name) { char *errfmt = "OTF Table Read"; int errret = -1; OTF_InternalData *internal_data = otf->internal_data; OTF_TableInfo *table_info; - OTF_Tag tag = otf_tag (name); + OTF_Tag tag = OTF_tag (name); if (! tag) OTF_ERROR (OTF_ERROR_TABLE, " (unknown)"); - if (tag == otf_tag ("head")) + if (tag == OTF_tag ("head")) table_info = internal_data->table_info + OTF_TABLE_TYPE_HEAD; - else if (tag == otf_tag ("name")) + else if (tag == OTF_tag ("name")) table_info = internal_data->table_info + OTF_TABLE_TYPE_NAME; - else if (tag == otf_tag ("cmap")) + else if (tag == OTF_tag ("cmap")) table_info = internal_data->table_info + OTF_TABLE_TYPE_CMAP; - else if (tag == otf_tag ("GDEF")) + else if (tag == OTF_tag ("GDEF")) table_info = internal_data->table_info + OTF_TABLE_TYPE_GDEF; - else if (tag == otf_tag ("GSUB")) + else if (tag == OTF_tag ("GSUB")) table_info = internal_data->table_info + OTF_TABLE_TYPE_GSUB; - else if (tag == otf_tag ("GPOS")) + else if (tag == OTF_tag ("GPOS")) table_info = internal_data->table_info + OTF_TABLE_TYPE_GPOS; else OTF_ERROR (OTF_ERROR_TABLE, " (unsupported)");