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 Apr 16, 2016
2 parents 831111d + 0a97ee8 commit 9f1a3e5
Show file tree
Hide file tree
Showing 86 changed files with 6,077 additions and 4,947 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
*.app

build/
bin/
.vscode/
_test
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ The `otfcc` is a C library and utility used for parsing and writing OpenType fon

## Key features

* Read a OpenType font; (TrueType is supported as well)
* Write a OpenType font;
* Read an OpenType font, (TrueType is supported as well)
* And dump its data into JSON.
* Or parse a dump of an OpenType font,
* And build an OpenType font according to it.

## `otfcc` command line tool
## Usage

### `otfccdump` : Dump an OpenType font file into JSON
```
Expand All @@ -22,9 +24,12 @@ otfccdump [OPTIONS] input.[otf|ttf|ttc]
--time : Time each substep.
--ignore-glyph-order : Do not export glyph order information.
--ignore-hints : Do not export hingint information.
--add-bom : Add BOM mark in the output. (This is default
on Windows when redirecting to another program.
Use --no-bom to turn it off.)
```

### `otfccbuild` : Build an OpenType font file form JSON
### `otfccbuild` : Build an OpenType font file from JSON
```
otfccbuild [OPTIONS] input.json -o output.[ttf|otf]
Expand All @@ -43,3 +48,43 @@ otfccbuild [OPTIONS] input.json -o output.[ttf|otf]
some Microsoft applications, a DSIG is required
to enable OpenType features.
```

## Building

`otfcc` can be built on a number of platforms. It uses the [premake](http://premake.github.io/) build system.

It was developed and optimized for Clang/LLVM, therefore it is *strongly* recommended to compile with Clang/LLVM, but if that's not possible GCC is also supported, GCC version 5.1 or later being the preferred choice for performance.

### Windows

On Windows building `otfcc` is tested under the toolchains listed below. The default `premake5 vs2015` will produce a Visual Studio solution using Clang-CL as its compiler.

* GCC 5.1 included in `TDM-GCC`. Run the following from the command line:

```bash
premake5 gmake
cd build
make
```

* [Visual C++ Building Tools (Mar 2016)](https://blogs.msdn.microsoft.com/vcblog/2016/03/31/announcing-the-official-release-of-the-visual-c-build-tools-2015/) with [Clang/LLVM 3.8](http://clang.llvm.org/). Only Release build is tested. Run the following from the Visual C++ Command Prompt:

```bat
premake5 vs2015
msbuild build\otfcc.sln /property:Configuration=Release
```

### Linux

On Linux, Either Clang/LLVM or GCC can be used to build `otfcc`.

1. Install the latest Clang/LLVM or GCC if you do not have it already.
2. Download and install [premake5](http://premake.github.io/) for Linux and make it available in your path.
3. Run the following from the command line:

```bash
premake5 gmake
cd build
make
```

2 changes: 2 additions & 0 deletions _vcbuild32.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@CALL "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86
@msbuild build\vs\otfcc.sln /m:%NUMBER_OF_PROCESSORS% /nr:false /nologo /verbosity:minimal %*
2 changes: 2 additions & 0 deletions _vcbuild64.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@CALL "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
@msbuild build\vs\otfcc.sln /m:%NUMBER_OF_PROCESSORS% /nr:false /nologo /verbosity:minimal %*
File renamed without changes.
File renamed without changes.
32 changes: 29 additions & 3 deletions extern/json.c → dep/extern/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,21 @@ json_value * json_parse_ex (json_settings * settings,
json_char error [json_error_max];
const json_char * end;
json_value * top, * root, * alloc = 0;
json_state state = { 0 };
json_state state;
state.used_memory = 0;
state.uint_max = 0;
state.ulong_max = 0;
state.settings.max_memory = 0;
state.settings.mem_alloc = NULL;
state.settings.mem_free = NULL;
state.settings.settings = 0;
state.settings.user_data = NULL;
state.settings.value_extra = 0;
state.first_pass = 0;
state.ptr = NULL;
state.cur_col = 0;
state.cur_line = 0;

long flags;
long num_digits = 0, num_e = 0;
json_int_t num_fraction = 0;
Expand Down Expand Up @@ -948,7 +962,13 @@ json_value * json_parse_ex (json_settings * settings,

json_value * json_parse (const json_char * json, size_t length)
{
json_settings settings = { 0 };
json_settings settings;
settings.max_memory = 0;
settings.settings = 0;
settings.mem_alloc = NULL;
settings.mem_free = NULL;
settings.user_data = NULL;
settings.value_extra = 0;
return json_parse_ex (&settings, json, length, 0);
}

Expand Down Expand Up @@ -1006,7 +1026,13 @@ void json_value_free_ex (json_settings * settings, json_value * value)

void json_value_free (json_value * value)
{
json_settings settings = { 0 };
json_settings settings;
settings.max_memory = 0;
settings.settings = 0;
settings.mem_alloc = NULL;
settings.mem_free = NULL;
settings.user_data = NULL;
settings.value_extra = 0;
settings.mem_free = default_free;
json_value_free_ex (&settings, value);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9f1a3e5

Please sign in to comment.