Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .ci/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,29 +213,32 @@
}

class FontTag {
constructor(name, axes, category, score = 0) {
constructor(name, axes, category, score = 0, providence = "") {
this.name = name;
this.axes = axes;
this.category = category;
this.score = score;
this.providence = providence;
}
static fromCsv(line) {
const [name, axes, category, score] = parseCSVLine(line);
return new FontTag(name, axes, category, score);
const [name, axes, category, score, providence] = parseCSVLine(line);
return new FontTag(name, axes, category, score, providence || "");
}
isVF() {
return this.axes.length > 0;
}

toCsv() {
const prov = this.providence ? `,${this.providence}` : "";
if (this.axes.includes(",")) {
return `${this.name},"${this.axes}",${this.category},${this.score}`;
return `${this.name},"${this.axes}",${this.category},${this.score}${prov}`;
}
return `${this.name},${this.axes},${this.category},${this.score}`;
return `${this.name},${this.axes},${this.category},${this.score}${prov}`;
}

toTag() {
return `${this.name},${this.axes},${this.category},${this.score}`;
const prov = this.providence ? `,${this.providence}` : "";
return `${this.name},${this.axes},${this.category},${this.score}${prov}`;
}
get tag() {
return this.toTag();
Expand Down Expand Up @@ -812,7 +815,7 @@
})
.then(csvText => {
this.tags = this.parseCSV(csvText);
csvText = "Family,Axes,Group/Tag,Weight\r\n" + csvText;
csvText = "Family,Axes,Group/Tag,Weight,Providence\r\n" + csvText;
})
},
parseCSV(text) {
Expand Down
7 changes: 4 additions & 3 deletions .ci/test_font_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def family_tags():
for row in reader:
if not row:
continue
res.append([row[0], row[1], row[2], float(row[3])])
providence = row[4] if len(row) > 4 else ""
res.append([row[0], row[1], row[2], float(row[3]), providence])
return res


Expand Down Expand Up @@ -59,15 +60,15 @@ def test_categories_exist(family_tags, tags_metadata):
tags_metadata.csv file
"""
meta_categories = set(tags_metadata)
families_categories = set(cat for _, _, cat, _ in family_tags)
families_categories = set(cat for _, _, cat, *_ in family_tags)
missing = families_categories - meta_categories
assert not missing, f"Missing categories: {missing}"


def test_no_duplicate_families(family_tags):
seen = set()
dups = []
for family, axes, cat, _ in family_tags:
for family, axes, cat, *_ in family_tags:
key = (family, axes, cat)
if key in seen:
dups.append(",".join(key))
Expand Down
2 changes: 1 addition & 1 deletion tags/all/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Contents:

* families.csv - expressive and typographic tags, human assessed
* families.csv - expressive and typographic tags, human assessed and machine predicted.
* quant.csv - measured values, machine assessed
* skip.csv - signals to machine assessors, formulated as tags, human assessed
Loading
Loading