You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-31Lines changed: 15 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
Google Font CLI
2
2
=============
3
3
4
+
> This tool uses [google-webfonts-helper](https://gwfh.mranftl.com/) to access Google Fonts without requiring an API key.
4
5
5
6
Google Font CLI is a NodeJS module/CLI that lets you Search, Download and Install fonts offered by Google Web Fonts.
6
7
@@ -138,19 +139,12 @@ And then you can require it in your code:
138
139
var GoogleFontList =require('google-font-cli');
139
140
```
140
141
141
-
To use this API is necessary to obtain a Browser Key enabled to Google Font API from the [Google Developer Dashboard](https://console.developers.google.com/).
142
-
143
142
### GoogleFontList
144
143
145
-
**GoogleFontList** is a class that can be instanced with the Google API Key as only argument.
146
-
```js
147
-
var fontList =newGoogleFontList('API_KEY');
148
-
```
149
-
If you prefer you can also create an instance without the apiKey and call the methods `.setApiKey('API_KEY')` and `.downloadList()` in a second moment.
144
+
**GoogleFontList** is a class that downloads the font list from google-webfonts-helper.
150
145
```js
146
+
var GoogleFontList =require('google-font-cli');
151
147
var fontList =newGoogleFontList();
152
-
fontList.setApiKey('API_KEY');
153
-
fontList.downloadList();
154
148
```
155
149
<aid="google-font-list-events"></a>
156
150
@@ -163,9 +157,7 @@ Emitter if something go wrong in downloading, coverting or processing data. The
163
157
<aid="google-font-list-properties"></a>
164
158
#### Public properties
165
159
###### `data`[Array]
166
-
Array of GoogleFont instances, a class that extends the data provided by the Google APIs. Empty until 'success' event.
167
-
###### `apiKey`[String]
168
-
The Google APIs Key setted with the constructor or with setApiKey().
160
+
Array of GoogleFont instances, a class that extends the data provided by google-webfonts-helper. Empty until 'success' event.
169
161
170
162
<aid="google-font-list-methods"></a>
171
163
#### Public methods
@@ -175,22 +167,16 @@ The Google APIs Key setted with the constructor or with setApiKey().
175
167
- Returns [String|Boolean] If apiKey is a valid string, return the apiKey trimmed, else returns false.
176
168
177
169
Used to set the apiKey to download data from Google Web Font APIs.
178
-
179
-
###### `downloadList()`
180
-
Download the list from Google Web Font APIs.
181
-
182
-
###### `parseRawData(rawData)`
183
-
-_rawData_[String] String in valid JSON format.
184
-
185
-
Parse raw data in valid JSON format. Used internally, but public for convenience if someone prefers to use the object without downloading the list (ex. cached data).
170
+
downloadList()`
171
+
Download the list from google-webfonts-helpernternally, but public for convenience if someone prefers to use the object without downloading the list (ex. cached data).
186
172
187
173
###### `populate(jsonData)`
188
174
-_jsonData_[Array] An array of Object rappresenting the font like Google does.
189
175
190
-
Populate the object `data` property with an array of GoogleFont instances, based on the data provided by Google Apis. Used internally, but public for convenience if someone prefers to use the object without downloading and parsing the list (ex. cached data).
176
+
Populate the object `data` property with an array of GoogleFontfrom google-webfonts-helper.
191
177
192
-
###### `clone()`
193
-
- Returns [GoogleFontList] A new instance of GoogleFontList
178
+
Populate the object `data` property with an array of GoogleFont instances, based on the data provided by google-webfonts-helper
179
+
- Returns [GoogleFontList] A new in from google-webfonts-helperstance of GoogleFontList
194
180
195
181
Return a new instance of the object, with the same `data` and `apiKey` properties.
196
182
@@ -259,21 +245,21 @@ It's instanced by the populate method of GoogleFontList, called internally by th
Inherits by Google Font API structure, respectively the font name, the font type (serif, sans-serif, etc), the version and the string rappresenting the last modification data.
261
247
###### `subsets`[Array]
262
-
Inherits by Google Font API structure, a list of the available subsest for that font.
248
+
Inherits by google-webfonts-helper data structure, respectively the font name, the font type (serif, sans-serif, etc), the version and the string rappresenting the last modification data.
249
+
###### `subsets`[Array]
250
+
Inherits by google-webfonts-helper data structure, a list of the available subsest for that font.
263
251
###### `variants`[Array]
264
-
Inherits by Google Font API structure, a list of all available variants (weights) for that font.
252
+
Inherits by google-webfonts-helper data structure, a list of all available variants (weights) for that font.
265
253
###### `files`[Object]
266
-
Inherits by Google Font API structure, an object with key-value of variant and ttf remote file.
267
-
###### `cssUrl`[String]
268
-
Url of the css file containing the ready-to-use imports for the web about that specific font.
254
+
Inherits by google-webfonts-helper dataing the ready-to-use imports for the web about that specific font.
Method to access to the public properties: it's a better idea use them insteed the properties for a future-proof reason. Maybe someday google will decide to changhe his properties names.
275
261
All returns the type of the property, except `GetLastMod()` that return a new Date instance.
276
-
262
+
ad of the properties for a future-proof reason. Maybe someday the data structure will change
277
263
##### `hasVariant(variant)`
278
264
- variant [String] The name of a variant (300, 500, etc);
279
265
- Returns [Boolean] true if the font has that variant, else returns false.
@@ -321,8 +307,6 @@ Install specified variants of the font. The destination folder depends on the pl
321
307
```js
322
308
var GoogleFontlist =require('google-font-cli');
323
309
324
-
var fontList =newGoogleFontlist('VALID_API_KEY');
325
-
326
310
fontList.on('success', function(){
327
311
this.searchFontByName('Source Sans Pro', function(err, filteredList) {
0 commit comments