dwelle 1 سال پیش
والد
کامیت
f7a6bffb99
6فایلهای تغییر یافته به همراه24 افزوده شده و 0 حذف شده
  1. 7 0
      index.html
  2. BIN
      public/VirgilNew2023Beta-Regular.woff2
  3. 6 0
      public/fonts.css
  4. 5 0
      src/actions/actionProperties.tsx
  5. 4 0
      src/constants.ts
  6. 2 0
      src/element/textElement.ts

+ 7 - 0
index.html

@@ -111,6 +111,13 @@
       type="font/woff2"
       type="font/woff2"
       crossorigin="anonymous"
       crossorigin="anonymous"
     />
     />
+    <link
+      rel="preload"
+      href="/VirgilNew2023Beta-Regular.woff2"
+      as="font"
+      type="font/woff2"
+      crossorigin="anonymous"
+    />
     <link
     <link
       rel="preload"
       rel="preload"
       href="/Cascadia.woff2"
       href="/Cascadia.woff2"

BIN
public/VirgilNew2023Beta-Regular.woff2


+ 6 - 0
public/fonts.css

@@ -5,6 +5,12 @@
   font-display: swap;
   font-display: swap;
 }
 }
 
 
+@font-face {
+  font-family: "Virgil2";
+  src: url("VirgilNew2023Beta-Regular.woff2");
+  font-display: swap;
+}
+
 /* https://github.com/microsoft/cascadia-code */
 /* https://github.com/microsoft/cascadia-code */
 @font-face {
 @font-face {
   font-family: "Cascadia";
   font-family: "Cascadia";

+ 5 - 0
src/actions/actionProperties.tsx

@@ -698,6 +698,11 @@ export const actionChangeFontFamily = register({
         text: t("labels.handDrawn"),
         text: t("labels.handDrawn"),
         icon: FreedrawIcon,
         icon: FreedrawIcon,
       },
       },
+      {
+        value: FONT_FAMILY.HAND_DRAWN2.fontFamilyId,
+        text: t("labels.handDrawn"),
+        icon: FreedrawIcon,
+      },
       {
       {
         value: FONT_FAMILY.NORMAL.fontFamilyId,
         value: FONT_FAMILY.NORMAL.fontFamilyId,
         text: t("labels.normal"),
         text: t("labels.normal"),

+ 4 - 0
src/constants.ts

@@ -98,6 +98,10 @@ export const FONT_FAMILY = {
     fontFamilyId: 1,
     fontFamilyId: 1,
     fontFamily: "Virgil",
     fontFamily: "Virgil",
   },
   },
+  HAND_DRAWN2: {
+    fontFamilyId: 4,
+    fontFamily: "Virgil2",
+  },
   NORMAL: {
   NORMAL: {
     fontFamilyId: 2,
     fontFamilyId: 2,
     fontFamily: "Helvetica",
     fontFamily: "Helvetica",

+ 2 - 0
src/element/textElement.ts

@@ -970,6 +970,8 @@ const DEFAULT_LINE_HEIGHT = {
   // Gecko (FF) uses ~1.28.
   // Gecko (FF) uses ~1.28.
   [FONT_FAMILY.HAND_DRAWN.fontFamilyId]:
   [FONT_FAMILY.HAND_DRAWN.fontFamilyId]:
     1.25 as ExcalidrawTextElement["lineHeight"],
     1.25 as ExcalidrawTextElement["lineHeight"],
+  [FONT_FAMILY.HAND_DRAWN2.fontFamilyId]:
+    1.25 as ExcalidrawTextElement["lineHeight"],
   // ~1.15 is the average for Virgil in WebKit and Blink.
   // ~1.15 is the average for Virgil in WebKit and Blink.
   // Gecko if all over the place.
   // Gecko if all over the place.
   [FONT_FAMILY.NORMAL.fontFamilyId]:
   [FONT_FAMILY.NORMAL.fontFamilyId]: