Skip to content

Commit

Permalink
add custom font documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbostic committed Apr 20, 2018
1 parent ea4e8c3 commit d2e65d4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions docs/clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,51 @@ That hierachy will be converted to a flat list of snippets equivalent to:
"bond.last": "Bond"
}


Custom fonts:
-------------

Custom fonts may be passed via a json file of the correct structure along with a matching value in the font_family property of your config map.

> node awc.js --source screenplay.fountain --pdf --config config.json --fonts myFonts.json

**config.json**

{
font_family: "MyFont"
}

**myFonts.json** (multiple font profiles may be specified)

{
"MyFont":
{
"normal":
{
"src": "<base64 encodeded ttf>"
"family": "MyFont"
},
"bold":
{
"src": "<base64 encodeded ttf>"
"family": "MyFont-Bold"
},
"bolditalic":
{
"src": "<base64 encodeded ttf>"
"family": "MyFont-BoldOblique"
},
"italic":
{
"src": "<base64 encodeded ttf>"
"family": "MyFont-Oblique"
}
}
}

Note: Monospaced fonts are recommended. It is not guaranteed that all fonts will render equally well due to differences is character height and width, so please test your configuration prior to distribution or printing.


Known issues
------------

Expand Down
4 changes: 2 additions & 2 deletions js/core/controller/pdf-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ define(function(require) {
// LOAD IN CUSTOM FONT PROFILE(S)
if (customFonts) {
for (var fontName in customFonts) {
fonts[fontName] = {}
fonts[fontName] = {};
for (var fontType in customFonts[fontName]) {
fonts[fontName][fontType] = {
family: customFonts[fontName][fontType].family,
src: fontUtils.convertBase64ToBinary(customFonts[fontName][fontType].src)
}
};
}
}
}
Expand Down

0 comments on commit d2e65d4

Please sign in to comment.