ソースを参照

Adding waveTop/waveBottom defaults

Noah 7 年 前
コミット
5ff2c799c7
共有2 個のファイルを変更した10 個の追加4 個の削除を含む
  1. 4 4
      THEMES.md
  2. 6 0
      renderer/index.js

+ 4 - 4
THEMES.md ファイルの表示

@@ -79,11 +79,11 @@ When designing your own themes, keep in mind that web browsers and social apps p
79 79
 
80 80
 By default, Audiogram will already have access to fonts on your system.  This might be fine for local use, but it will become a problem on a server without the fonts you're used to, or if you want to use a specific font across lots of installations.
81 81
 
82
-The good news is that you can load custom fonts directly with the `fonts` list in `settings/index.js`. Each font in the array is an object with `name` (the font family name in `captionFont`) and `file`, the absolute path to the font file.  For example:
82
+The good news is that you can load custom fonts directly with the `fonts` list in `settings/index.js`. Each font in the array is an object with `family` (the font family name in `captionFont`) and `file`, the absolute path to the font file.  For example:
83 83
 
84 84
 ```js
85 85
 fonts: [
86
-  { name: "Gotham", file: "/where/to/find/Gotham.ttf" }
86
+  { family: "Gotham", file: "/where/to/find/Gotham.ttf" }
87 87
 ]
88 88
 ```
89 89
 
@@ -91,8 +91,8 @@ Now you can specify a caption font like `32px Gotham` and it should work.  You c
91 91
 
92 92
 ```js
93 93
 fonts: [
94
-  { name: "Gotham", file: "/where/to/find/Gotham-Bold.ttf", weight: "bold" },
95
-  { name: "Gotham", file: "/where/to/find/Gotham-Italic.ttf", style: "italic" }
94
+  { family: "Gotham", file: "/where/to/find/Gotham-Bold.ttf", weight: "bold" },
95
+  { family: "Gotham", file: "/where/to/find/Gotham-Italic.ttf", style: "italic" }
96 96
 ]
97 97
 ```
98 98
 

+ 6 - 0
renderer/index.js ファイルの表示

@@ -15,6 +15,12 @@ module.exports = function(context) {
15 15
     options.backgroundColor = options.backgroundColor || "#fff";
16 16
     options.waveColor = options.waveColor || options.foregroundColor || "#000";
17 17
     options.captionColor = options.captionColor || options.foregroundColor || "#000";
18
+    if (typeof options.waveTop !== "number") {
19
+      options.waveTop = 0;
20
+    }
21
+    if (typeof options.waveBottom !== "number") {
22
+      options.waveBottom = options.height;
23
+    }
18 24
     this.wrapText = textWrapper(context, options);
19 25
     this.options = options;
20 26
     this.waveform = options.waveform || [sample.slice(0, options.samplesPerFrame)];