Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into releases
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Sep 6, 2016
2 parents 5086d45 + 60a473d commit c8a194d
Show file tree
Hide file tree
Showing 148 changed files with 3,543 additions and 3,428 deletions.
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,43 @@ otfccdump [OPTIONS] input.[otf|ttf|ttc]
```
Usage : otfccbuild [OPTIONS] [input.json] -o output.[ttf|otf]
input.json : Path to input file. When absent the input will
be read from the STDIN.
input.json : Path to input file. When absent the input will be
read from the STDIN.
-h, --help : Display this help message and exit.
-v, --version : Display version information and exit.
-o <file> : Set output file path to <file>.
-s, --dummy-dsig : Include an empty DSIG table in the font. For some
Microsoft applications, DSIG is required to enable
OpenType features.
-O<n> : Specify the level for optimization.
-O0 Turn off any optimization.
-O1 Default optimization.
-O2 More aggressive optimizations for web font. In this
level, the following options will be set:
--ignore-glyph-order
--short-post
--merge-features
--time : Time each substep.
--ignore-glyph-order : Ignore the glyph order information in the input.
--verbose : Show more information when building.
--ignore-hints : Ignore the hinting information in the input.
--keep-average-char-width : Keep the OS/2.xAvgCharWidth value from the input
instead of stating the average width of glyphs.
Useful when creating a monospaced font.
--keep-modified-time : Keep the head.modified time in the json, instead
of using current time.
--short-post : Don't export glyph names in the result font. It
will reduce file size.
--dummy-dsig, -s : Include an empty DSIG table in the font. For
some Microsoft applications, a DSIG is required
to enable OpenType features.
-O<n> : Specify the level for optimization.
-O0 Turn off any optimization.
-O1 Default optimization.
-O2 More aggressive optimizations for web font. In
this level, the --ignore-glyph-order and
--short-post will be turned on.
--keep-unicode-ranges : Keep the OS/2.ulUnicodeRange[1-4] as-is.
--keep-modified-time : Keep the head.modified time in the json, instead of
using current time.
--short-post : Don't export glyph names in the result font.
--ignore-glyph-order : Ignore the glyph order information in the input.
--keep-glyph-order : Keep the glyph order information in the input.
Use to preserve glyph order under -O2 and -O3.
--dont-ignore-glyph-order : Same as --keep-glyph-order.
--merge-features : Merge duplicate OpenType feature definitions.
--dont-merge-features : Keep duplicate OpenType feature definitions.
--merge-lookups : Merge duplicate OpenType lookups.
--dont-merge-lookups : Keep duplicate OpenType lookups.
```

## Building
Expand Down
46 changes: 23 additions & 23 deletions lib/bk/bkblock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "bkblock.h"

