summaryrefslogtreecommitdiff
path: root/src/FontFamily.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/FontFamily.java')
-rw-r--r--src/FontFamily.java55
1 files changed, 45 insertions, 10 deletions
diff --git a/src/FontFamily.java b/src/FontFamily.java
index 54e174f..8e32f05 100644
--- a/src/FontFamily.java
+++ b/src/FontFamily.java
@@ -8,28 +8,63 @@ import java.util.HashMap;
* References:
*
* Date:
- * 2024-04-28
+ * 2024-05-08
*
* Purpose of class:
* Store and operate on font family metadata.
*/
public class FontFamily {
- /* The directory containing the associated METADATA.pb */
- private String directoryName;
+ /* JSONReader from which metadata is pulled. */
+ private JSONReader metadata;
/* Taken from first line of METADATA.pb */
private String familyName;
/* Taken from fonts/tags/all/families.csv */
- private ArrayList<String> styles;
+ private HashMap<String,Integer> styles;
/* Taken from top level of METADATA.pb */
private String dateAdded;
- /* Average glyph count of every font file specified in METADATA.pb */
- private int glyphCount;
- /* Average file size of every font file specified in METADATA.pb */
- private int fileSize;
- /* Author from METADATA.pb */
- private String author;
+ /* Languages supported. */
+ private String[] languages;
+ private String designer;
/* total views, 7day views, 30day views, 90day views, year views.
Taken from popularity.json. */
private HashMap<String,Long> views;
+ private String license;
+ private String category;
+ /* popularity.json and families.csv are shared among all families.
+ Have their associated objects passed from outside. */
+
+ /*
+ * Constructor.
+ */
+ public FontFamily(JSONReader metadata, JSONReader popularity, CSVReader styles) {
+ this.metadata = metadata;
+ parseMetadata(metadata);
+ parsePopularity(popularity);
+ parseStyles(styles);
+ }
+
+ /*
+ * Parse metadata.
+ */
+ private void parseMetadata(JSONReader metadata) {
+ familyName = metadata.get("name");
+ dateAdded = metadata.get("date_added");
+ languages = metadata.getAll("languages");
+ designer = metadata.get("designer");
+ license = metadata.get("license");
+ category = metadata.get("category");
+ }
+
+ /*
+ * Parse popularity.
+ */
+ private void parsePopularity(JSONReader popularity) {
+ }
+
+ /*
+ * Parse styles.
+ */
+ private void parseStyles(CSVReader styles) {
+ }
}