Browse Source

Adding waveTop/waveBottom defaults

Noah 8 years ago
parent
commit
5ff2c799c7
2 changed files with 10 additions and 4 deletions
  1. 4 4
      THEMES.md
  2. 6 0
      renderer/index.js

+ 4 - 4
THEMES.md View File

79
 
79
 
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.
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
 ```js
84
 ```js
85
 fonts: [
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
 
91
 
92
 ```js
92
 ```js
93
 fonts: [
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 View File

15
     options.backgroundColor = options.backgroundColor || "#fff";
15
     options.backgroundColor = options.backgroundColor || "#fff";
16
     options.waveColor = options.waveColor || options.foregroundColor || "#000";
16
     options.waveColor = options.waveColor || options.foregroundColor || "#000";
17
     options.captionColor = options.captionColor || options.foregroundColor || "#000";
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
     this.wrapText = textWrapper(context, options);
24
     this.wrapText = textWrapper(context, options);
19
     this.options = options;
25
     this.options = options;
20
     this.waveform = options.waveform || [sample.slice(0, options.samplesPerFrame)];
26
     this.waveform = options.waveform || [sample.slice(0, options.samplesPerFrame)];