Skip to content

Commit

Permalink
Fix display of some emoji on Windows (excalidraw#1933)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerbCaudill authored Jul 19, 2020
1 parent e2640ed commit 29f803e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export const FONT_FAMILY = {
3: "Cascadia",
} as const;

export const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";

export const DEFAULT_FONT_SIZE = 20;
export const DEFAULT_FONT_FAMILY: FontFamily = 1;
export const DEFAULT_TEXT_ALIGN = "left";
Expand Down
8 changes: 6 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { FlooredNumber } from "./types";
import { getZoomOrigin } from "./scene";
import { CURSOR_TYPE, FONT_FAMILY } from "./constants";
import {
CURSOR_TYPE,
FONT_FAMILY,
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
import { FontFamily, FontString } from "./element/types";

export const SVG_NS = "http://www.w3.org/2000/svg";
Expand Down Expand Up @@ -66,7 +70,7 @@ export const getFontFamilyString = ({
}: {
fontFamily: FontFamily;
}) => {
return FONT_FAMILY[fontFamily];
return `${FONT_FAMILY[fontFamily]}, ${WINDOWS_EMOJI_FALLBACK_FONT}`;
};

/** returns fontSize+fontFamily string for assignment to DOM elements */
Expand Down

0 comments on commit 29f803e

Please sign in to comment.