Skip to content

Commit

Permalink
Merge pull request #1961 from googlefonts/default-glyphset-issue-1944
Browse files Browse the repository at this point in the history
[font overview] When no glyph sets are selected (including the font's own set), select all project sets
  • Loading branch information
justvanrossum authored Jan 17, 2025
2 parents f695d89 + 57d7197 commit 6f1cf23
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/fontra/views/fontoverview/fontoverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getDefaultFontOverviewSettings() {
groupByKeys: [],
projectGlyphSets: {},
myGlyphSets: {},
projectGlyphSetSelection: [THIS_FONTS_GLYPHSET],
projectGlyphSetSelection: [],
myGlyphSetSelection: [],
glyphSetErrors: {},
cellMagnification: 1,
Expand Down Expand Up @@ -227,7 +227,7 @@ export class FontOverviewController extends ViewController {
"customData",
(root) => {
const projectGlyphSets = Object.values(event.newValue).filter(
(glyphSet) => glyphSet.url
(glyphSet) => glyphSet.url !== THIS_FONTS_GLYPHSET
);
root.customData[PROJECT_GLYPH_SETS_CUSTOM_DATA_KEY] = projectGlyphSets;
},
Expand Down Expand Up @@ -315,6 +315,17 @@ export class FontOverviewController extends ViewController {
}
}
});
if (
!this.fontOverviewSettings.myGlyphSetSelection.length &&
!this.fontOverviewSettings.projectGlyphSetSelection.length
) {
this.fontOverviewSettings.projectGlyphSetSelection = [
THIS_FONTS_GLYPHSET,
...Object.values(this.fontOverviewSettings.projectGlyphSets).map(
({ url }) => url
),
];
}
}

_updateWindowLocation() {
Expand Down Expand Up @@ -554,7 +565,7 @@ function openGlyphsInEditor(glyphsInfo, userLocation, glyphMap) {
function readProjectGlyphSets(fontController) {
return Object.fromEntries(
[
{ name: "This font's glyphs", url: "" },
{ name: "This font's glyphs", url: THIS_FONTS_GLYPHSET },
...(fontController.customData[PROJECT_GLYPH_SETS_CUSTOM_DATA_KEY] || []),
].map((glyphSet) => [glyphSet.url, glyphSet])
);
Expand Down

0 comments on commit 6f1cf23

Please sign in to comment.