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

[tx] fix handling of missing glyph names with the dump option #964

Merged
merged 1 commit into from
Sep 20, 2019
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
5 changes: 4 additions & 1 deletion c/public/lib/source/absfont/absfont_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ static int glyphBeg(abfGlyphCallbacks *cb, abfGlyphInfo *info) {
else {
/* Dump name-keyed glyph */
abfEncoding *enc = &info->encoding;
FPRINTF_S(h->fp, "%s", info->gname.ptr);
if (info->gname.ptr == NULL)
FPRINTF_S(h->fp, "(missing)");
else
FPRINTF_S(h->fp, "%s", info->gname.ptr);
if (enc->code == ABF_GLYPH_UNENC)
FPRINTF_S(h->fp, ",-");
else {
Expand Down
29 changes: 29 additions & 0 deletions tests/tx_data/expected_output/pr905.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Filename pr905.otf
## Top Dict
version "1.0"
Notice " 2014 - 2017 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name Source. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries."
Copyright " 2014 - 2017 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name Source."
FullName "Test VF"
FamilyName "Test VF"
FontBBox {5,0,697,675}
FSType 0
sup.srcFontType CFF (name-keyed)
sup.nGlyphs 4
## FontDict[0]
FontName "TestVF-Roman"
## Private
BlueValues {-15,0,474,487,527,540,550,563,647,660,670,685,730,750}
OtherBlues {-250,-240}
FamilyBlues {-15,0,475,488,527,540,549,563,646,659,669,684,729,749}
FamilyOtherBlues {-249,-239}
BlueScale 0.0375
BlueFuzz 0
StdHW 55
StdVW 80
StemSnapH {40,55}
StemSnapV {80,90}
## glyph[tag] {name,encoding}
glyph[0] {(missing),-}
glyph[1] {(missing),U+0041}
glyph[2] {(missing),U+0054}
glyph[3] {(missing),U+043C}
4 changes: 3 additions & 1 deletion tests/tx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def test_drop_defaultwidthx_when_writing_cff2_bug897(option):
assert differ([expected_path, dcf_path])


@pytest.mark.parametrize('option', ['afm', 'svg'])
@pytest.mark.parametrize('option', ['afm', 'dump', 'svg'])
def test_missing_glyph_names_pr905(option):
input_path = get_bad_input_path('pr905.otf')
output_path = get_temp_file_path()
Expand All @@ -872,6 +872,8 @@ def test_missing_glyph_names_pr905(option):
if option == 'afm':
skip = ['-s',
'Comment Creation Date:' + SPLIT_MARKER + 'Comment Copyright']
elif option == 'dump':
skip = ['-s', '## Filename']
else:
skip = []
assert differ([expected_path, output_path] + skip)
Expand Down