]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
tags.html: Animate designspace tag result
authorMarc Foley <m.foley.88@gmail.com>
Tue, 21 Jan 2025 12:46:30 +0000 (12:46 +0000)
committerMarc Foley <m.foley.88@gmail.com>
Tue, 4 Mar 2025 10:24:40 +0000 (10:24 +0000)
.ci/tags.html

index 9a2bc3e26f28c8421eb0bc46ff208a864a9d3580..ea20d7ad2e2736945f2eb0b7cfd1000f1a725679 100644 (file)
@@ -6,7 +6,9 @@
 
 <body>
   <div id="app">
-    <link v-for="family in uniqueFamilies" :href="family.toUrl()" rel="stylesheet">
+    <div id="fonts">
+      <link v-for="family in uniqueFamilies" :href="family.toUrl()" rel="stylesheet">
+    </div>
 
     <!-- Navbar -->
     <div style="max-height: 3rem" class="navbar bg-base-100 fixed left-0 top-0 shadow">
     toUrl() {
         let baseUrl = "https://fonts.googleapis.com/css2?family=";
         if (this.axes.length === 0) {
-            return baseUrl + this.name;
+            return baseUrl + this.name.replace(" ", "+");
         }
         let tag = this.toTag();
         return baseUrl + tag.replace(/\|/g, ",");
         <div class="divider"></div>
       </div>
     `,
+    mounted() {
+      if (this.family.axes.length !== 0) {
+        this.$el.children[1].animate(this.family.toAnimation(), { duration: 1000, iterations: Infinity, direction: 'alternate' });
+      }
+    },
     methods: {
       edited() {
         this.$emit('edited', this.family);
         return this.$root.familyPangram(this.family);
       },
       familyStyle() {
-        return `font-family: "${this.family.name}", "Adobe NotDef"; font-size: 32pt;`;
+        return `font-family: ${this.family.name}; font-size: 32pt;`;
       },
       familyDisplayName() {
         return this.family.displayName;
         const seen = new Set();
         let res = [];
         for (let family of this.tags) {
-          if (seen.has(family.name)) {
+          if (seen.has(family.displayName)) {
             continue;
           }
-          seen.add(family.name);
+          seen.add(family.displayName);
           res.push(family);
         }
         return res;
         // Remove all axis inputs for the next family
         this.newAxes = [];
 
+        // display results correctly by ensuring fonts are correct
+        // update fonts
+        const fonts = document.getElementById("fonts").children
+        const newUrl = newFamily.toUrl();
+        for (let i = 0; i < fonts.length; i++) {
+          if (newUrl.includes(fonts[i].href)) {
+            fonts[i].href = newFamily.toUrl();
+          }
+        }
+
       },
       copyFamily() {
         this.isEdited = true;
       src: url(https://cdn.jsdelivr.net/gh/adobe-fonts/adobe-notdef/AND-Regular.ttf);
   }
 </style>
-  
\ No newline at end of file