From d2e65d475fe30e83eaa4d67f35287064b3e9f92a Mon Sep 17 00:00:00 2001 From: Jesse Bostic Date: Thu, 19 Apr 2018 21:08:49 -0700 Subject: [PATCH] add custom font documentation --- docs/clients.md | 45 ++++++++++++++++++++++++++++ js/core/controller/pdf-controller.js | 4 +-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/docs/clients.md b/docs/clients.md index eba3eca6..5303a76f 100644 --- a/docs/clients.md +++ b/docs/clients.md @@ -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": "" + "family": "MyFont" + }, + "bold": + { + "src": "" + "family": "MyFont-Bold" + }, + "bolditalic": + { + "src": "" + "family": "MyFont-BoldOblique" + }, + "italic": + { + "src": "" + "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 ------------ diff --git a/js/core/controller/pdf-controller.js b/js/core/controller/pdf-controller.js index 2c7cd6cc..f8dd6987 100644 --- a/js/core/controller/pdf-controller.js +++ b/js/core/controller/pdf-controller.js @@ -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) - } + }; } } }