Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-hadley committed May 1, 2020
2 parents 1980573 + 529dca4 commit c2378c5
Show file tree
Hide file tree
Showing 92 changed files with 11,830 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .lgtm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ extraction:
- "export PATH=\"$HOME/.local/bin:$PATH\""
index:
build_command: "python3 setup.py build"
path_classifiers:
generated:
# Classify featgram.c as generated code so that it won't get alerts:
- root/c/makeotf/makeotf_lib/source/hotconv/featgram.c
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Changelog
=========

3.3.0 (released 2020-05-01)
---------------------------
- [otf2ttf] update LSB in hmtx to match glyph xMin
([#1114](https://github.com/adobe-type-tools/afdko/pull/1114))
- [dependencies] update to latest fontTools, MutatorMath, ufonormalizer
([#1113](https://github.com/adobe-type-tools/afdko/pull/1117),
[#1120](https://github.com/adobe-type-tools/afdko/pull/1120))
- [c tools] improved robustness
([#1121](https://github.com/adobe-type-tools/afdko/pull/1121),
[#1122](https://github.com/adobe-type-tools/afdko/pull/1122),
[#1123](https://github.com/adobe-type-tools/afdko/pull/1123))
- [makeinstancesufo] add option to use varLib instead of MutatorMath
([#1126](https://github.com/adobe-type-tools/afdko/pull/1126))

3.2.1 (released 2020-03-27)
---------------------------
- [sfntedit] cleaned up help string
Expand Down
2 changes: 1 addition & 1 deletion c/makeotf/makeotf_lib/source/cffread/cffread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ static void t2Read(cffCtx h, Offset offset, int init) {
int iTop = h->stack.cnt - 1;
int iBottom = h->stack.cnt - n;

if (n < 0 || iBottom < 0) {
if (n <= 0 || iBottom < 0) {
fatal(h, "limit check (roll)");
}

Expand Down
2 changes: 1 addition & 1 deletion c/makeotf/makeotf_lib/source/hotconv/cmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void CDECL cmapMsg(hotCtx g, int msgType, char *fmt, ...) {
char msg[1024];

va_start(ap, fmt);
vsprintf(msgVar, fmt, ap);
VSPRINTF_S(msgVar, sizeof(msgVar), fmt, ap);
va_end(ap);
sprintf(msg, "cmap{plat=%u,script=%u,lang=%u}: %s", h->platformId,
h->scriptId, h->language, msgVar);
Expand Down
4 changes: 2 additions & 2 deletions c/makeotf/makeotf_lib/source/hotconv/feat.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static void CDECL zzerrVA(char *fmt, ...) {
char msg[1024];

va_start(ap, fmt);
vsprintf(msg, fmt, ap);
VSPRINTF_S(msg, sizeof(msg), fmt, ap);
va_end(ap);
zzerr(msg);
}
Expand All @@ -458,7 +458,7 @@ static void CDECL featMsg(int msgType, char *fmt, ...) {
char msg[1024];

va_start(ap, fmt);
vsprintf(msgVar, fmt, ap);
VSPRINTF_S(msgVar, sizeof(msgVar), fmt, ap);
va_end(ap);
sprintf(msg, "%s [%s %d]", msgVar, INCL.file, zzline);

Expand Down
6 changes: 5 additions & 1 deletion c/makeotf/makeotf_lib/source/hotconv/hot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,9 +1851,13 @@ void CDECL hotMsg(hotCtx g, int level, char *fmt, ...) {
#define MAX_NOTE_LEN 1024
char message[MAX_NOTE_LEN + 1024];
char *p;
size_t p_size;

p_size = sizeof(message);
if ((g->font.FontName.cnt != 0) && (lenName < MAX_NOTE_LEN)) {
sprintf(message, "<%s> ", g->font.FontName.array);
p = &message[lenName];
p_size -= lenName;
} else {
p = message;
}
Expand All @@ -1867,7 +1871,7 @@ void CDECL hotMsg(hotCtx g, int level, char *fmt, ...) {
}

va_start(ap, fmt);
vsprintf(p, fmt, ap);
VSPRINTF_S(p, p_size, fmt, ap);
va_end(ap);
g->cb.message(g->cb.ctx, level, message);
}
Expand Down
2 changes: 1 addition & 1 deletion c/makeotf/makeotf_lib/source/hotconv/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static void CDECL CMapMsg(mapCtx h, int msgType, char *fmt, ...) {
char msg[2048];

va_start(ap, fmt);
vsprintf(msgVar, fmt, ap);
VSPRINTF_S(msgVar, sizeof(msgVar), fmt, ap);
va_end(ap);
sprintf(msg, "%s [%s]", msgVar, h->ps.cb.psId ? h->ps.cb.psId(h->ps.cb.ctx) : "");

Expand Down
4 changes: 2 additions & 2 deletions c/makeotf/makeotf_lib/source/pstoken/pstoken.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ void CDECL psWarning(psCtx h, char *fmt, ...) {

/* Format message */
va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);

if (h->cb.psId != NULL) {
/* Append source data id */
Expand All @@ -816,7 +816,7 @@ void CDECL psFatal(psCtx h, char *fmt, ...) {
char text[513];

va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);

if (h->cb.psId != NULL) {
/* Append source data id */
Expand Down
1 change: 1 addition & 0 deletions c/makeotf/makeotf_lib/source/typecomp/dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ typedef dnaDCL(char, DICT);

void dictSaveInt(DICT *dict, long i);
void dictSaveNumber(DICT *dict, double d);
void dictSaveNumberAsShortInt(DICT *dict, double d);
void dictSaveT2Number(DICT *dict, double d);

#if TC_DEBUG
Expand Down
6 changes: 3 additions & 3 deletions c/makeotf/makeotf_lib/source/typecomp/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void CDECL parseWarning(tcCtx g, char *fmt, ...) {

/* Format and report message */
va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
g->cb.message(g->cb.ctx, tcWARNING, text);
va_end(ap);
}
Expand All @@ -404,7 +404,7 @@ void CDECL parseNewGlyphReport(tcCtx g, char *fmt, ...) {

/* Format and report message */
va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
g->cb.message(g->cb.ctx, tcNOTE, text);
va_end(ap);
}
Expand All @@ -423,7 +423,7 @@ void CDECL parseFatal(tcCtx g, char *fmt, ...) {

/* Format and report message */
va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
g->cb.message(ctx, tcFATAL, text);
va_end(ap);
}
Expand Down
6 changes: 3 additions & 3 deletions c/makeotf/makeotf_lib/source/typecomp/tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ void CDECL tcFatal(tcCtx g, char *fmt, ...) {
va_list ap;

va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);

if (g->cb.psId != NULL) {
/* Append source data id */
Expand All @@ -1081,7 +1081,7 @@ void CDECL tcWarning(tcCtx g, char *fmt, ...) {
va_list ap;

va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);

if (g->cb.psId != NULL) {
/* Append source data id */
Expand All @@ -1101,7 +1101,7 @@ void CDECL tcNote(tcCtx g, char *fmt, ...) {
va_list ap;

va_start(ap, fmt);
vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);

if (g->cb.psId != NULL) {
/* Append source data id */
Expand Down
4 changes: 2 additions & 2 deletions c/makeotf/source/cbpriv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void cbFatal(cbCtx h, char *fmt, ...) {
char text[512];
va_list ap;
va_start(ap, fmt);
vsnprintf(text, sizeof(text), fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
message(h, hotFATAL, text);
va_end(ap);
if (!KeepGoing) {
Expand All @@ -31,7 +31,7 @@ void cbWarning(cbCtx h, char *fmt, ...) {
char text[512];
va_list ap;
va_start(ap, fmt);
vsnprintf(text, sizeof(text), fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
message(h, hotWARNING, text);
va_end(ap);
}
2 changes: 1 addition & 1 deletion c/public/lib/api/ctlshare.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ enum {
#define SPRINTF_S(b, l, f, ...) sprintf(b, f, ##__VA_ARGS__)
#endif
#ifndef VSPRINTF_S
#define VSPRINTF_S(b, l, f, ...) vsprintf(b, f, ##__VA_ARGS__)
#define VSPRINTF_S vsnprintf
#endif
#ifndef SSCANF_S
#define SSCANF_S sscanf
Expand Down
3 changes: 1 addition & 2 deletions c/public/lib/source/cffwrite/cffwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -2281,12 +2281,11 @@ void cfwFree(cfwCtx g) {
/* Write message to debug stream from va_list. */
static void vmessage(cfwCtx g, char *fmt, va_list ap) {
char text[500];
const size_t textLen = sizeof(text);

if (g->stm.dbg == NULL) {
return; /* Debug stream not available */
}
VSPRINTF_S(text, textLen, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
(void)g->cb.stm.write(&g->cb.stm, g->stm.dbg, strlen(text), text);
}

Expand Down
6 changes: 3 additions & 3 deletions c/public/lib/source/pdfwrite/pdfwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static void CTL_CDECL dstPrint(pdwCtx h, char *fmt, ...) {
char buf[500];
va_list ap;
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
VSPRINTF_S(buf, sizeof(buf), fmt, ap);
dstWrite(h, strlen(buf), buf);
va_end(ap);
}
Expand Down Expand Up @@ -541,7 +541,7 @@ static void CTL_CDECL stmPrint(pdwCtx h, long iStm, char *fmt, ...) {
long length;
va_list ap;
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
VSPRINTF_S(buf, sizeof(buf), fmt, ap);
va_end(ap);
length = (long)strlen(buf);
memcpy(dnaEXTEND(h->stms[iStm], length), buf, length);
Expand Down Expand Up @@ -617,7 +617,7 @@ static void CTL_CDECL textShow(pdwCtx h, char *fmt, ...) {

/* Format text */
va_start(ap, fmt);
vsprintf(src, fmt, ap);
VSPRINTF_S(src, sizeof(src), fmt, ap);
va_end(ap);

/* Double backslashes */
Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/svgwrite/svgwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void CTL_CDECL writeFmt(svwCtx h, char *fmt, ...) {
char buf[200];
va_list ap;
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
VSPRINTF_S(buf, sizeof(buf), fmt, ap);
writeStr(h, buf);
va_end(ap);
}
Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/svread/svread.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static void vmessage(svrCtx h, char *fmt, va_list ap) {
if (h->stm.dbg == NULL)
return; /* Debug stream not available */

vsnprintf(text, BUFSIZ, fmt, ap);
VSPRINTF_S(text, BUFSIZ, fmt, ap);
(void)h->cb.stm.write(&h->cb.stm, h->stm.dbg, strlen(text), text);
}

Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/t1cstr/t1cstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ static int t1Decode(t1cCtx h, long offset) {
int iTop = h->stack.cnt - 1;
int iBottom = h->stack.cnt - n;

if (n < 0 || iBottom < 0)
if (n <= 0 || iBottom < 0)
return t1cErrRollBounds;

/* Constrain j to [0,n) */
Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/t1read/t1read.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void vmessage(t1rCtx h, char *fmt, va_list ap) {
if (h->stm.dbg == NULL)
return; /* Debug stream not available */

vsnprintf(text, 500, fmt, ap);
VSPRINTF_S(text, 500, fmt, ap);
(void)h->cb.stm.write(&h->cb.stm, h->stm.dbg, strlen(text), text);
}

Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/t1write/t1write.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ static void CTL_CDECL writeFmt(t1wCtx h, char *fmt, ...) {
char buf[200];
va_list ap;
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
VSPRINTF_S(buf, sizeof(buf), fmt, ap);
writeStr(h, buf);
va_end(ap);
}
Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/ttread/ttread.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static void vmessage(ttrCtx h, char *fmt, va_list ap) {
if (h->stm.dbg == NULL)
return; /* Debug stream not available */

vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
(void)h->cb.stm.write(&h->cb.stm, h->stm.dbg, strlen(text), text);
}

Expand Down
2 changes: 1 addition & 1 deletion c/public/lib/source/uforead/uforead.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static void vmessage(ufoCtx h, char* fmt, va_list ap) {
if (h->stm.dbg == NULL)
return; /* Debug stream not available */

vsprintf(text, fmt, ap);
VSPRINTF_S(text, sizeof(text), fmt, ap);
(void)h->cb.stm.write(&h->cb.stm, h->stm.dbg, strlen(text), text);
}

Expand Down
2 changes: 1 addition & 1 deletion c/spot/source/t13supp.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ static void t13Read(cffCtx h, Offset offset, int init, int csLen) {
int iTop = h->stack.cnt - 1;
int iBottom = h->stack.cnt - n;

if (n < 0 || iBottom < 0)
if (n <= 0 || iBottom < 0)
fatal(h, "limit check (roll)");

/* Constrain j to [0,n) */
Expand Down
10 changes: 8 additions & 2 deletions python/afdko/makeinstancesufo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from afdko.ufotools import validateLayers


__version__ = '2.4.2'
__version__ = '2.4.3'

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -301,7 +301,7 @@ def run(options):
ufoProcessorBuild(documentPath=dsPath,
outputUFOFormatVersion=options.ufo_version,
roundGeometry=(not options.no_round),
logger=logger)
logger=logger, useVarlib=options.useVarlib)

# Remove temporary designspace file
if (dsPath != options.dsPath) and os.path.exists(dsPath):
Expand Down Expand Up @@ -410,6 +410,12 @@ def get_options(args):
action='store_false',
help='do NOT normalize the instances'
)
parser.add_argument(
'--use-varlib',
dest='useVarlib',
action='store_false',
help='Use varLib instead of MutatorMath'
)
parser.add_argument(
'-r',
'--no-round',
Expand Down
8 changes: 8 additions & 0 deletions python/afdko/otf2ttf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ def glyphs_to_quadratic(
return quadGlyphs


def update_hmtx(ttFont, glyf):
hmtx = ttFont["hmtx"]
for glyphName, glyph in glyf.glyphs.items():
if hasattr(glyph, 'xMin'):
hmtx[glyphName] = (hmtx[glyphName][0], glyph.xMin)


@singledispatch
def otf_to_ttf(ttFont, post_format=POST_FORMAT, **kwargs):
if ttFont.sfntVersion != "OTTO":
Expand All @@ -56,6 +63,7 @@ def otf_to_ttf(ttFont, post_format=POST_FORMAT, **kwargs):
if "VORG" in ttFont:
del ttFont["VORG"]
glyf.compile(ttFont)
update_hmtx(ttFont, glyf)

ttFont["maxp"] = maxp = newTable("maxp")
maxp.tableVersion = 0x00010000
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ booleanOperations==0.9.0
cu2qu[cli]==1.6.7
defcon[lxml,pens]==0.6.0
fontMath==0.5.2
fontTools[woff,unicode,ufo,lxml]==4.5.0
mutatorMath==2.1.2
fontTools[woff,ufo,unicode,lxml]==4.8.1
mutatorMath==3.0.1
psautohint==2.0.1
ufonormalizer==0.3.6
ufonormalizer==0.4.1
ufoProcessor==1.9.0
Loading

0 comments on commit c2378c5

Please sign in to comment.