static void bkblock_acells(caryll_bkblock *b, uint32_t len) {
static void bkblock_acells(bk_Block *b, uint32_t len) {
if (len <= b->length + b->free) {
// We have enough space
b->free -= len - b->length;
Expand All @@ -10,47 +10,47 @@ static void bkblock_acells(caryll_bkblock *b, uint32_t len) {
b->length = len;
b->free = (len >> 1) & 0xFFFFFF;
if (b->cells) {
b->cells = realloc(b->cells, sizeof(bk_cell) * (b->length + b->free));
b->cells = realloc(b->cells, sizeof(bk_Cell) * (b->length + b->free));
} else {
b->cells = malloc(sizeof(bk_cell) * (b->length + b->free));
b->cells = malloc(sizeof(bk_Cell) * (b->length + b->free));
}
}
}
bool bk_cell_is_ptr(bk_cell *cell) {
bool bk_cellIsPointer(bk_Cell *cell) {
return cell->t >= p16;
}

static bk_cell *bkblock_grow(caryll_bkblock *b, uint32_t len) {
static bk_Cell *bkblock_grow(bk_Block *b, uint32_t len) {
uint32_t olen = b->length;
bkblock_acells(b, olen + len);
return &(b->cells[olen]);
}

caryll_bkblock *_bkblock_init() {
caryll_bkblock *b = calloc(1, sizeof(caryll_bkblock));
bk_Block *_bkblock_init() {
bk_Block *b = calloc(1, sizeof(bk_Block));
bkblock_acells(b, 0);
return b;
}

void bkblock_pushint(caryll_bkblock *b, bk_cell_type type, uint32_t x) {
bk_cell *cell = bkblock_grow(b, 1);
void bkblock_pushint(bk_Block *b, bk_CellType type, uint32_t x) {
bk_Cell *cell = bkblock_grow(b, 1);
cell->t = type;
cell->z = x;
}
void bkblock_pushptr(caryll_bkblock *b, bk_cell_type type, caryll_bkblock *p) {
bk_cell *cell = bkblock_grow(b, 1);
void bkblock_pushptr(bk_Block *b, bk_CellType type, bk_Block *p) {
bk_Cell *cell = bkblock_grow(b, 1);
cell->t = type;
cell->p = p;
}

static void vbkpushitems(caryll_bkblock *b, bk_cell_type type0, va_list ap) {
bk_cell_type curtype = type0;
static void vbkpushitems(bk_Block *b, bk_CellType type0, va_list ap) {
bk_CellType curtype = type0;
while (curtype) {
if (curtype == bkcopy || curtype == bkembed) {
caryll_bkblock *par = va_arg(ap, caryll_bkblock *);
bk_Block *par = va_arg(ap, bk_Block *);
if (par && par->cells) {
for (uint32_t j = 0; j < par->length; j++) {
if (bk_cell_is_ptr(par->cells + j)) {
if (bk_cellIsPointer(par->cells + j)) {
bkblock_pushptr(b, par->cells[j].t, par->cells[j].p);
} else {
bkblock_pushint(b, par->cells[j].t, par->cells[j].z);
Expand All @@ -65,44 +65,44 @@ static void vbkpushitems(caryll_bkblock *b, bk_cell_type type0, va_list ap) {
uint32_t par = va_arg(ap, int);
bkblock_pushint(b, curtype, par);
} else {
caryll_bkblock *par = va_arg(ap, caryll_bkblock *);
bk_Block *par = va_arg(ap, bk_Block *);
bkblock_pushptr(b, curtype, par);
}
curtype = va_arg(ap, int);
}
}

caryll_bkblock *new_bkblock(bk_cell_type type0, ...) {
bk_Block *bk_new_Block(bk_CellType type0, ...) {
va_list ap;
va_start(ap, type0);
caryll_bkblock *b = _bkblock_init();
bk_Block *b = _bkblock_init();
vbkpushitems(b, type0, ap);
va_end(ap);
return b;
}

caryll_bkblock *bkblock_push(caryll_bkblock *b, bk_cell_type type0, ...) {
bk_Block *bk_push(bk_Block *b, bk_CellType type0, ...) {
va_list ap;
va_start(ap, type0);
vbkpushitems(b, type0, ap);
va_end(ap);
return b;
}

caryll_bkblock *new_bkblock_from_buffer(/*MOVE*/ caryll_buffer *buf) {
caryll_bkblock *b = new_bkblock(bkover);
bk_Block *bk_newBlockFromBuffer(/*MOVE*/ caryll_buffer *buf) {
bk_Block *b = bk_new_Block(bkover);
for (size_t j = 0; j < buf->size; j++) {
bkblock_pushint(b, b8, buf->data[j]);
}
buffree(buf);
return b;
}

void print_bkblock(caryll_bkblock *b) {
void bk_printBlock(bk_Block *b) {
fprintf(stderr, "Block size %08x\n", (uint32_t)b->length);
fprintf(stderr, "------------------\n");
for (uint32_t j = 0; j < b->length; j++) {
if (bk_cell_is_ptr(b->cells + j)) {
if (bk_cellIsPointer(b->cells + j)) {
if (b->cells[j].p) {
fprintf(stderr, " %3d %p[%d]\n", b->cells[j].t, b->cells[j].p, b->cells[j].p->_index);
} else {
Expand Down
22 changes: 11 additions & 11 deletions lib/bk/bkblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ typedef enum {
sp32 = 0x81, // 32-bit offset, p = pointer to block, marked as compact
bkcopy = 0xFE, // Embed another block
bkembed = 0xFF // Embed another block
} bk_cell_type;
} bk_CellType;
typedef enum { VISIT_WHITE, VISIT_GRAY, VISIT_BLACK } bk_cell_visit_state;

typedef struct {
bk_cell_type t;
bk_CellType t;
union {
uint32_t z;
struct __caryll_bkblock *p;
};
} bk_cell;
} bk_Cell;

typedef struct __caryll_bkblock {
bk_cell_visit_state _visitstate;
Expand All @@ -37,14 +37,14 @@ typedef struct __caryll_bkblock {
uint32_t _depth;
uint32_t length;
uint32_t free;
bk_cell *cells;
} caryll_bkblock;
bk_Cell *cells;
} bk_Block;

caryll_bkblock *_bkblock_init();
caryll_bkblock *new_bkblock(bk_cell_type type0, ...);
caryll_bkblock *bkblock_push(caryll_bkblock *b, bk_cell_type type0, ...);
caryll_bkblock *new_bkblock_from_buffer(/*MOVE*/ caryll_buffer *buf);
bool bk_cell_is_ptr(bk_cell *cell);
void print_bkblock(caryll_bkblock *b);
bk_Block *_bkblock_init();
bk_Block *bk_new_Block(bk_CellType type0, ...);
bk_Block *bk_push(bk_Block *b, bk_CellType type0, ...);
bk_Block *bk_newBlockFromBuffer(/*MOVE*/ caryll_buffer *buf);
bool bk_cellIsPointer(bk_Cell *cell);
void bk_printBlock(bk_Block *b);

#endif
Loading

0 comments on commit c8a194d

Please sign in to comment.