summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c1258
1 files changed, 629 insertions, 629 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
index 91dcfeee028..afbf08520d4 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
@@ -35,7 +35,10 @@
#define FONT_GLYPHS_METATABLE "fontloader.splinefont.glyphs"
#define FONT_GLYPH_METATABLE "fontloader.splinefont.glyph"
-#define LUA_OTF_VERSION "0.4"
+#define LUA_OTF_VERSION "0.5"
+
+extern void normal_error(const char *t, const char *p);
+extern void formatted_error(const char *t, const char *fmt, ...);
static const char *possub_type_enum[] = {
"null", "position", "pair", "substitution",
@@ -276,6 +279,7 @@ static int ff_close(lua_State * L)
return 0;
}
+/*
static int notdef_loc(SplineFont * sf)
{
int k;
@@ -291,6 +295,20 @@ static int notdef_loc(SplineFont * sf)
l = sf->glyphcnt;
return l;
}
+*/
+
+static int notdef_loc(SplineFont * sf)
+{
+ int k;
+ for (k = 0; k < sf->glyphcnt; k++) {
+ if (sf->glyphs[k]) {
+ if (strcmp(sf->glyphs[k]->name, ".notdef") == 0) {
+ return k ;
+ }
+ }
+ }
+ return -1;
+}
static int ff_apply_featurefile(lua_State * L)
{
@@ -323,15 +341,15 @@ static int ff_apply_afmfile(lua_State * L)
fname = luaL_checkstring(L, 2);
CheckAfmOfPostscript(*sf, fname, (*sf)->map);
if (gww_error_count > 0) {
- int i;
- lua_newtable(L);
- for (i = 0; i < gww_error_count; i++) {
- lua_pushstring(L, gww_errors[i]);
- lua_rawseti(L, -2, (i + 1));
- }
- gwwv_errors_free();
+ int i;
+ lua_newtable(L);
+ for (i = 0; i < gww_error_count; i++) {
+ lua_pushstring(L, gww_errors[i]);
+ lua_rawseti(L, -2, (i + 1));
+ }
+ gwwv_errors_free();
} else {
- lua_pushnil(L);
+ lua_pushnil(L);
}
return 1;
}
@@ -594,8 +612,6 @@ static int do_handle_lookup(lua_State * L, struct otlookup *lookup, SplineFont *
}
lua_setfield(L, -2, "flags");
-
-
dump_stringfield(L, "name", lookup->lookup_name);
if (lookup->features != NULL) {
@@ -967,9 +983,6 @@ static void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvm
lua_pushnumber(L, glyph->ymax);
lua_rawset(L, -3);
lua_setfield(L, -2, "boundingbox");
- if (glyph->orig_pos>=0) {
- dump_intfield(L,"orig_pos",glyph->orig_pos);
-}
if (hasvmetrics) {
dump_intfield(L, "vwidth", glyph->vwidth);
if (glyph->tsb != 0)
@@ -1205,31 +1218,17 @@ static void handle_pfminfo(lua_State * L, struct pfminfo pfm)
dump_intfield(L, "firstchar", pfm.firstchar);
dump_intfield(L, "lastchar", pfm.lastchar);
lua_createtable(L, 0, 10);
- dump_enumfield(L, "familytype",
- fix_range(panose_values_0_max, pfm.panose[0]),
- panose_values_0);
- dump_enumfield(L, "serifstyle",
- fix_range(panose_values_1_max, pfm.panose[1]),
- panose_values_1);
- dump_enumfield(L, "weight", fix_range(panose_values_2_max, pfm.panose[2]),
- panose_values_2);
- dump_enumfield(L, "proportion",
- fix_range(panose_values_3_max, pfm.panose[3]),
- panose_values_3);
- dump_enumfield(L, "contrast", fix_range(panose_values_4_max, pfm.panose[4]),
- panose_values_4);
- dump_enumfield(L, "strokevariation",
- fix_range(panose_values_5_max, pfm.panose[5]),
- panose_values_5);
- dump_enumfield(L, "armstyle", fix_range(panose_values_6_max, pfm.panose[6]),
- panose_values_6);
- dump_enumfield(L, "letterform",
- fix_range(panose_values_7_max, pfm.panose[7]),
- panose_values_7);
- dump_enumfield(L, "midline", fix_range(panose_values_8_max, pfm.panose[8]),
- panose_values_8);
- dump_enumfield(L, "xheight", fix_range(panose_values_9_max, pfm.panose[9]),
- panose_values_9);
+
+ dump_enumfield(L, "familytype", fix_range(panose_values_0_max, pfm.panose[0]), panose_values_0);
+ dump_enumfield(L, "serifstyle", fix_range(panose_values_1_max, pfm.panose[1]), panose_values_1);
+ dump_enumfield(L, "weight", fix_range(panose_values_2_max, pfm.panose[2]), panose_values_2);
+ dump_enumfield(L, "proportion", fix_range(panose_values_3_max, pfm.panose[3]), panose_values_3);
+ dump_enumfield(L, "contrast", fix_range(panose_values_4_max, pfm.panose[4]), panose_values_4);
+ dump_enumfield(L, "strokevariation", fix_range(panose_values_5_max, pfm.panose[5]), panose_values_5);
+ dump_enumfield(L, "armstyle", fix_range(panose_values_6_max, pfm.panose[6]), panose_values_6);
+ dump_enumfield(L, "letterform", fix_range(panose_values_7_max, pfm.panose[7]), panose_values_7);
+ dump_enumfield(L, "midline", fix_range(panose_values_8_max, pfm.panose[8]), panose_values_8);
+ dump_enumfield(L, "xheight", fix_range(panose_values_9_max, pfm.panose[9]), panose_values_9);
lua_setfield(L, -2, "panose");
dump_intfield(L, "fstype", pfm.fstype);
@@ -1325,8 +1324,7 @@ static char *do_handle_enc(lua_State * L, struct enc *enc)
dump_cond_intfield(L, "is_simplechinese", enc->is_simplechinese);
if (enc->iso_2022_escape_len > 0) {
- dump_lstringfield(L, "iso_2022_escape", enc->iso_2022_escape,
- enc->iso_2022_escape_len);
+ dump_lstringfield(L, "iso_2022_escape", enc->iso_2022_escape, enc->iso_2022_escape_len);
}
dump_intfield(L, "low_page", enc->low_page);
dump_intfield(L, "high_page", enc->high_page);
@@ -1366,9 +1364,11 @@ static void handle_encmap(lua_State * L, struct encmap *map, int notdef_loc)
if (map->map[i] != -1) {
int l = map->map[i];
lua_pushnumber(L, i);
+ /*
if (l < notdef_loc)
lua_pushnumber(L, (l + 1));
else
+ */
lua_pushnumber(L, l);
lua_rawset(L, -3);
}
@@ -1379,13 +1379,12 @@ static void handle_encmap(lua_State * L, struct encmap *map, int notdef_loc)
if (map->backmax > 0 && map->backmap != NULL) {
lua_newtable(L);
for (i = 0; i < map->backmax; i++) {
- if (map->backmap[i] != -1) { /* TODO: check this, because valgrind sometimes says
- "Conditional jump or move depends on uninitialised value(s)"
- needs a test file.
- */
+ if (map->backmap[i] != -1) {
+ /*
if (i < notdef_loc)
lua_pushnumber(L, (i + 1));
else
+ */
lua_pushnumber(L, i);
lua_pushnumber(L, map->backmap[i]);
lua_rawset(L, -3);
@@ -1399,7 +1398,7 @@ static void handle_encmap(lua_State * L, struct encmap *map, int notdef_loc)
lua_newtable(L);
encname = do_handle_enc(L, map->enc);
lua_setfield(L, -2, "enc");
- lua_pushstring(L, encname);
+ lua_pushstring(L, encname);
lua_setfield(L, -2, "enc_name");
}
}
@@ -1438,13 +1437,12 @@ static void handle_ttflangname(lua_State * L, struct ttflangname *names)
static void do_handle_anchorclass(lua_State * L, struct anchorclass *anchor)
{
-
dump_stringfield(L, "name", anchor->name);
dump_subtable_name(L, "lookup", anchor->subtable);
dump_enumfield(L, "type", anchor->type, anchorclass_type_enum);
- /* uint8 has_base; */
- /* uint8 processed, has_mark, matches, ac_num; */
- /* uint8 ticked; */
+ /* uint8 has_base; */
+ /* uint8 processed, has_mark, matches, ac_num; */
+ /* uint8 ticked; */
}
static void handle_anchorclass(lua_State * L, struct anchorclass *anchor)
@@ -1473,19 +1471,19 @@ static int do_handle_kernclass(lua_State * L, struct kernclass *kerns, const cha
int k;
int match = 0;
if (name) {
- struct lookup_subtable *s = kerns->subtable;
- while (s != NULL) {
- if (strcmp(s->subtable_name,name)==0) {
- match = 1;
- break;
- }
+ struct lookup_subtable *s = kerns->subtable;
+ while (s != NULL) {
+ if (strcmp(s->subtable_name,name)==0) {
+ match = 1;
+ break;
+ }
s = s->next;
- }
+ }
} else {
- match = 1;
+ match = 1;
}
if (!match) {
- return 0;
+ return 0;
}
lua_checkstack(L, 4);
lua_createtable(L, kerns->first_cnt, 1);
@@ -1507,7 +1505,6 @@ static int do_handle_kernclass(lua_State * L, struct kernclass *kerns, const cha
if (!name) {
dump_subtable_name(L, "lookup", kerns->subtable);
}
-
lua_createtable(L, kerns->second_cnt * kerns->first_cnt, 1);
for (k = 0; k < (kerns->second_cnt * kerns->first_cnt); k++) {
if (kerns->offsets[k] != 0) {
@@ -1622,7 +1619,9 @@ static void handle_fpst_rule(lua_State * L, struct fpst_rule *rule, int format)
}
lua_setfield(L, -2, "lookups");
} else {
- /*fprintf(stderr,"handle_fpst_rule(): No lookups?\n"); */
+ /*
+ fprintf(stderr,"handle_fpst_rule(): No lookups?\n");
+ */
}
}
@@ -1901,7 +1900,7 @@ static void handle_mmset(lua_State * L, struct mmset *mm)
static void handle_splinefont(lua_State * L, struct splinefont *sf)
{
int k;
- int fix_notdef = 0;
+ int fix_notdef = 0; /* obsolete */
int l = -1;
dump_stringfield(L, "table_version", LUA_OTF_VERSION);
@@ -1918,6 +1917,7 @@ static void handle_splinefont(lua_State * L, struct splinefont *sf)
dump_floatfield(L, "uwidth", sf->uwidth);
dump_intfield(L, "ascent", sf->ascent);
dump_intfield(L, "descent", sf->descent);
+ dump_intfield(L, "notdef_loc",notdef_loc(sf));
if (sf->uniqueid!=0) {
dump_intfield(L, "uniqueid", sf->uniqueid);
}
@@ -1943,13 +1943,19 @@ static void handle_splinefont(lua_State * L, struct splinefont *sf)
/* This after-the-fact type discovery is not brilliant,
I should really add a 'format' key in the structure */
+
+ /*
if ((sf->origname != NULL) &&
(strmatch(sf->origname + strlen(sf->origname) - 4, ".pfa") == 0 ||
strmatch(sf->origname + strlen(sf->origname) - 4, ".pfb") == 0)) {
fix_notdef = 1;
}
+ */
if (fix_notdef) {
+
+ /* this is obsolete */
+
/* some code to ensure that the .notdef ends up in slot 0
(this will actually be enforced by the CFF writer) */
for (k = 0; k < sf->glyphcnt; k++) {
@@ -2249,7 +2255,7 @@ static void do_ff_info(lua_State * L, SplineFont * sf)
dump_stringfield(L, "weight", sf->weight);
dump_intfield(L, "units_per_em", sf->units_per_em);
- /* These are not assigned in info... */
+
/*dump_intfield(L, "design_range_bottom", sf->design_range_bottom);*/
/*dump_intfield(L, "design_range_top", sf->design_range_top);*/
/*dump_intfield(L, "design_size", sf->design_size);*/
@@ -2259,6 +2265,7 @@ static void do_ff_info(lua_State * L, SplineFont * sf)
lua_setfield(L, -2, "pfminfo");
/* Do we need this ? */
+
if (sf->names != NULL) {
lua_newtable(L);
handle_ttflangname(L, sf->names);
@@ -2317,7 +2324,7 @@ typedef enum {
FK_vkerns,
FK_gsub,
FK_gpos,
- /* FK_sm, */ /*this was removed because AAT is not supported anymore*/
+ /* FK_sm, */ /* AAT is not supported anymore */
FK_features,
FK_mm,
FK_chosenname,
@@ -2339,6 +2346,7 @@ typedef enum {
FK_horiz_base,
FK_vert_base,
FK_extrema_bound,
+ FK_notdef_loc,
} font_key_values;
const char *font_keys[] = {
@@ -2413,10 +2421,10 @@ const char *font_keys[] = {
"horiz_base",
"vert_base",
"extrema_bound",
+ "notdef_loc",
NULL
};
-
typedef enum {
GK_name = 0,
GK_unicode,
@@ -2441,7 +2449,6 @@ typedef enum {
GK_vert_variants,
GK_horiz_variants,
GK_mathkern,
- GK_orig_pos,
} font_glyph_key_values;
const char *font_glyph_keys[] = {
@@ -2468,7 +2475,6 @@ const char *font_glyph_keys[] = {
"vert_variants",
"horiz_variants",
"mathkern",
- "orig_pos",
NULL
};
@@ -2500,7 +2506,7 @@ static int ff_glyphs_index(lua_State * L)
SplineFont *sf;
int gid = 0;
int l = -1;
- int fix_notdef = 0;
+ int fix_notdef = 0; /* obsolete */
lua_pushstring(L, "__sf");
lua_rawget(L, 1);
/* sf = *check_isfont(L, -1); */
@@ -2518,21 +2524,27 @@ static int ff_glyphs_index(lua_State * L)
}
/* This after-the-fact type discovery is not brilliant,
I should really add a 'format' key in the structure */
+ /*
if ((sf->origname != NULL) &&
(strmatch(sf->origname + strlen(sf->origname) - 4, ".pfa") == 0 ||
strmatch(sf->origname + strlen(sf->origname) - 4, ".pfb") == 0)) {
fix_notdef = 1;
}
+ */
/* some code to ensure that the .notdef ends up in slot 0
(this will actually be enforced by the CFF writer) */
if (fix_notdef) {
+ /* this is obsolete */
l = notdef_loc(sf);
/* now l is the .notdef location, adjust gid if needed */
- if (l == sf->glyphcnt) { /* no .notdef at all, will be created at zero */
+ if (l == sf->glyphcnt) {
+ /* no .notdef at all, will be created at zero */
if (gid == 0) {
- gid = l; /* .notdef was added at end */
+ /* we ask for .notdef but .notdef was added at end */
+ gid = l;
} else {
- gid--; /* f.glyphs[gid] == sf->glyphs[gid-1] */
+ /* f.glyphs[gid] == sf->glyphs[gid-1] */
+ gid--;
}
} else if (l != 0) {
if (gid == 0) {
@@ -2542,11 +2554,11 @@ static int ff_glyphs_index(lua_State * L)
}
}
}
- /* push the glyph */
+
if (sf->glyphs[gid] && sf->glyphs[gid] != (struct splinechar *)-1) {
lua_ff_pushglyph(L, sf->glyphs[gid]);
} else {
- lua_pushnil(L);
+ lua_pushnil(L);
}
return 1;
}
@@ -2564,175 +2576,167 @@ static int ff_glyph_index(lua_State * L)
}
key = luaL_checkoption(L, 2, NULL, font_glyph_keys);
switch (key) {
- case GK_name:
- lua_pushstring(L, glyph->name);
- break;
- case GK_unicode:
- lua_pushnumber(L, glyph->unicodeenc);
- break;
- case GK_boundingbox:
- if (glyph->xmax == 0 && glyph->ymax == 0 && glyph->xmin == 0
- && glyph->ymin == 0) {
- DBounds bb;
- SplineCharFindBounds(glyph, &bb);
- glyph->xmin = bb.minx;
- glyph->ymin = bb.miny;
- glyph->xmax = bb.maxx;
- glyph->ymax = bb.maxy;
- }
- lua_createtable(L, 4, 0);
- lua_pushnumber(L, 1);
- lua_pushnumber(L, glyph->xmin);
- lua_rawset(L, -3);
- lua_pushnumber(L, 2);
- lua_pushnumber(L, glyph->ymin);
- lua_rawset(L, -3);
- lua_pushnumber(L, 3);
- lua_pushnumber(L, glyph->xmax);
- lua_rawset(L, -3);
- lua_pushnumber(L, 4);
- lua_pushnumber(L, glyph->ymax);
- lua_rawset(L, -3);
- break;
- case GK_vwidth:
- lua_pushnumber(L, glyph->vwidth);
- break;
- case GK_width:
- lua_pushnumber(L, glyph->width);
- break;
- case GK_lsidebearing:
- lua_pushnumber(L, glyph->lsidebearing);
- break;
- case GK_class:
- if (glyph->glyph_class > 0) {
- lua_pushstring(L, glyph_class_enum[glyph->glyph_class]);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_kerns:
- if (glyph->kerns != NULL) {
- lua_newtable(L);
- handle_kernpair(L, glyph->kerns);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_vkerns:
- if (glyph->vkerns != NULL) {
- lua_newtable(L);
- handle_kernpair(L, glyph->vkerns);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_dependents:
- if (glyph->dependents != NULL) {
- lua_newtable(L);
- handle_splinecharlist(L, glyph->dependents);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_lookups:
- if (glyph->possub != NULL) {
- lua_newtable(L);
- handle_generic_pst(L, glyph->possub);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_ligatures:
- if (glyph->ligofme != NULL) {
- lua_newtable(L);
- handle_liglist(L, glyph->ligofme);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_comment:
- lua_pushstring(L, glyph->comment);
- break;
- case GK_anchors:
- if (glyph->anchor != NULL) {
- lua_newtable(L);
- handle_anchorpoint(L, glyph->anchor);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_altuni:
- if (glyph->altuni != NULL) {
- lua_newtable(L);
- handle_altuni(L, glyph->altuni);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_tex_height:
- if (glyph->tex_height != TEX_UNDEF) {
- lua_pushnumber(L, glyph->tex_height);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_tex_depth:
- if (glyph->tex_height != TEX_UNDEF) {
- lua_pushnumber(L, glyph->tex_depth);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_is_extended_shape:
- lua_pushnumber(L, glyph->is_extended_shape);
- break;
- case GK_italic_correction:
- if (glyph->italic_correction != TEX_UNDEF) {
- lua_pushnumber(L, glyph->italic_correction);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_top_accent:
- if (glyph->top_accent_horiz != TEX_UNDEF) {
- lua_pushnumber(L, glyph->top_accent_horiz);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_vert_variants:
- if (glyph->vert_variants != NULL) {
- lua_newtable(L);
- handle_glyphvariants(L, glyph->vert_variants);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_horiz_variants:
- if (glyph->horiz_variants != NULL) {
- lua_newtable(L);
- handle_glyphvariants(L, glyph->horiz_variants);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_mathkern:
- if (glyph->mathkern != NULL) {
- lua_newtable(L);
- handle_mathkern(L, glyph->mathkern);
- } else {
- lua_pushnil(L);
- }
- break;
- case GK_orig_pos:
- if (glyph->orig_pos>=0) {
- lua_pushnumber(L, glyph->orig_pos);
- } else {
+ case GK_name:
+ lua_pushstring(L, glyph->name);
+ break;
+ case GK_unicode:
+ lua_pushnumber(L, glyph->unicodeenc);
+ break;
+ case GK_boundingbox:
+ if (glyph->xmax == 0 && glyph->ymax == 0 && glyph->xmin == 0 && glyph->ymin == 0) {
+ DBounds bb;
+ SplineCharFindBounds(glyph, &bb);
+ glyph->xmin = bb.minx;
+ glyph->ymin = bb.miny;
+ glyph->xmax = bb.maxx;
+ glyph->ymax = bb.maxy;
+ }
+ lua_createtable(L, 4, 0);
+ lua_pushnumber(L, 1);
+ lua_pushnumber(L, glyph->xmin);
+ lua_rawset(L, -3);
+ lua_pushnumber(L, 2);
+ lua_pushnumber(L, glyph->ymin);
+ lua_rawset(L, -3);
+ lua_pushnumber(L, 3);
+ lua_pushnumber(L, glyph->xmax);
+ lua_rawset(L, -3);
+ lua_pushnumber(L, 4);
+ lua_pushnumber(L, glyph->ymax);
+ lua_rawset(L, -3);
+ break;
+ case GK_vwidth:
+ lua_pushnumber(L, glyph->vwidth);
+ break;
+ case GK_width:
+ lua_pushnumber(L, glyph->width);
+ break;
+ case GK_lsidebearing:
+ lua_pushnumber(L, glyph->lsidebearing);
+ break;
+ case GK_class:
+ if (glyph->glyph_class > 0) {
+ lua_pushstring(L, glyph_class_enum[glyph->glyph_class]);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_kerns:
+ if (glyph->kerns != NULL) {
+ lua_newtable(L);
+ handle_kernpair(L, glyph->kerns);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_vkerns:
+ if (glyph->vkerns != NULL) {
+ lua_newtable(L);
+ handle_kernpair(L, glyph->vkerns);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_dependents:
+ if (glyph->dependents != NULL) {
+ lua_newtable(L);
+ handle_splinecharlist(L, glyph->dependents);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_lookups:
+ if (glyph->possub != NULL) {
+ lua_newtable(L);
+ handle_generic_pst(L, glyph->possub);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_ligatures:
+ if (glyph->ligofme != NULL) {
+ lua_newtable(L);
+ handle_liglist(L, glyph->ligofme);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_comment:
+ lua_pushstring(L, glyph->comment);
+ break;
+ case GK_anchors:
+ if (glyph->anchor != NULL) {
+ lua_newtable(L);
+ handle_anchorpoint(L, glyph->anchor);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_altuni:
+ if (glyph->altuni != NULL) {
+ lua_newtable(L);
+ handle_altuni(L, glyph->altuni);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_tex_height:
+ if (glyph->tex_height != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->tex_height);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_tex_depth:
+ if (glyph->tex_height != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->tex_depth);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_is_extended_shape:
+ lua_pushnumber(L, glyph->is_extended_shape);
+ break;
+ case GK_italic_correction:
+ if (glyph->italic_correction != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->italic_correction);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_top_accent:
+ if (glyph->top_accent_horiz != TEX_UNDEF) {
+ lua_pushnumber(L, glyph->top_accent_horiz);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_vert_variants:
+ if (glyph->vert_variants != NULL) {
+ lua_newtable(L);
+ handle_glyphvariants(L, glyph->vert_variants);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_horiz_variants:
+ if (glyph->horiz_variants != NULL) {
+ lua_newtable(L);
+ handle_glyphvariants(L, glyph->horiz_variants);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case GK_mathkern:
+ if (glyph->mathkern != NULL) {
+ lua_newtable(L);
+ handle_mathkern(L, glyph->mathkern);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ default:
lua_pushnil(L);
- }
- break;
- default:
- lua_pushnil(L);
}
return 1;
}
@@ -2742,12 +2746,10 @@ static int ff_index(lua_State * L)
SplineFont *sf;
int k, key;
/* sf = *check_isfont(L, 1); */
- if (!(is_userdata(L, 1, FONT_METATABLE) ||
- is_userdata(L, 1, FONT_SUBFONT_METATABLE))) {
+ if (!(is_userdata(L, 1, FONT_METATABLE) || is_userdata(L, 1, FONT_SUBFONT_METATABLE))) {
return luaL_error(L, "fontloader.__index: expected a (sub)font userdata object\n");
}
sf = *((SplineFont **)lua_touserdata(L, 1));
-
if (sf == NULL) {
lua_pushnil(L);
return 1;
@@ -2757,400 +2759,403 @@ static int ff_index(lua_State * L)
}
key = luaL_checkoption(L, 2, NULL, font_keys);
switch (key) {
- case FK_table_version:
- lua_pushstring(L, LUA_OTF_VERSION);
- break;
- case FK_fontname:
- lua_pushstring(L, sf->fontname);
- break;
- case FK_fullname:
- lua_pushstring(L, sf->fullname);
- break;
- case FK_familyname:
- lua_pushstring(L, sf->familyname);
- break;
- case FK_weight:
- lua_pushstring(L, sf->weight);
- break;
- case FK_copyright:
- lua_pushstring(L, sf->copyright);
- break;
- case FK_filename:
- lua_pushstring(L, sf->filename);
- break;
- case FK_version:
- lua_pushstring(L, sf->version);
- break;
- case FK_italicangle:
- lua_pushnumber(L, sf->italicangle);
- break;
- case FK_upos:
- lua_pushnumber(L, sf->upos);
- break;
- case FK_uwidth:
- lua_pushnumber(L, sf->uwidth);
- break;
- case FK_ascent:
- lua_pushnumber(L, sf->ascent);
- break;
- case FK_descent:
- lua_pushnumber(L, sf->descent);
- break;
- case FK_uniqueid:
- lua_pushnumber(L, sf->uniqueid);
- break;
- case FK_glyphcnt:
- if (sf->glyphcnt > 0) {
- lua_pushnumber(L, sf->glyphmax - sf->glyphmin + 1);
- } else {
- lua_pushnumber(L, 0);
- }
- break;
- case FK_glyphmax:
- lua_pushnumber(L, sf->glyphmax - 1);
- break;
- case FK_glyphmin:
- lua_pushnumber(L, sf->glyphmin);
- break;
- case FK_units_per_em:
- lua_pushnumber(L, sf->units_per_em);
- break;
- case FK_lookups:
- if (sf->possub != NULL) {
- lua_newtable(L);
- handle_generic_fpst(L, sf->possub);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_glyphs:
- lua_newtable(L); /* the virtual glyph table */
- lua_pushstring(L, "__sf");
- lua_pushvalue(L, 1); /* that is our font */
- lua_rawset(L, -3);
- luaL_getmetatable(L, FONT_GLYPHS_METATABLE);
- lua_setmetatable(L, -2); /* assign the metatable */
- break;
- case FK_hasvmetrics:
- lua_pushnumber(L, sf->hasvmetrics);
- break;
- case FK_onlybitmaps:
- lua_pushnumber(L, sf->onlybitmaps);
- break;
- case FK_serifcheck:
- lua_pushnumber(L, sf->serifcheck);
- break;
- case FK_isserif:
- lua_pushnumber(L, sf->isserif);
- break;
- case FK_issans:
- lua_pushnumber(L, sf->issans);
- break;
- case FK_encodingchanged:
- lua_pushnumber(L, sf->encodingchanged);
- break;
- case FK_strokedfont:
- lua_pushnumber(L, sf->strokedfont);
- break;
- case FK_use_typo_metrics:
- lua_pushnumber(L, sf->use_typo_metrics);
- break;
- case FK_weight_width_slope_only:
- lua_pushnumber(L, sf->weight_width_slope_only);
- break;
- case FK_head_optimized_for_cleartype:
- lua_pushnumber(L, sf->head_optimized_for_cleartype);
- break;
- case FK_uni_interp:
- lua_pushstring(L, uni_interp_enum[(sf->uni_interp + 1)]);
- break;
- case FK_map:
- if (sf->map != NULL) {
- lua_newtable(L);
- handle_encmap(L, sf->map, notdef_loc(sf));
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_origname:
- lua_pushstring(L, sf->origname);
- break;
- case FK_private:
- if (sf->private != NULL) {
- lua_newtable(L);
- handle_psdict(L, sf->private);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_xuid:
- lua_pushstring(L, sf->xuid);
- break;
- case FK_pfminfo:
- lua_createtable(L, 0, 40);
- handle_pfminfo(L, sf->pfminfo);
- break;
- case FK_names:
- if (sf->names != NULL) {
- lua_newtable(L);
- handle_ttflangname(L, sf->names);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_cidinfo:
- lua_createtable(L, 0, 4);
- dump_stringfield(L, "registry", sf->cidregistry);
- dump_stringfield(L, "ordering", sf->ordering);
- dump_intfield(L, "version", sf->cidversion);
- dump_intfield(L, "supplement", sf->supplement);
- break;
- case FK_subfonts:
- if (sf->subfontcnt > 0) {
- lua_createtable(L, sf->subfontcnt, 0);
- for (k = 0; k < sf->subfontcnt; k++) {
- lua_ff_pushsubfont(L, sf->subfonts[k]);
- lua_rawseti(L, -2, (k + 1));
+ case FK_table_version:
+ lua_pushstring(L, LUA_OTF_VERSION);
+ break;
+ case FK_fontname:
+ lua_pushstring(L, sf->fontname);
+ break;
+ case FK_fullname:
+ lua_pushstring(L, sf->fullname);
+ break;
+ case FK_familyname:
+ lua_pushstring(L, sf->familyname);
+ break;
+ case FK_weight:
+ lua_pushstring(L, sf->weight);
+ break;
+ case FK_copyright:
+ lua_pushstring(L, sf->copyright);
+ break;
+ case FK_filename:
+ lua_pushstring(L, sf->filename);
+ break;
+ case FK_version:
+ lua_pushstring(L, sf->version);
+ break;
+ case FK_italicangle:
+ lua_pushnumber(L, sf->italicangle);
+ break;
+ case FK_upos:
+ lua_pushnumber(L, sf->upos);
+ break;
+ case FK_uwidth:
+ lua_pushnumber(L, sf->uwidth);
+ break;
+ case FK_ascent:
+ lua_pushnumber(L, sf->ascent);
+ break;
+ case FK_descent:
+ lua_pushnumber(L, sf->descent);
+ break;
+ case FK_uniqueid:
+ lua_pushnumber(L, sf->uniqueid);
+ break;
+ case FK_glyphcnt:
+ if (sf->glyphcnt > 0) {
+ lua_pushnumber(L, sf->glyphmax - sf->glyphmin + 1);
+ } else {
+ lua_pushnumber(L, 0);
}
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_comments:
- lua_pushstring(L, sf->comments);
- break;
- case FK_fontlog:
- lua_pushstring(L, sf->fontlog);
- break;
- case FK_cvt_names:
- if (sf->cvt_names != NULL) {
- lua_newtable(L);
- for (k = 0; sf->cvt_names[k] != END_CVT_NAMES; ++k) {
- lua_pushstring(L, sf->cvt_names[k]);
- lua_rawseti(L, -2, (k + 1));
+ break;
+ case FK_glyphmax:
+ lua_pushnumber(L, sf->glyphmax - 1);
+ break;
+ case FK_glyphmin:
+ lua_pushnumber(L, sf->glyphmin);
+ break;
+ case FK_units_per_em:
+ lua_pushnumber(L, sf->units_per_em);
+ break;
+ case FK_lookups:
+ if (sf->possub != NULL) {
+ lua_newtable(L);
+ handle_generic_fpst(L, sf->possub);
+ } else {
+ lua_pushnil(L);
}
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_ttf_tables:
- if (sf->ttf_tables != NULL) {
- lua_newtable(L);
- handle_ttf_table(L, sf->ttf_tables);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_ttf_tab_saved:
- if (sf->ttf_tab_saved != NULL) {
- lua_newtable(L);
- handle_ttf_table(L, sf->ttf_tab_saved);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_texdata:
- if (sf->texdata.type != tex_unset) {
- lua_newtable(L);
- dump_enumfield(L, "type", sf->texdata.type, tex_type_enum);
- lua_newtable(L);
- for (k = 0; k < 22; k++) {
- lua_pushnumber(L, k);
- lua_pushnumber(L, sf->texdata.params[k]);
- lua_rawset(L, -3);
+ break;
+ case FK_glyphs:
+ lua_newtable(L); /* the virtual glyph table */
+ lua_pushstring(L, "__sf");
+ lua_pushvalue(L, 1); /* that is our font */
+ lua_rawset(L, -3);
+ luaL_getmetatable(L, FONT_GLYPHS_METATABLE);
+ lua_setmetatable(L, -2); /* assign the metatable */
+ break;
+ case FK_hasvmetrics:
+ lua_pushnumber(L, sf->hasvmetrics);
+ break;
+ case FK_onlybitmaps:
+ lua_pushnumber(L, sf->onlybitmaps);
+ break;
+ case FK_serifcheck:
+ lua_pushnumber(L, sf->serifcheck);
+ break;
+ case FK_isserif:
+ lua_pushnumber(L, sf->isserif);
+ break;
+ case FK_issans:
+ lua_pushnumber(L, sf->issans);
+ break;
+ case FK_encodingchanged:
+ lua_pushnumber(L, sf->encodingchanged);
+ break;
+ case FK_strokedfont:
+ lua_pushnumber(L, sf->strokedfont);
+ break;
+ case FK_use_typo_metrics:
+ lua_pushnumber(L, sf->use_typo_metrics);
+ break;
+ case FK_weight_width_slope_only:
+ lua_pushnumber(L, sf->weight_width_slope_only);
+ break;
+ case FK_head_optimized_for_cleartype:
+ lua_pushnumber(L, sf->head_optimized_for_cleartype);
+ break;
+ case FK_uni_interp:
+ lua_pushstring(L, uni_interp_enum[(sf->uni_interp + 1)]);
+ break;
+ case FK_map:
+ if (sf->map != NULL) {
+ lua_newtable(L);
+ handle_encmap(L, sf->map, 0); /* notdef_loc(sf)); */
+ } else {
+ lua_pushnil(L);
}
- lua_setfield(L, -2, "params");
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_anchor_classes:
- if (sf->anchor != NULL) {
- lua_newtable(L);
- handle_anchorclass(L, sf->anchor);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_kerns:
- if (sf->kerns != NULL) {
- lua_newtable(L);
- handle_kernclass(L, sf->kerns, NULL);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_vkerns:
- if (sf->vkerns != NULL) {
- lua_newtable(L);
- handle_kernclass(L, sf->vkerns, NULL);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_gsub:
- if (sf->gsub_lookups != NULL) {
- lua_newtable(L);
- handle_lookup(L, sf->gsub_lookups, sf);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_gpos:
- if (sf->gpos_lookups != NULL) {
- lua_newtable(L);
- handle_lookup(L, sf->gpos_lookups, sf);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_mm:
- if (sf->mm != NULL) {
- lua_newtable(L);
- handle_mmset(L, sf->mm);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_chosenname:
- lua_pushstring(L, sf->chosenname);
- break;
- case FK_macstyle:
- lua_pushnumber(L, sf->macstyle);
- break;
- case FK_fondname:
- lua_pushstring(L, sf->fondname);
- break;
- case FK_design_size:
- lua_pushnumber(L, sf->design_size);
- break;
- case FK_fontstyle_id:
- lua_pushnumber(L, sf->fontstyle_id);
- break;
- case FK_fontstyle_name:
- if (sf->fontstyle_name != NULL) {
- lua_newtable(L);
- handle_otfname(L, sf->fontstyle_name);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_design_range_bottom:
- lua_pushnumber(L, sf->design_range_bottom);
- break;
- case FK_design_range_top:
- lua_pushnumber(L, sf->design_range_top);
- break;
- case FK_strokewidth:
- lua_pushnumber(L, sf->strokewidth);
- break;
- case FK_mark_classes:
- if (sf->mark_class_cnt > 0) {
- lua_newtable(L);
- for (k = 0; k < sf->mark_class_cnt; k++) {
- if (sf->mark_class_names[k] != NULL) {
- lua_pushstring(L, sf->mark_class_names[k]);
- lua_pushstring(L, sf->mark_classes[k]);
+ break;
+ case FK_origname:
+ lua_pushstring(L, sf->origname);
+ break;
+ case FK_private:
+ if (sf->private != NULL) {
+ lua_newtable(L);
+ handle_psdict(L, sf->private);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_xuid:
+ lua_pushstring(L, sf->xuid);
+ break;
+ case FK_pfminfo:
+ lua_createtable(L, 0, 40);
+ handle_pfminfo(L, sf->pfminfo);
+ break;
+ case FK_names:
+ if (sf->names != NULL) {
+ lua_newtable(L);
+ handle_ttflangname(L, sf->names);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_cidinfo:
+ lua_createtable(L, 0, 4);
+ dump_stringfield(L, "registry", sf->cidregistry);
+ dump_stringfield(L, "ordering", sf->ordering);
+ dump_intfield(L, "version", sf->cidversion);
+ dump_intfield(L, "supplement", sf->supplement);
+ break;
+ case FK_subfonts:
+ if (sf->subfontcnt > 0) {
+ lua_createtable(L, sf->subfontcnt, 0);
+ for (k = 0; k < sf->subfontcnt; k++) {
+ lua_ff_pushsubfont(L, sf->subfonts[k]);
+ lua_rawseti(L, -2, (k + 1));
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_comments:
+ lua_pushstring(L, sf->comments);
+ break;
+ case FK_fontlog:
+ lua_pushstring(L, sf->fontlog);
+ break;
+ case FK_cvt_names:
+ if (sf->cvt_names != NULL) {
+ lua_newtable(L);
+ for (k = 0; sf->cvt_names[k] != END_CVT_NAMES; ++k) {
+ lua_pushstring(L, sf->cvt_names[k]);
+ lua_rawseti(L, -2, (k + 1));
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_ttf_tables:
+ if (sf->ttf_tables != NULL) {
+ lua_newtable(L);
+ handle_ttf_table(L, sf->ttf_tables);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_ttf_tab_saved:
+ if (sf->ttf_tab_saved != NULL) {
+ lua_newtable(L);
+ handle_ttf_table(L, sf->ttf_tab_saved);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_texdata:
+ if (sf->texdata.type != tex_unset) {
+ lua_newtable(L);
+ dump_enumfield(L, "type", sf->texdata.type, tex_type_enum);
+ lua_newtable(L);
+ for (k = 0; k < 22; k++) {
+ lua_pushnumber(L, k);
+ lua_pushnumber(L, sf->texdata.params[k]);
lua_rawset(L, -3);
}
+ lua_setfield(L, -2, "params");
+ } else {
+ lua_pushnil(L);
}
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_creationtime:
- lua_pushnumber(L, sf->creationtime);
- break;
- case FK_modificationtime:
- lua_pushnumber(L, sf->modificationtime);
- break;
- case FK_os2_version:
- lua_pushnumber(L, sf->os2_version);
- break;
- case FK_sfd_version:
- lua_pushnumber(L, sf->sfd_version);
- break;
- case FK_math:
- if (sf->MATH != NULL) {
- lua_newtable(L);
- handle_MATH(L, sf->MATH);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_validation_state:
- if (sf->loadvalidation_state != 0) {
- int val, st;
- lua_newtable(L);
- val = 1;
- st = sf->loadvalidation_state;
- if (st & lvs_bad_ps_fontname) {
- lua_pushliteral(L, "bad_ps_fontname");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_anchor_classes:
+ if (sf->anchor != NULL) {
+ lua_newtable(L);
+ handle_anchorclass(L, sf->anchor);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_glyph_table) {
- lua_pushliteral(L, "bad_glyph_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_kerns:
+ if (sf->kerns != NULL) {
+ lua_newtable(L);
+ handle_kernclass(L, sf->kerns, NULL);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_cff_table) {
- lua_pushliteral(L, "bad_cff_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_vkerns:
+ if (sf->vkerns != NULL) {
+ lua_newtable(L);
+ handle_kernclass(L, sf->vkerns, NULL);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_metrics_table) {
- lua_pushliteral(L, "bad_metrics_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_gsub:
+ if (sf->gsub_lookups != NULL) {
+ lua_newtable(L);
+ handle_lookup(L, sf->gsub_lookups, sf);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_cmap_table) {
- lua_pushliteral(L, "bad_cmap_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_gpos:
+ if (sf->gpos_lookups != NULL) {
+ lua_newtable(L);
+ handle_lookup(L, sf->gpos_lookups, sf);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_bitmaps_table) {
- lua_pushliteral(L, "bad_bitmaps_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_mm:
+ if (sf->mm != NULL) {
+ lua_newtable(L);
+ handle_mmset(L, sf->mm);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_gx_table) {
- lua_pushliteral(L, "bad_gx_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_chosenname:
+ lua_pushstring(L, sf->chosenname);
+ break;
+ case FK_macstyle:
+ lua_pushnumber(L, sf->macstyle);
+ break;
+ case FK_fondname:
+ lua_pushstring(L, sf->fondname);
+ break;
+ case FK_design_size:
+ lua_pushnumber(L, sf->design_size);
+ break;
+ case FK_fontstyle_id:
+ lua_pushnumber(L, sf->fontstyle_id);
+ break;
+ case FK_fontstyle_name:
+ if (sf->fontstyle_name != NULL) {
+ lua_newtable(L);
+ handle_otfname(L, sf->fontstyle_name);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_ot_table) {
- lua_pushliteral(L, "bad_ot_table");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_design_range_bottom:
+ lua_pushnumber(L, sf->design_range_bottom);
+ break;
+ case FK_design_range_top:
+ lua_pushnumber(L, sf->design_range_top);
+ break;
+ case FK_strokewidth:
+ lua_pushnumber(L, sf->strokewidth);
+ break;
+ case FK_mark_classes:
+ if (sf->mark_class_cnt > 0) {
+ lua_newtable(L);
+ for (k = 0; k < sf->mark_class_cnt; k++) {
+ if (sf->mark_class_names[k] != NULL) {
+ lua_pushstring(L, sf->mark_class_names[k]);
+ lua_pushstring(L, sf->mark_classes[k]);
+ lua_rawset(L, -3);
+ }
+ }
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_os2_version) {
- lua_pushliteral(L, "bad_os2_version");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_creationtime:
+ lua_pushnumber(L, sf->creationtime);
+ break;
+ case FK_modificationtime:
+ lua_pushnumber(L, sf->modificationtime);
+ break;
+ case FK_os2_version:
+ lua_pushnumber(L, sf->os2_version);
+ break;
+ case FK_sfd_version:
+ lua_pushnumber(L, sf->sfd_version);
+ break;
+ case FK_math:
+ if (sf->MATH != NULL) {
+ lua_newtable(L);
+ handle_MATH(L, sf->MATH);
+ } else {
+ lua_pushnil(L);
}
- if (st & lvs_bad_sfnt_header) {
- lua_pushliteral(L, "bad_sfnt_header");
- lua_rawseti(L, -2, val++);
+ break;
+ case FK_validation_state:
+ if (sf->loadvalidation_state != 0) {
+ int val, st;
+ lua_newtable(L);
+ val = 1;
+ st = sf->loadvalidation_state;
+ if (st & lvs_bad_ps_fontname) {
+ lua_pushliteral(L, "bad_ps_fontname");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_glyph_table) {
+ lua_pushliteral(L, "bad_glyph_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_cff_table) {
+ lua_pushliteral(L, "bad_cff_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_metrics_table) {
+ lua_pushliteral(L, "bad_metrics_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_cmap_table) {
+ lua_pushliteral(L, "bad_cmap_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_bitmaps_table) {
+ lua_pushliteral(L, "bad_bitmaps_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_gx_table) {
+ lua_pushliteral(L, "bad_gx_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_ot_table) {
+ lua_pushliteral(L, "bad_ot_table");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_os2_version) {
+ lua_pushliteral(L, "bad_os2_version");
+ lua_rawseti(L, -2, val++);
+ }
+ if (st & lvs_bad_sfnt_header) {
+ lua_pushliteral(L, "bad_sfnt_header");
+ lua_rawseti(L, -2, val++);
+ }
+ } else {
+ lua_pushnil(L);
}
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_horiz_base:
- if (sf->horiz_base != NULL) {
- lua_newtable(L);
- handle_base(L, sf->horiz_base);
- } else {
- lua_pushnil(L);
- }
- break;
- case FK_vert_base:
- if (sf->vert_base != NULL) {
- lua_newtable(L);
- handle_base(L, sf->vert_base);
- } else {
+ break;
+ case FK_horiz_base:
+ if (sf->horiz_base != NULL) {
+ lua_newtable(L);
+ handle_base(L, sf->horiz_base);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_vert_base:
+ if (sf->vert_base != NULL) {
+ lua_newtable(L);
+ handle_base(L, sf->vert_base);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
+ case FK_extrema_bound:
+ lua_pushnumber(L, sf->extrema_bound);
+ break;
+ case FK_notdef_loc:
+ lua_pushinteger(L, notdef_loc(sf));
+ break;
+ default:
+ /* can't actually happen, |luaL_checkoption| raises an error instead */
lua_pushnil(L);
- }
- break;
- case FK_extrema_bound:
- lua_pushnumber(L, sf->extrema_bound);
- break;
- default:
- /* can't actually happen, |luaL_checkoption| raises an error instead */
- lua_pushnil(L);
- break;
+ break;
}
return 1;
}
@@ -3232,10 +3237,7 @@ static void ff_do_cff(SplineFont * sf, char *filename, unsigned char **buf,
fclose(f);
return;
}
- /* snprintf(errmsg, 255, "%s => CFF, failed", sf->filename); */
- /* normal_error("fontloader",errmsg); */ /* TODO */
- fprintf(stdout,"%s => CFF, failed", sf->filename);
- exit(EXIT_FAILURE);
+ formatted_error("fontloader","%s to CFF conversion failed", sf->filename);
}
/* exported for writecff.c */
@@ -3273,9 +3275,7 @@ int ff_get_ttc_index(char *ffname, char *psname)
sf = ReadSplineFontInfo((char *) ffname, openflags);
if (sf == NULL) {
- /* normal_error("fontloader","font loading failed unexpectedly"); */ /* TODO */
- fprintf(stdout,"font loading failed unexpectedly\n");
- exit(EXIT_FAILURE);
+ normal_error("fontloader","font loading failed unexpectedly");
}
while (sf != NULL) {
if (strcmp(sf->fontname, psname) == 0) {
@@ -3285,7 +3285,7 @@ int ff_get_ttc_index(char *ffname, char *psname)
sf = sf->next;
}
if (index>=0)
- return (i-index-1);
+ return (i-index-1);
return -1;
}