forked from microsoft/BotFramework-Composer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update global font settings (microsoft#5926)
- Loading branch information
Showing
6 changed files
with
76 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
Composer/packages/client/src/recoilModel/utils/fontUtil.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
const getOS = () => { | ||
const userAgent = window.navigator.userAgent, | ||
platform = window.navigator.platform, | ||
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], | ||
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], | ||
iosPlatforms = ['iPhone', 'iPad', 'iPod']; | ||
const os = { | ||
isMacintosh: false, | ||
isLinux: false, | ||
isWindows: false, | ||
isAndroid: false, | ||
isiOS: false, | ||
}; | ||
|
||
if (macosPlatforms.indexOf(platform) !== -1) { | ||
os.isMacintosh = true; | ||
} else if (iosPlatforms.indexOf(platform) !== -1) { | ||
os.isiOS = true; | ||
} else if (windowsPlatforms.indexOf(platform) !== -1) { | ||
os.isWindows = true; | ||
} else if (/Android/.test(userAgent)) { | ||
os.isAndroid = true; | ||
} else if (/Linux/.test(platform)) { | ||
os.isLinux = true; | ||
} | ||
return os; | ||
}; | ||
|
||
// font align with vscode https://github.com/microsoft/vscode/blob/main/src/vs/editor/common/config/editorOptions.ts#L3680 | ||
const DEFAULT_WINDOWS_FONT_FAMILY = "Consolas, 'Courier New', monospace"; | ||
const DEFAULT_MAC_FONT_FAMILY = "Menlo, Monaco, 'Courier New', monospace"; | ||
const DEFAULT_LINUX_FONT_FAMILY = "'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'"; | ||
|
||
export const getDefaultFontSettings = () => { | ||
const PLATFORM = getOS(); | ||
return { | ||
fontFamily: PLATFORM.isMacintosh | ||
? DEFAULT_MAC_FONT_FAMILY | ||
: PLATFORM.isLinux | ||
? DEFAULT_LINUX_FONT_FAMILY | ||
: DEFAULT_WINDOWS_FONT_FAMILY, | ||
fontWeight: 'normal', | ||
fontSize: '14px', | ||
lineHeight: 0, | ||
letterSpacing: 0, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters