Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[makeotfexe] Correct "glyph not in font" error #698

Merged
merged 2 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions c/makeotf/makeotf_lib/build/hotpccts/featgram.g
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,13 @@ glyphClass[int named, char *gcname]>[GNode *gnode]
gcAddRange(gid, endgid, firstPart, secondPart);
}
else {
zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk);
goto fail;
hotMsg(g, hotFATAL, "aborting because of errors");
}

}
else {
zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk);
goto fail;
featMapGName2GID(g, firstPart, FALSE);
hotMsg(g, hotFATAL, "aborting because of errors");
}
zzEXIT(zztasp4);
}
Expand Down
7 changes: 3 additions & 4 deletions c/makeotf/makeotf_lib/source/hotconv/featgram.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,12 @@ char *gcname;
if (gid != 0 && endgid != 0) {
gcAddRange(gid, endgid, firstPart, secondPart);
} else {
zzFAIL(1, zzerr2, &zzMissSet, &zzMissText, &zzBadTok, &zzBadText, &zzErrk);
goto fail;
hotMsg(g, hotFATAL, "aborting because of errors");
}

} else {
zzFAIL(1, zzerr2, &zzMissSet, &zzMissText, &zzBadTok, &zzBadText, &zzErrk);
goto fail;
featMapGName2GID(g, firstPart, FALSE);
hotMsg(g, hotFATAL, "aborting because of errors");
}
zzEXIT(zztasp4);
} else {
Expand Down
6 changes: 3 additions & 3 deletions c/makeotf/makeotf_lib/source/typecomp/recode.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,10 @@ static void addWidth(recodeCtx h, Fixed width) {
width = 0;
switch (h->idType) {
case SIDType:
parseWarning(h->g, "glyph '%s' has a negative advance width. Setting width to 0.\n", sindexGetString(h->g, (SID)h->id));
parseWarning(h->g, "glyph '%s' has a negative advance width. Setting width to 0.", sindexGetString(h->g, (SID)h->id));
break;
case CIDType:
parseWarning(h->g, "glyph 'cid#%hu' has a negative advance width. Setting width to 0.\n", h->id);
parseWarning(h->g, "glyph 'cid#%hu' has a negative advance width. Setting width to 0.", h->id);
break;
default:;
}
Expand Down Expand Up @@ -4912,7 +4912,7 @@ void recodeAddNewGlyph(tcCtx g, unsigned id, unsigned fill_in_font_id, unsigned
diff = (diff > 0) ? diff : -diff;

if (diff == 1) {
parseWarning(g, "Zero width vs calculated Euro width round-off difference: %f, %d", FIX2DBL(zeroWidth), iwidth);
parseWarning(g, "Zero width vs. calculated Euro width round-off difference: %f, %d", FIX2DBL(zeroWidth), iwidth);
}
if (diff > 1) {
parseWarning(g, "Problem: Zero width of target font is not same as calculated Euro width: %f, %d", FIX2DBL(zeroWidth), iwidth);
Expand Down
6 changes: 3 additions & 3 deletions c/makeotf/source/cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1818,17 +1818,17 @@ void cbConvert(cbCtx h, int flags, char *clientVers,
if (h->fcdb.files.cnt == 0) {
{
fcdbGetRec(h->fcdb.ctx, FontName);
cbWarning(h, "Font Menu Name database is not specified or not found .[%s]", FontName);
cbWarning(h, "FontMenuNameDB file was not specified or not found. [%s]", FontName);
}
} else if (fcdbGetRec(h->fcdb.ctx, FontName)) {
{
cbWarning(h, "not in Font Menu Name database [%s]", FontName);
cbWarning(h, "not in FontMenuNameDB [%s]", FontName);
}
}

// Make sure that GOADB file has been read in, if required
if ((flags & HOT_RENAME) && (h->alias.recs.cnt < 1) && (type != hotCID)) {
cbWarning(h, "Glyph renaming is requested, but the Glyph Alias And Order DB file was not specified.");
cbWarning(h, "Glyph renaming was requested, but the GlyphOrderAndAliasDB file was not specified.");
}

h->mac.cmapScript = macScript; /* Used in hotAddmiscData, in ProcessFontInfo */
Expand Down
2 changes: 2 additions & 0 deletions tests/makeotfexe_data/input/bug492/features.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

@CLASS = [glyph_not_found a];
65 changes: 65 additions & 0 deletions tests/makeotfexe_data/input/bug492/font.pfa

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/makeotfexe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ def test_DFLT_script_with_any_lang_bug438():
'-r', r'^\s+Version.*;hotconv.*;makeotfexe'])


def test_glyph_not_in_font_bug492():
input_filename = 'bug492/font.pfa'
feat_filename = 'bug492/features.fea'
otf_path = get_temp_file_path()

stderr_path = runner(
CMD + ['-s', '-e', '-o',
'f', '_{}'.format(get_input_path(input_filename)),
'ff', '_{}'.format(get_input_path(feat_filename)),
'o', '_{}'.format(otf_path)])

with open(stderr_path, 'rb') as f:
output = f.read()
assert (b'[ERROR] <SourceSans-Test> Glyph "glyph_not_found" not in font. '
b'[') in output
assert (b'syntax error at "a" [') not in output


def test_version_warning_bug610():
input_filename = 'bug610/font.pfa'
feat_filename = 'bug610/v0005.fea'
Expand Down