Skip to content

Commit

Permalink
Merge commit '0f778252c4840ec13261b9ff0e0b085c14d2af4f' into fix-bug4…
Browse files Browse the repository at this point in the history
…94-tx
  • Loading branch information
readroberts committed Aug 9, 2018
2 parents 41a74c1 + 0f77825 commit 74e3c09
Show file tree
Hide file tree
Showing 14 changed files with 549 additions and 425 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ before_build:
- cpplint --recursive --quiet c\detype1
- cpplint --recursive --quiet c\makeotf\makeotf_lib\source\cffread
- cpplint --recursive --quiet c\makeotf\makeotf_lib\source\hotconv
- cpplint --recursive --quiet c\type1

# to run your custom scripts instead of automatic MSBuild
build_script:
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ matrix:
- cpplint --recursive --quiet c/detype1
- cpplint --recursive --quiet c/makeotf/makeotf_lib/source/cffread
- cpplint --recursive --quiet c/makeotf/makeotf_lib/source/hotconv
- cpplint --recursive --quiet c/type1
script:
- python setup.py bdist_wheel
- deactivate
Expand Down
13 changes: 9 additions & 4 deletions c/detype1/source/detype1.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,7 @@ static void detype1(FILE *fp1, FILE *fp2) {
*/

static void usage(void) {
fprintf(stderr, "usage: detype1 [font [text]]\n");
exit(1);
printf("usage: detype1 [font [text]]\n");
}

#ifndef _MSC_VER /* unix */
Expand Down Expand Up @@ -593,10 +592,14 @@ int getopt(int argc, char **argv, char *opstring) {

int main(int argc, char *argv[]) {
int c;
while ((c = getopt(argc, argv, "?uh")) != EOF)
while ((c = getopt(argc, argv, "h")) != EOF)
switch (c) {
case 'h':
usage();
exit(0);
default:
usage();
exit(1);
}
if (optind == argc) {
#if _MSC_VER
Expand Down Expand Up @@ -633,7 +636,9 @@ int main(int argc, char *argv[]) {
detype1(fp1, fp2);
fclose(fp1);
fclose(fp2);
} else
} else {
usage();
return 1;
}
return 0;
}
30 changes: 21 additions & 9 deletions c/spot/source/CFF_.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ static char *syntheticGlyphs[]={"Delta","Euro", "Omega" ,"approxequal", "asciici

static Byte8 *workstr = NULL;

#if _WIN32
#define round round_double
static double round_double( double r )
{
/* I return double as this is mostly used to round values for float or double printf format specifiers,
and since I hope to remove this code soon when we move to VS 2017, it is less work to do an extra cast here
than change all the printf format statements.
*/
return (double)((int)((r > 0.0) ? (r + 0.5) : (r - 0.5)));
}
#endif

static void CFFfatal(void *ctx)
{
fatal(SPOT_MSG_CFFPARSING);
Expand Down Expand Up @@ -406,9 +418,9 @@ static void drawText(GlyphId glyphId, IntX lsb, IntX rsb, IntX width)
sprintf(workstr, "318 96 moveto (BBox: min = %.0f, %.0f max = %.0f, %.0f) show\n"
"318 84 moveto "
"(SideBearings: L = %.0f R = %.0f Width = %.0f) show\n",
OUTPUT(h, cffgi->bbox.left), OUTPUT(v, cffgi->bbox.bottom),
OUTPUT(h, cffgi->bbox.right), OUTPUT(v, cffgi->bbox.top),
OUTPUT(h, lsb), OUTPUT(h, rsb), OUTPUT(h, width));
round(OUTPUT(h, cffgi->bbox.left)), round(OUTPUT(v, cffgi->bbox.bottom)),
round(OUTPUT(h, cffgi->bbox.right)), round(OUTPUT(v, cffgi->bbox.top)),
round(OUTPUT(h, lsb)), round(OUTPUT(h, rsb)), round(OUTPUT(h, width)));
proofPSOUT(cffproofctx, workstr);
workstr[0] = '\0';
sprintf(workstr, "318 72 moveto "
Expand Down Expand Up @@ -526,14 +538,14 @@ static void newPage(IntX page)
sprintf(workstr, "(Widths: %.0f units/em [%s] ) show\n"
"%g (%hu) stringwidth pop sub %g moveto (%hu) show\n"
"/Helvetica-Narrow findfont %d scalefont setfont\n",
OUTPUT(h, unitsPerEm), synopsis.title,
round(OUTPUT(h, unitsPerEm)), synopsis.title,
PAGE_WIDTH, synopsis.page, PAGE_HEIGHT + 9, synopsis.page,
TEXT_SIZE);
else
sprintf(workstr, "(CFF:%s head vers: %.3f Widths: %.0f units/em %s) show\n"
"%g (%hu) stringwidth pop sub %g moveto (%hu) show\n"
"/Helvetica-Narrow findfont %d scalefont setfont\n",
shortfilename, fontRevision, OUTPUT(h, unitsPerEm), date,
shortfilename, fontRevision, round(OUTPUT(h, unitsPerEm)), date,
PAGE_WIDTH, synopsis.page, PAGE_HEIGHT + 9, synopsis.page,
TEXT_SIZE);
}
Expand Down Expand Up @@ -704,15 +716,15 @@ static void drawTic(IntX marks, Pelt A)
{
workstr[0] = '\0';
sprintf(workstr, "(%.0f %.0f) stringwidth pop neg %g rmoveto\n",
OUTPUT(h, Bx), OUTPUT(v, By), y);
round(OUTPUT(h, Bx)), round(OUTPUT(v, By)), y);
proofPSOUT(cffproofctx, workstr);
}

workstr[0] = '\0';
sprintf(workstr, "(%.0f %.0f) show\n"
"0 setlinewidth stroke\n"
"grestore %% tic\n",
OUTPUT(h, Bx), OUTPUT(v, By));
round(OUTPUT(h, Bx)), round(OUTPUT(v, By)));
proofPSOUT(cffproofctx, workstr);
}
}
Expand Down Expand Up @@ -1158,8 +1170,8 @@ int CFF_DrawTile(GlyphId glyphId, Byte8 *code)
workstr[0] = '\0';
sprintf(workstr, "closepath 0 setlinewidth stroke\n"
"%g (%.0f) stringwidth pop sub %g moveto (%.0f) show\n",
synopsis.hTile + TILE_WIDTH - 1, OUTPUT(h, width),
synopsis.vTile - (TEXT_BASE + 1), OUTPUT(h, width));
synopsis.hTile + TILE_WIDTH - 1, round(OUTPUT(h, width)),
synopsis.vTile - (TEXT_BASE + 1), round(OUTPUT(h, width)));
proofPSOUT(cffproofctx, workstr);

/* Draw [code/]glyphId */
Expand Down
Loading

0 comments on commit 74e3c09

Please sign in to comment.